How to install Cacti on Centos 7

0
37919

Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with thousands of devices.

How to To install Cacti on your CentOS 7.

we will follow below steps.

Step 01: First we need t install following dependency packages using yum package manager tool

# yum install httpd httpd-devel -y

Step 02: Install mariadb

# yum install mariadb-server -y

Step 03: Install php

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

Step 04: Install php-SNMP

# yum install php-snmp -y

Step 05: Install net-snmp

# yum install net-snmp-utils net-snmp-libs -y

Step 06: Install RRDTool

# yum install rrdtool -y

Step07: Let’s install cacti now

# yum install cacti -y

If it does not work then we have to enable EPEL repository

#wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -ivh epel-release-latest-7.noarch.rpm

After this install cacti

Step 08: Configure MySQL

#mysql_secure_installation

Step 09: Create cacti database

#mysql -u root -p
>create database cacti;
>grant all on cacti.* to mahbub@localhost identified by "test123";
>FLUSH Privileges;
>exit

Step 10: Install cacti tables on MySql

# mysql -u mahbub -p cacti < /usr/share/doc/cacti-1.1.37/cacti.sql

Step 11: Open file /etc/cacti/db.php with any editor

Make following changes and save. Make sure you set password correctly.

Also make sure those values reflect your actual database /host/user/password

#vim /etc/cacti/db.php

$database_type="mysql";
$database_default="cacti";
$database_hostname="localhost";
$database_username="mahbub";
$database_password="test123";

Step 12: Now configure Apache for cacti.

Open file called /etc/httpd/conf.d/cacti.conf

#vim /etc/httpd/conf.d/cacti.conf

We will change

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

Step 13: The newly created database user (mahbub) should have access to the mysql.time_zone_name Table. To do that, import the mysql_test_data_timezone.sql to mysql database first.

#mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql

# mysql -u root -p

Grant the permission to cactiuser (mahbub)

>GRANT SELECT ON mysql.time_zone_name TO mahbub@localhost;
>flush privileges;
>exit

 

Step 14: Cacti recommend changing MySQL variables settings for better performances.

Edit configuration file depends on the operating system.

# vim /etc/my.cnf.d/server.cnf

Add variables in [mysqld] section.

collation-server = utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
max_heap_table_size = 128M
max_allowed_packet = 16777216
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_per_table = on
innodb_buffer_pool_size = 512M
innodb_doublewrite = off
innodb_additional_mem_pool_size = 80M
innodb_lock_wait_timeout = 50
innodb_flush_log_at_trx_commit = 2

Step 15:  Set the timezone by editing /etc/php.ini file.

# vim /etc/php.ini

Update the timezone as follows

date.timezone = US/Central

Step 16: Now we will start Apache, MySQL and SNMP services

#systemctl start httpd.service
#systemctl start mariadb.service
#systemctl start snmpd.service

Step 17: enable service for start-up

#systemctl enable httpd.service
#systemctl enable mariadb.service
#systemctl enable snmpd.service

 

Step 18: Configure the firewall to allow HTTP service.

#firewall-cmd --permanent --add-service=http#firewall-cmd --reload

Step 19: It is recommended to permanently disable SELinux for Cacti to work correctly. To temporarily disable the SELinux, run the following command in the terminal.

#setenforce 0

Step 20: Create Cron for cacti

Open file /etc/cron.d/cacti

And uncomment

#vim /etc/cron.d/cacti

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

 

Step 21: Now go to web browser and type localhost/cacti and hit enter

cacti installation page will appear.Accept License agreement and begin installation.

Complete installation as per instructions.

From web browser visit localhost/cacti/index.php

In your cacti login page provide default user name “admin” and default password “admin”. You have to change password for the first time.

After login to cacti you will get cacti dashboard, where you can add devices and create graphs.

At the left side of dashboard you will all options to implement.

To add a device:

Click on Management then device and at the right corner click on (+) add to add a device.

After provide required information at the right bottom corner click on create.

To create graph: First go to console then click “Create graphs for your new devices”.

Select your previous added device then select graph types and then click on save.

Those are very simple ways to you add your network devices for monitoring. You will also get more advance features on cacti to get better monitoring of your network.

Enjoy Cacti Network Monitoring.

LEAVE A REPLY

Please enter your comment!
Please enter your name here