[HOW TO] Easy Install Nagios/Cacti/NPC Ubuntu 12.04

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
HeWhoWas
Posts: 2
Joined: Wed Sep 12, 2012 6:37 pm

[HOW TO] Easy Install Nagios/Cacti/NPC Ubuntu 12.04

Post by HeWhoWas »

Hey All,

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
Edit the sources.list to point to the correct distro.

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
Install the required packages:

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
Change the following information:
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
Append the following line under the "Broker" section:
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_NDOUTILS=1

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!
cachorroyayo
Cacti User
Posts: 53
Joined: Thu Sep 17, 2009 5:37 pm
Location: Lima - Peru

Re: [HOW TO] Easy Install Nagios/Cacti/NPC Ubuntu 12.04

Post by cachorroyayo »

Hello
Where you download ndo2utils from?
I'm trying to configure in CentOS 6.3 with a nagios 3.4 downloaded from epel repository but I can't complete the process because I can't find some files or paths.


I will appreciate your help and advices.


best regards.


Atte.
Eduardo Mejia V.
Lima Peru
bajangerry
Posts: 1
Joined: Fri Nov 02, 2012 10:44 am

Re: [HOW TO] Easy Install Nagios/Cacti/NPC Ubuntu 12.04

Post by bajangerry »

Hi,
Thanks for this great instruction!
agnesresama
Posts: 2
Joined: Tue Apr 21, 2015 10:52 pm

Re: [HOW TO] Easy Install Nagios/Cacti/NPC Ubuntu 12.04

Post by agnesresama »

i can't found table cacti.npc_hostchecks. I've followed the steps - steps above :cry:
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests