HowTo Squeeze KVM 0.8.8a migration from 0.8.7 in 3 hours

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
dereknm
Posts: 1
Joined: Sun Jan 27, 2013 10:24 pm

HowTo Squeeze KVM 0.8.8a migration from 0.8.7 in 3 hours

Post by dereknm »

I've been using this forum for a few years for tips, templates, PA, plugins, etc. I
didn't join until this week. I might have something useful to KVM/vmWare staff
in a hurry.

This week I wanted to migrate to a new Cacti 0.8.8a with Nagios3 NPC 2.0.4
Spine autom8 and addl plugins.

I prefer Debian Squeeze repositories patches, and was initially disappointed that
the Squeeze maintainers have not/will not upgrade to 0.8.8a. Backport is not available, either.
Even if it were, the Nagios3 and cacti is not a smooth aptitude install.

Thanks to the HOWTO posts by rmellissari and others, I was able to create a KVM gz
image that can be decompressed and booted in an hour without the hassle patching
and merging Nagios3 libraries with the source from cacti.net. Only Spine and Cacti 088a
are built from source. The rest of the package is stock Debian from apt-get.

Also, thanks to pepj here http://forums.cacti.net/viewtopic.php?f ... &start=120,
I integrated the migration scripts for dumping, creating Nagios3, loading Cacti devices,
and re-creating graphs (autom8).

We finished migrating from 0.8.7d Lenny without the pain of this initial build. We
felt we should at least share it with those that want the benefits without the pain.
Integrated PA is a huge win, too! Thank you.

Start with your old Cacti install:
A. Download the hosts-add-script.php from pepj link and dump all your devices using:
php hosts-add-script.php --cacti=/usr/share/cacti/site --separator='|' --f=devices.txt
--all-device-infos
B. Export all your Templates to xml files to load in 088a

devices.txt will be copied to the new server to generate the Nagios3/hosts/services
and then later loaded into Cacti 088a

To migrate to a snapshot Debian Squeeze, fully loaded, with Cacti/Nagios3:

1. Download the KVM vm definition http://www.datamtn.com/downloads/vmCactiN3.xml
2. Download the 2.1 GB image (compressed) http://www.datamtn.com/downloads/vmCacti88aNPCv0.1.gz
3. Create a 60GB partition (using your way or mine):
lvcreate --size 60G --name vmNPC myvg
4. Restore the image (using my way):
gzip -d -c vmCacti88aNPCv0.1.gz | dd of=/dev/myvg/vmNPC
5. Edit the download from 1 to reflect the new drive, num CPUs, vnet#, etc.
6. Create the new vm (your way or mine): virsh define vmCactiN3.xml
7. Start the vm (your way or mine): virsh start vmNPC
8. Login after boot: admin 5admin5 su and web iface is same
9. vi /etc/network/interfaces and give your ipv4 and ipv6 info.
10. shutdown -r now
11. apt-get update
12. apt-get upgrade
13. Import templates from (B) into Cacti

Minus download and decompress time, you are ready to migrate in less than 15 minutes.

14. Copy the devices.txt file from (A) to the new server.
15. Read the README, run nag*.sh > mydevices.cfg and copy to /etc/nagios3/conf.d
16. /etc/init.d/nagios3 restart | more and fix any preflight errors in sh or manually
17. Login to cacti and configure autom8 rules on what graphs/trees to auto create when
devices.txt is processed. Dont forget Settings -> Misc -> Enable autom8
or you will load devices and have no graphs. Perhaps test a few first to make sure
the desired graphs are getting created automatically.
18. cp ~/installed-plugins/hosts-add-script.php to /home/admin and edit/vi
this file to upgrade it to 0.8.8a, changing the end of line 471:

.....,$max_oids, 1);

Failure to edit this script before migration causes this warning in 0.8.8.a:
PHP Warning: Missing argument 23 for api_device_save(), called in
/opt/cacti-0.8.8a/hosts-add-script.php on line 471 and defined in
/opt/cacti-0.8.8a/lib/api_device.php on line 97
PHP Notice: Undefined variable: device_threads in
/opt/cacti-0.8.8a/lib/api_device.php on line 144

19. vi /etc/php5/cli/php.ini and edit memory_limit = -1 to be memory_limit = 512M
20. Now run the php script from A to load devices

php hosts-add-script.php --cacti=/opt/cacti-0.8.8a --separator='\|' --f=devices.txt

21. Setup mail server to send alerts through your mx smtp server:
http://library.linode.com/email/exim/se ... -6-squeeze

Thanks to Frank for the bash script to generate nagios cfg. It's tweeked it to parse the
cacti devices.txt file, added check_snmp! and add Windows and Linux servers to different
hostgroups. Based on their response to an SNMP sysinfo request.

http://nagios.frank4dd.com/howto/nagios ... covery.htm
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest