Xymon Mailing List Archive search

Renaming a host and keeping the history - lessons learned

2 messages in this thread

list Charles Jones · Tue, 29 Aug 2006 15:50:34 -0700 ·
I started to type this email to describe a problem I was having, and in the process I figured it out. I thought I would share it for amusement and learning purposes :)

I have several hosts that I had to rename. Their DNS and hostname names changed but IPs remained the same. Example:
myhost-web-1 -> myhost-demoweb-1
myhost-app-3 -> myhost-demoapp-1
myhost-db-2 -> myhost-demodb-1

I wanted to keep the historical trending info, so I proceded as follows:
1. Stopped the Hobbit server
2. Made the changes to bb-hosts, simply replacing the hostnames
3. renamed data/*hist*/myhost-web-1.* to data/*hist*/myhost-demoweb-1 (did the same for the other hosts)
4. renamed data/*histlogs*/myhost-web-1 to data/*histlogs*/myhost-demoweb-1 (did the same for the other hosts)
5. renamed data/*hostdata*/myhost-web-1 to data/*hostdata*/myhost-demoweb-1 (did the same for the other hosts)
6. renamed data/*rrd*/myhost-web-1 to data/*rrd*/myhost-demoweb-1 (did the same for the other hosts)
7. Restarted Hobbit

After the restart, the new hostnames appeared, but the only status I had was conn and ssh. After double-checking that I renamed the files properly and then wondering why I was getting no status updates it hit me. The hobbit *clients* had not been restarted! So Hobbit was polling them (I use /pulldata/), and they were reporting their old hostnames. :-) I restarted the clients on the hosts, and viola! They restarted with their proper hostnames and Hobbit could now recognize them.

I am pleased to report that now everything is now as it should be, and the trending data is intact.

Ways I could have figured this out quicker:
1. Thinking it all the way through from the beginning. I was smart enough to stop Hobbit before I began so that it would not create or overwrite the rrd and other files that I was renaming, but I didn't think to restart the clients.
2. I could have checked the ghosts report (hobbitd status) and noticed that the clients were reporting with their old names (I didn't notice this until after I fixed it)

Hopefully this "problem" and resolution will prove helpful to someone ... even if it's only to help them chuckle at my newbie mistake :)

-Charles
list Henrik Størner · Wed, 30 Aug 2006 07:35:35 +0200 ·
quoted from Charles Jones
On Tue, Aug 29, 2006 at 03:50:34PM -0700, Charles Jones wrote:
I have several hosts that I had to rename. Their DNS and hostname names 
changed but IPs remained the same. Example:
myhost-web-1 -> myhost-demoweb-1
myhost-app-3 -> myhost-demoapp-1
myhost-db-2 -> myhost-demodb-1

I wanted to keep the historical trending info, so I proceded as follows:
1. Stopped the Hobbit server
2. Made the changes to bb-hosts, simply replacing the hostnames
3. renamed data/*hist*/myhost-web-1.* to data/*hist*/myhost-demoweb-1 
(did the same for the other hosts)
4. renamed data/*histlogs*/myhost-web-1 to 
data/*histlogs*/myhost-demoweb-1 (did the same for the other hosts)
5. renamed data/*hostdata*/myhost-web-1 to 
data/*hostdata*/myhost-demoweb-1 (did the same for the other hosts)
6. renamed data/*rrd*/myhost-web-1 to data/*rrd*/myhost-demoweb-1 (did 
the same for the other hosts)
7. Restarted Hobbit
You could have saved yourself a lot of work if you'd read this first:
http://www.hswn.dk/hobbit/help/hobbit-tips.html#renamehost

    How do I rename a host in the Hobbit display?

    First, change the ~/server/etc/bb-hosts file so it has the new name.
    Then to move your historical data over to the new name, run

       ~/server/bin/bb 127.0.0.1 "rename OLDHOSTNAME NEWHOSTNAME"

That takes care of all the renaming you did manually, plus it
transparently changes the Hobbit status while it is running to use
the new hostname. (It won't change the client hostname configuration, 
though).

In general you should *never* have to stop/start Hobbit. The only
exception is (some) changes to the hobbitserver.cfg configuration
file. Adding, deleting or renaming hosts never requires a restart.


Regards,
Henrik