After many a day struggling with Nagios/NPC and Cacti, I've finally got it running. This guide will not give you the latest versions of everything, it will give you whatever is in the official repo's, along with an update cacti version that has the Plugin Arch built in. This is the "Get it working" guide.
Nagios, Cacti & Nagios Plugin for Cacti (NPC) Installation Guide - Ubuntu 12.04
Add updated cacti PPA to your system (This has plugin arch already built in, avoids a lot of hassle):
Code: Select all
sudo apt-add-repository ppa:paul-climbing/cacti
Code: Select all
sudo nano /etc/apt/sources.list.d/paul-climbing-cacti-precise.list
And change both instances of the word "precise" to "quantal".
Ctrl O to save. Ctrl X to exit.
Update apt:
Code: Select all
sudo apt-get update
Code: Select all
sudo apt-get install cacti cacti-spine
sudo apt-get install nagios3 ndoutils-nagios3-mysql
Download and install the NPC Plugin:
Code: Select all
wget http://hewhowas.net/npc-2.0.4.tar.gz
tar -xzf npc-2.0.4.tar.gz
sudo mv npc /usr/share/cacti/site/plugins/
Configure NDOUtils:
Code: Select all
sudo nano /etc/nagios3/ndo2db.cfg
db_name = cacti
db_prefix = npc_
db_user=cacti
db_pass=<Cacti MYSQL Password>
Configure Nagios:
Code: Select all
sudo nano /etc/nagios3/nagios.cfg
broker_module=/usr/lib/ndoutils/ndomod-mysql-3x.o config_file=/etc/nagios3/ndomod.cfg
Enable external commands:
check_external_commands=1
Enable processing performance data:
process_performance_data=1
Ctrl+O to save
Ctrl+X to exit
Configure Cacti:
Open your web browser and go to http://HOSTNAME/cacti
Follow initial login wizard. Should be self explanatory, however if it's a new installation:
Click Next
Click Next
Check Everything says "OK" and there are no "Failed" errors - there shouldn't be if you've followed this guide!
If everything is "OK" click Finish. If not, install the missing components. If you run into trouble, post a comment here.
Login with the default details admin/admin, update the password when prompted.
Open "Plugin Management"
Install the NPC plugin, but DO NOT ENABLE IT YET.
Open "Settings -> Poller"
Change Poller Type to "Spine"
Click "Save"
Fix the databases (NPC plugin does not create them correctly):
Going back to the SSH terminal:
sudo mysql -uroot -p cacti
<Enter Password>
Code: Select all
ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`;
exit
Enable ndo2db:
Code: Select all
sudo nano /etc/default/ndoutils
Enable NPC:
Going back to http://HOSTNAME/cacti
Open "Plugin Management"
Enable the NPC Plugin.
Open "Settings -> NPC"
Put a check in "Remote Commands"
Enter "/var/lib/nagios3/rw/nagios.cmd" Nagios Command File Path
Choose your date format.
Click "Save"
Start/Restart Services:
Back to SSH Terminal
Code: Select all
sudo service nagios3 restart
sudo service ndoutils restart
Now, open up Cacti, and you should be good to go!