CACTI - Network Monitoring Tool


Cacti - CENTOS / FEDORA / RHEL

Here are the ff. required packages need for your Linux operating systems like RHEL / CentOS / Fedora.

Apache : A Web server to display network graphs created by PHP and RRDTool.
MySQL : A Database server to store cacti information.
PHP : A script module to create graphs using RRDTool.
PHP-SNMP : A PHP extension for SNMP to access data.
NET-SNMP : A SNMP (Simple Network Management Protocol) is used to manage network.
RRDTool : A database tool to manage and retrieve time series data like CPU load, Network Bandwidth etc.


Install required packages:

INSTALL APACHE
# yum install httpd httpd-devel

INSTALL MySQL
# yum install mysql mysql-server
# yum install mariadb-server -y

INSTALL PHP
# yum install php-mysql php-pear php-gd php-mbstring php-cli php-common php php-devel

Install PHP-SNMP
# yum install php-snmp

Install NET-SNMP
# yum install net-snmp-utils net-snmp-libs

Install RRDToolmysql
# yum install rrdtool

Starting Apache, MySQL and SNMP Services On RHEL/CentOS 7.x
# systemctl start httpd.service
# systemctl start mariadb.service
# systemctl start snmpd.service

Configure Start-up Links
Configuring Apache, MySQL and SNMP Services to start on boot on RHEL/CentOS 7.x
# systemctl enable httpd.service
# systemctl enable mariadb.service
# systemctl enable snmpd.service

Enable EPEL Repository in RHEL/CentOS 7
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -ivh epel-release-7-5.noarch.rpm

Verify EPEL Repository
# yum repolist

Install Cacti on CentOS 7
# yum install cacti

Configuring MySQL Server for Cacti Installation

Set MySQL Password
To set new password for MySQL server, use the following command.
(Note : This is for new MySQL installation only).

# mysqladmin -u root password pass123

Create MySQL Cacti Database
Login into MySQL server with newly created password and create Cacti database with user Cacti and set the password for it on RHEL/CentOS 7.x

# mysql -u root -p

Install Cacti Tables to MySQL
# rpm -ql cacti | grep cacti.sql
# mysql -u mgs -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
# mysql -u mgs -p cacti < /usr/share/doc/cacti-*/cacti.sql

Configure MySQL settings for Cacti

Open the file called /etc/cacti/db.php with any editor.
# vi /etc/cacti/db.php
Make the following changes and save the file. Make sure you set password correctly.
database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "username";
$database_password = "password";
$database_port = "3306";
$database_ssl = false;

Disable SELinux on CentOS 7
1 ### sestatus
2 SELinux status: enabled
3 SELinuxfs mount: /sys/fs/selinux
4 SELinux root directory: /etc/selinux
5 Loaded policy name: targeted
6 Current mode: enforcing
7 Mode from config file: enforcing
8 Policy MLS status: enabled
9 Policy deny_unknown status: allowed
10 Max kernel policy version: 28

Open selinux configuration file.
1 ### vi /etc/sysconfig/selinux
Change “SELINUX=enforcing” to “SELINUX=disabled” and save the configuration file:
1 # This file controls the state of SELinux on the system.
2 # SELINUX= can take one of these three values:
3 # enforcing - SELinux security policy is enforced.
4 # permissive - SELinux prints warnings instead of enforcing.
5 # disabled - No SELinux policy is loaded.
6 SELINUX=disabled
7 # SELINUXTYPE= can take one of these two values:
8 # targeted - Targeted processes are protected,
9 # minimum - Modification of targeted policy. Only selected processes are protected.
10 # mls - Multi Level Security protection.
11 SELINUXTYPE=targeted

Step 3. Rebooting your linux system to take effect.
1 reboot
After reboot, you can verify the status of SELinux. Issue “sestatus” command to verify that SELinux permanently disabled:
1 ### sestatus
2 SELinux status: disabled

Optional: Disable Firewall CentOS 7
#Systemctl status firewalld.service
#Systemctl stop firewalld.service
# Systemctl disable firewalld.service
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload

Configuring Apache Server for Cacti Installation
Open file called /etc/httpd/conf.d/cacti.conf with your choice of editor.
# vi /etc/httpd/conf.d/cacti.conf
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
Deny from all
Allow from all
</IfModule>
</Directory>

Finally, restart the Apache service.
# systemctl restart httpd.service [On RHEL/CentOS 7.x and Fedora 19 onwards]

Setting Cron for Cacti

Open file /etc/cron.d/cacti.
# vi /etc/cron.d/cacti
Uncomment the following line. The poller.php script runs every 5mins and collects data of known host which is used by Cacti application to display graphs.

*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Finally we can log in to cacti with a web browser:

http://your_ip_address/cacti

Use "admin" as the default login and password.

Cacti successfully installed!


Reference Link:


- https://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-6-3-5-8-and-fedora-17-12/
- https://forums.cacti.net/viewtopic.php?f=2&t=55174

- https://forums.cacti.net/viewtopic.php?f=6&t=55258

- https://forums.cacti.net/viewtopic.php?f=6&t=49827

- https://docs.cacti.net/faq#time_zone_warning

- https://www.tolaris.com/2013/07/09/cacti-and-1-minute-polling/comment-page-1/

- https://docs.cacti.net/manual:087:4_help.1_faq#graphs

- http://openmaniak.com/cacti_other.php

- https://www.liquidweb.com/kb/how-to-add-a-user-and-grant-root-privileges-on-centos-7/

- https://support.rackspace.com/how-to/installing-mariadb-server-on-centos/

- http://www.solutionsatexperts.com/how-to-monitor-windows-client-in-cacti/

- http://www.uptimemadeeasy.com/monitoring/monitor-cisco-routers-cacti-graph-bandwidth-usage/

- https://www.manageengine.com/products/oputils/enable-snmp-cisco-router.html

- https://aaronwalrath.wordpress.com/2010/05/23/monitor-cisco-routers-with-cacti-and-snmp/

- https://www.unixmen.com/configure-cacti-monitor-network-devices/

Thanks,
- JN

Comments

Popular Posts