Você está na página 1de 4

Nagios XI Installing Cacti Alongside XI

The Industry Standard in IT Infrastructure Monitoring


Purpose
This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a
working copy of Nagios XI.

Target Audience
This document is intended for use by Nagios XI Administrators who wish to use the Cacti as a supplement to Nagios XI.

Installing Prerequisites
Before you can install Cacti on your Nagios XI server, you'll need to install a prerequisite component by running the following command:
yum install php-pear-Net-SMTP

Installing Cacti
You can install Cacti with the following command:
yum install cacti
You're not done yet! Keep following the steps outlined below to finish the Cacti setup.

Configuring MySQL
Since MySQL is already configured in your Nagios XI install with the default root password of 'nagiosxi', this document will assume that
the default is still being used. If you have changed this login credentials, adjust the following commands to suit your changes.
mysql -u root -p'nagiosxi'
> create database cacti;
> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipassword';
> FLUSH privileges;
> exit
Now its time to dump the premade cacti database into the database you just created. The first thing you'll need to do is find/verify the
location of the cacti.sql file. This file is normally located at /usr/share/doc/cacti-0.8.8a/cacti.sql . You can locate the file on your system
by running the following command:
locate cacti.sql
Once you've found your cacti.sql you simply need to dump it into mysql using the following command:
mysql -u cacti -p'cactipassword' cacti < path_to_cacti.sql
Make sure that the import went smoothly by running the following command:
mysql -u cacti -p'cactipassword' -e "use cacti; show tables;"
If this writes a blank list to the screen then something went wrong when importing cacti.sql. Possible problems might include a bad
cacti.sql being used or login credentials being incorrect.

Nagios Enterprises, LLC


P.O. Box 8154
Saint Paul, MN 55108
USA

US: 1-888-NAGIOS-1
Int'l: +1 651-204-9102
Fax: +1 651-204-9103

Web: www.nagios.com
Email: sales@nagios.com

Page 1
Copyright 2011 Nagios Enterprises, LLC
Revision 1.0 August, 2013

Nagios XI Installing Cacti Alongside XI


Configuring SNMP
Next you'll need to configure NET-SNMP for Cacti. If you know exactly what you want out of SNMP and know what's going on
underneath the hood, then you can skim over this part. However, if you haven't ever configured snmpd.conf before, what follows are
good guidelines to get you started.
The first thing you'll need to do is edit the main snmpd configuration file (/etc/snmp/snmpd.conf). If you've never edited this file before,
the majority of the lines are comment out. What you'll need to do is find the lines that aren't commented out. The heading that you'll be
editing under is a section called # Access Control. Under this heading find the line that begins with com2sec and replace it with
com2sec

local localhost

public

Further down in the file you need to edit the groups. You'll want to delete the existing group lines and replace them with this:
group
group
group

MyRWGroup
MyRWGroup
MyRWGroup

v1
v2c
usm

local
local
local

Next, replace the view line with this line:


view

all

included

.1

Note that no mask is set. This is not an error.


Now edit the line that begins with access and change it to match the following:
access MyRWGroup

any

noauth exact all

all

none

Now scroll down and under # System contact information and make sure the lines look like this:
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root (configure /etc/snmp/snmp.local.conf)
Finally, under the # Pass through control section find the Uncommented line that begins with pass and make sure the line looks like
this:
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat
Save the file. That should be all you need to get you started.
Check to see if the config makes sense to snmpd by restart/starting snmpd with the following command:
service snmpd restart
If the starting portion of snmpd fails, then go through the above steps again. Also, its probably a good idea to make sure snmpd is
started upon bootup:
chkconfig snmpd on
Now its time to test SNMP out. Run the following command:
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
The command should return output similar to the following:
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.5.70 = INTEGER: 2
If this is what snmpwalk returns then you're good to go. Keep in mind the IPs won't necessarily be the same. If you're getting results
from snmpwalk, you're done here!

Nagios Enterprises, LLC


P.O. Box 8154
Saint Paul, MN 55108
USA

US: 1-888-NAGIOS-1
Int'l: +1 651-204-9102
Fax: +1 651-204-9103

Web: www.nagios.com
Email: sales@nagios.com

Page 2
Copyright 2011 Nagios Enterprises, LLC
Revision 1.0 August, 2013

Nagios XI Installing Cacti Alongside XI


Configuring Cacti
The next thing you'll need to do is tell Cacti where its database is and what login credentials to use. Edit the Cacti configuration file
(/usr/share/cacti/include/config.php) to change these settings.
If you used different login credentials when setting up the cacti MySQL database, make sure you use them here as well. Make sure the
lines look like this:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactipassword";
$database_port = "3306";

Setting Access Permissions


Next you need to allow access to the Cacti web interface. You do this by editing the Cacti httpd configuration file
(/etc/httpd/conf.d/cacti.conf).
Edit the allow from line to allow access from any IP address as follows:
allow from all
The following entry would allow just a single specific IP to be able to access the Cacti web interface:
allow from 192.168.5.45
The following entry will allow only machines from the 192.168.5.45 network to access the Cacti interface:
allow from 192.168.5.0/24
Save the file and restart the Apache web server with the following command:
service httpd restart
One last thing to check is the cron configuration. Edit /etc/cron.d/cacti and make sure any line that has cacti in it does not have a
pound sign (#) in front of it.
Finally, try logging in to your cacti user's account with the following commands:
su cacti
logout
This should bring you in as the cacti user, using the sh shell, and log you out.

Nagios Enterprises, LLC


P.O. Box 8154
Saint Paul, MN 55108
USA

US: 1-888-NAGIOS-1
Int'l: +1 651-204-9102
Fax: +1 651-204-9103

Web: www.nagios.com
Email: sales@nagios.com

Page 3
Copyright 2011 Nagios Enterprises, LLC
Revision 1.0 August, 2013

Nagios XI Installing Cacti Alongside XI


Accessing Cacti
You should now be able to access the web interface of Cacti using the following URL:
http://<XI_SERVER_IP_ADDRESS>/cacti/
The trailing slash is important.
Cacti will take you through its installer. Change any installation options if they look incorrect. Once you've completed the installation
steps, the default login credentials for Cacti are set to admin/admin.

Finishing Up
That's it Cacti should now be installed and working!

Nagios Enterprises, LLC


P.O. Box 8154
Saint Paul, MN 55108
USA

US: 1-888-NAGIOS-1
Int'l: +1 651-204-9102
Fax: +1 651-204-9103

Web: www.nagios.com
Email: sales@nagios.com

Page 4
Copyright 2011 Nagios Enterprises, LLC
Revision 1.0 August, 2013

Você também pode gostar