Cacti Network Monitoring Tool installation and configuration on CentOs 7/RHEL 7

0
905

Cacti

Cacti is a well known open source and Web-based Network Monitoring tool. It can be used to monitor network traffic by using SNMP (Simple Network Management Protocol) and also use the RRD tool. It generates graphs for the CPU Load, Memory Usage, Logged in users and processes.
In this article, we will be known about the installation of cacti Network Monitoring tool on Cent-OS 7 and RHEL 7.
Before we going to proceed with the installation cacti from source make some dependencies are installed.
Prerequisites:

  • Webserver(httpd service)
  • Mariadb(10 or above)
  • Php and php modules
  • SNMP
  • RRDtool

Read also: Graphite installation on Linux

To install Mariadb Latest version, first install Mariadb repositoriy. Create new file /etc/yum.repos.d/mariadb.repo and add the following code to that file.

# MariaDB 10.0 CentOS repository list - created 2017-03-05 07:41 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Now install httpd, MariaDB, PHP, PHP-Modules, SNMP and RRDtool as follows

#yum -y install httpd mariadb-server mariadb-client php php-mysql php-xml php-gd php-mcrypt php-snmp php-posix php-mbstring net-snmp rrdtool

Now enable and start the httpd and Maraidb services

#systemctl enable httpd mysql
#systemctl start httpd mysql

Now install the mariadb secure instalaltion by using following comamnd

# mysql_secure_installation

Now download the latest version of cacti from their officialsite

#wget http://www.cacti.net/downloads/cacti-1.0.4.tar.gz


Now extract and copy it to the /var/www/html/ directory

#tar -xzf cacti-1.0.4.tar.gz
#mv cacti-1.0.4 cacti
#cp -rf cacti /var/www/html/

Now create a database for cacti and import the cacti database as follows

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.0.29-MariaDB-wsrep MariaDB Server, wsrep_25.16.rc3fc46e

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database cactidb;
Query OK, 1 row affected (0.03 sec)

MariaDB [(none)]> grant all on cactidb.* to 'cactiuser'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@localhost ~]# mysql -u cactiuser -p cactidb</var/www/html/cacti/cacti.sql
Enter password:
[root@localhost ~]#mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root -p mysql

Now edit the file config.php file and add the database settings

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

Now create a user and set permissions for cacti directory.

#useradd cactiuser
#chown -R apache:apache  /var/www/html/cacti/
#chown -R cactiuser /var/www/html/cacti/rra/ 

Now set the crontab by editing the et/crontab file and add the following lines

 */5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

Now restart the httpd service and access the cacti Web interface by using URL Address: http://ip-address/cacti

Accept the license agreement and click on Next.

check all the dependencies installed and click on next.

Select the installation type i.e New installation or upgrade and check database details correct or not and then click on Next Button.

check the Binary locations and versions and click on Next

Now check the directory permissions and click on Next

Select the required templates and click on finish to complete the installation.

now login with the default username and password is admin. On first login it asks for password change, so create a new password.

The dashboard of cacti is as follows

Now check the graphs of local machine from graphs menu

we can add devices from devices tab. explore all the option to learn more about the cacti Network Monitoring tool, if you want to join this discussion, feel free to leave a comment!