14
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. Editing Files In steps of this documentation you will be required to edit files to define configuration settings. This documentation will use the vi text editor. When using the vi editor: To make changes press i on the keyboard first to enter insert mode Press Esc to exit insert mode When you have finished, save the changes in vi by typing :wq and press Enter Installing Prerequisites Before you can install Cacti on your Nagios XI server, you'll need to install a prerequisite component. Establish a terminal session to your Nagios XI server as root and execute the following command: yum install -y php-pear-Net-SMTP dos2unix libtool help2man Installing Cacti Cacti is installed with the following command: yum install -y cacti 1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102 © 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. www.nagios.com Page 1 / 14 Updated – January, 2018 Nagios XI The Industry Standard In Infrastructure Monitoring Installing Cacti Alongside XI

Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Embed Size (px)

Citation preview

Page 1: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

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.

Editing Files

In steps of this documentation you will be required to edit files to define configuration settings. This

documentation will use the vi text editor. When using the vi editor:

• To make changes press i on the keyboard first to enter insert mode

• Press Esc to exit insert mode

• When you have finished, save the changes in vi by typing :wq and press Enter

Installing Prerequisites

Before you can install Cacti on your Nagios XI server, you'll need to install a prerequisite component.

Establish a terminal session to your Nagios XI server as root and execute the following command:

yum install -y php-pear-Net-SMTP dos2unix libtool help2man

Installing Cacti

Cacti is installed with the following command:

yum install -y cacti

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 1 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 2: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Configuring MySQL

MySQL is already configured in your Nagios XI server 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.

The first command required is to load the timezone information into the database. This is performed with the

following command:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p'nagiosxi' mysql

You can ignore any warnings.

Execute the following command to enter the mysql command interface:

mysql -u root -p'nagiosxi'

You are now logged into the mysql command interface, this is indicated by the mysql> OR MariaDB

[(none0]> prompt.

Now you will create a database called cacti, a user called cacti@localhost with the password of

cactipassword. Execute following commands :

create database cacti;

GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipassword';

GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;

FLUSH privileges;

exit

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 2 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 3: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

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-1.1.19/cacti.sql (the cacti-1.1.19 directory may be newer on your

system, for example cacti-1.1.20). You can locate the file on your system by running the following

command:

find /usr/share/doc/ -name cacti.sql

Once you've found your cacti.sql you simply need to dump it into mysql using the following command:

mysql -u root -p'nagiosxi' cacti < /usr/share/doc/cacti-1.1.19/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.

Installing Spine

Spine is a poller that Cacti requires. It is not available in the yum repository hence you will need to compile it

from source.

Download Spine with the following command:

cd /tmp

wget https://www.cacti.net/downloads/spine/cacti-spine-1.1.30.tar.gz

tar xzf cacti-spine-1.1.30.tar.gz

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 3 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 4: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Install Spine with the following commands:

cd /tmp/cacti-spine-1.1.30

./bootstrap

./configure

make

make install

Create the config file with the following commands:

cd /usr/local/spine/etc/

cp spine.conf.dist spine.conf

The config file will be configured further on.

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. Open the file with vi using the following command:

vi /etc/snmp/snmpd.conf

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

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 4 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 5: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Further down in the file you need to edit the groups. You'll want to delete (or comment out) the existing group

lines and replace them with these lines:

group MyRWGroup v1 local

group MyRWGroup v2c local

group MyRWGroup usm local

Next, replace the view lines (or comment out) with this line:

view all included .1

Note that no mask is set, this is intentional.

Edit the line that begins with access and change it to match the following:

access MyRWGroup "" any noauth exact all all none

Scroll down and under # System contact information and make sure the lines look like this:

syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

Under the # Pass through control section add the following line:

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.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 5 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 6: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Check to see if the config works by restart/starting snmpd and then checking the status with the following

commands :

RHEL/CentOS 6.x

service snmpd restart

service snmpd status

RHEL/CentOS 7.x

systemctl restart snmpd.service

systemctl status snmpd.service

If the starting portion of snmpd fails, go through the above steps again to ensure the configuration is valid.

You also need to make sure snmpd is started upon bootup:

RHEL/CentOS 6.x

chkconfig snmpd on

RHEL/CentOS 7.x

systemctl enable snmpd.service

Now its time to test SNMP, execute the following command:

snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

The command should return output similar to the following:

IP-MIB::ipAdEntIfIndex.10.25.5.17 = INTEGER: 2

IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 6 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 7: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

If your output from snmpwalk is similar then your SNMP configuration is valid.

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. The

following command will open the file in vi:

vi /usr/share/cacti/include/config.php

If you used different login credentials when setting up the cacti MySQL database, make sure you use them

here as well. The lines in the config file need to look like the following:

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cactipassword";

$database_port = "3306";

Save the file.

Create the config file with the following commands:

Edit the Spine configuration file /usr/local/spine/etc/spine.conf to change the databse settings.

The following command will open the file in vi:

vi /usr/local/spine/etc/spine.conf

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 7 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 8: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

The lines in the config file need to look like the following:

DB_Host localhost

DB_Database cacti

DB_User cacti

DB_Pass cactipassword

DB_Port 3306

Save the file.

Setting Access Permissions

You need to allow access to the Cacti web interface. Before you can make the changes you need to know

which version of Apache is running on your XI server. Execute the following command:

httpd -v

The output will be something like:

Server version: Apache/2.4.6 (Red Hat Enterprise Linux)

This server is running 2.4.6, you'll need to know this for the following steps.

Open the Cacti configuration file /etc/httpd/conf.d/cacti.conf in vi with the following command:

vi /etc/httpd/conf.d/cacti.conf

Make the following changes as per your version of Apache.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 8 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 9: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Apache v 2.2

The line to edit is the Allow from line. There are different levels of access you can grant.

To allow access from any IP address use the following:

Allow from all

The following entry would allow the specific IP 192.168.5.45 to be able to access the Cacti web interface:

Allow from 192.168.5.45

The following entry will allow machines from the 192.168.5.0/24 network to access the Cacti interface:

Allow from 192.168.5.0/24

Save the file and proceed to the Restart Apache section.

Apache v 2.4

The line to edit is the Require host line. There are different levels of access you can grant.

To allow access from any IP address use the following:

Require all granted

The following entry would allow the specific IP 192.168.5.45 to be able to access the Cacti web interface:

Require ip 192.168.5.45

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 9 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 10: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

The following entry will allow machines from the 192.168.5.0/24 network to access the Cacti interface:

Require ip 192.168.5.0/24

Save the file and proceed to the Restart Apache section.

Restart Apache

Restart the Apache web server with the following command:

service httpd restart

Configure Cron

Edit the file /etc/cron.d/cacti in vi with the following command:

vi /etc/cron.d/cacti

Remove the pound sign # at the beginning of the line with */5 * * * *. Save the file.

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.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 10 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 11: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Cacti will prompt you with an installer.

Accept the license agreement.

Click Next to continue.

The Pre-installation Checks page is shown.

When you are happy to proceed click Next.

This is a New Primary Server, click Next to

continue.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 11 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 12: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

Change any binary files if they look incorrect.

Click Next to continue.

The Directory Permissions Checks page is

shown, click Next to continue.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 12 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 13: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

The Template Setup page is shown. Select

the Local Linux Machine template.

Click Finish to continue.

Once you've completed the installation steps you'll be directed to the

login page.

The default login credentials for Cacti are set to admin/admin.

You are forced to change the admin password the first time you login.

Click Save to continue.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 13 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI

Page 14: Installing Cacti Alongside XI - Nagios · Purpose This document describes how to install Cacti alongside Nagios XI in order to use both. This document assumes you already have a working

The Cacti home page will now be shown.

If you've made it this far then you have successfully installed Cacti alongside Nagios XI.

Finishing Up

This completes the documentation on how to install Cacti alongside Nagios XI.

If you have additional questions or other support related questions, please visit us at our Nagios Support

Forums:

https://support.nagios.com/forum

The Nagios Support Knowledgebase is also a great support resource:

https://support.nagios.com/kb

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner.

www.nagios.comPage 14 / 14

Updated – January, 2018

Nagios XI

The Industry Standard In Infrastructure Monitoring

Installing Cacti Alongside XI