Cacti tool is
an open source web based network monitoring and system monitoring graphing
solution for IT business.
Cacti enables a user to poll services at regular intervals to create graphs on
resulting data using RRDtool.
Generally, it is used to graph time-series data of metrics such as network bandwidth utilization, CPU load, running processes, disk space etc.
In this how-to we are going to show you how to install and
setup complete network monitoring application called Cacti using Net-SNMP tool on RHEL 7.x/6.x/5.x,
CentOS 7.x/6.x/5.x
and Fedora systems
using YUM package manager tool.
The Cacti required several packages to be installed on your
Linux operating systems like RHEL / CentOS / Fedora.
#
yum install httpd httpd-devel
# yum install mysql mysql-server
MariaDB is a community-developed fork of the MySQL database project, and provides a replacement for MySQL. Previously the official supported database was MySQl under RHEL/CentOS 6.x/5.x and Fedora.
Recently, RedHat makes a new transaction from MySQl to MariaDB, as MariaDB is the default implementation of MySQL in RHEL/CentOS 7.x and Fedora 19 onwards.
# yum install mariadb-server –y
# yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli
# yum install php-snmp
# yum install net-snmp-utils net-snmp-libs
# yum install rrdtool
Once you’ve installed all the required software’s for Cacti installation, lets start them one-by-one using following commands.
# service httpd start
# service mysqld start
# service snmpd start
Configuring Apache, MySQL and SNMP Services to start on boot.
# /sbin/chkconfig --levels 345 httpd on
# /sbin/chkconfig --levels 345 mysqld on
# /sbin/chkconfig --levels 345 snmpd on
Here, you need to install and enable EPEL Repository. Once you’ve enabled repository, type the following command to install Cacti application.
# yum install cacti
Extract the
distribution tarball.
# tar
xzvf cacti-version.tar.gz
We need to configure MySQL for Cacti, to do this we need to
set password for our newly installed MySQL server
and then we will create Cacti
database with user Cacti.
# mysqladmin -u root password your-password-here
# mysql -u root –p
mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';
mysql> FLUSH privileges;
mysql> quit;
# rpm -ql cacti | grep cacti.sql
Now we’ve of the location of Cacti.sql file, type the following command to install tables, here you need to type the Cacti user password.
# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
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.
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;
Now configuring firewall for Cacti
# iptables -A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
# iptables -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
# service iptables save
#service httpd restart
Set the
appropriate permissions on cacti's directories for graph/log generation. You
should execute these commands from inside cacti's directory to change the
permissions.
shell>
chown -R cactiuser rra/ log/
(Enter a valid
username for cactiuser, this user will also be used in the next step for
data gathering.)
Add a line to
your /etc/crontab file similar to:
*/5
* * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1
Replace cactiuser
with the valid user specified in the previous step.
Replace /var/www/html/cacti/
with your full Cacti path.
Finally, Cacti is ready, just go to
http://your-IP-Here/cacti/
Log in the with a
username/password of admin. You will be required to change this password
immediately. Make sure to fill in all of the path variables carefully and
correctly on the following screen.
No comments:
Post a Comment