Introduction
To monitor servers and services we can use Nagios which provide enterprise-class monitoring. It’s one of the standard tools, but to monitor bandwidth utilization over the network, Cacti is a complete network graphing solution that useful for the network administrators to monitor their network bandwidth. It is very easy to use and have the following features:
Server-side requirements to install Cacti
The Cacti required the following packages to be installed on your Linux operating system.
Installation:
yum install httpd httpd-devel
yum install mysql mysql-server
yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql
yum install php-snmp net-snmp-utils p net-snmp-libs php-pear-Net-SMTP
yum install rrdtool
Once you are done with all the above software requirements for Cacti installation, let’s proceed with the following commands one by one.
Before that correct snmpd.conf as follows
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_old
vi /etc/snmp/snmpd.conf and add following in it
com2sec local localhost public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup “” any noauth exact all none none
access MyRWGroup “” any noauth exact all all none
syslocation Linux (RH3_UP2), Home Linux Router.
syscontact Admin (admin@jasmax.in)
Then restart following services.
/etc/init.d/httpd start
/etc/init.d/mysqld start
/etc/init.d/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
Further, To install cacti needs to enable EPEL Repository using following way.
How to enable it on CentOS 6 32-64 Bit
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
How to enable it on CentOS 5 32-64 Bit
## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
## RHEL/CentOS 5 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
Once you’ve enabled repository, type the following command to install Cacti application.
# yum install cacti
Next: Set MySQL Password
# mysqladmin -u root password YOUR-PASSWORD-HERE
Now, Create MySQL Cacti Database
# mysql -u root -p
mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘your-password-here’;
mysql> FLUSH privileges;
mysql> quit;
Install Cacti Tables to MySQL
mysql -u cacti -p cacti < /var/www/cacti/cacti.sql
Configure MySQL settings for Cacti
vi /var/www/cacti/include/config.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 = “cacti”;
$database_password = “your-password-here”;
$database_port = “3306”;
$database_ssl = false;
Setting up the crontab for poller.php
# crontab -e
*/5 * * * * /usr/bin/php /var/www/cacti/poller.php >> /var/log/cacti 2>&1
Configure cacti.conf as below:
vi /etc/httpd/conf.d/cacti.conf
remove exixting and add following
Alias /cacti /var/www/cacti/
<Directory /var/www/cacti/>
DirectoryIndex index.php
Options -Indexes
AllowOverride all
order deny,allow
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
</Directory>
Restart Apache to take effect on the changes:
# /etc/init.d/httpd restart
Navigate your browser to http://serverIP/cacti and following the instructions
Login to your new Cacti installation from http://serverIP/cacti/ with default user (admin) and the default password (admin).
That’s all with cacti installation
On the same page after clicking creates under the ‘Associated Graph Templates’ section add the following templates:
ucd/net – CPU Usage
ucd/net – Memoery Usage
Unix – Load average
Unix – Logged in users
Unix – ping latency
Unix – procesess
and then click the Save button
Next,
Choose all graph templates by clicking at top-most check-box on the right side
Choose interesting interfaces by clicking on corresponding check-boxes from the below table In ‘Select a graph type:’ drop-down at bottom right choose ‘In/Out Bytes with Total Bandwidth’ Click Create
Again click Create on the next page, Go to Console Graph Trees
Click on Add at the top right corner, Type name for the tree, preferably the same as a name written in description while adding device.
Click create
Now click on Console -> ‘Graph management’. Select Host in the host drop-down menu so that only graphs related to chosen host appear.
Select all graphs for this new host using the check-box at the top right corner
From Choose an action drop-down menu to choose ‘Place on a tree (<description>)’ to place all graphs for this host on the tree created for this host.
Then click go and then continue to the next page. Now go to ‘Graphs’ and in Tree-mode click on the name of the new host added to see its graphs.
Ensure that packages ‘net-snmp’ and ‘net-snmp-utils’ are installed.
yum install net-snmp-utils net-snmp
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_old
vi /etc/snmp/snmpd.conf and add following
com2sec local localhost public
com2sec mynetwork 64.37.52.254 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view all included .1 80
access MyROGroup “” any noauth exact all none none
access MyRWGroup “” any noauth exact all none
syslocation Linux (RH3_UP2), Home Linux Router.
syscontact admin (admins@jasmax.in)
Then restart snmpd service
/etc/init.d/snmpd start
Next, enable 161 port in csf udp_in and udp_out and restart csf
That’s all.
As the demand for virtual private servers (VPS) continues to grow, businesses and individuals are faced with a crucial decision:…
Web hosting is a large industry, as many other factors help any web hosting provider to form a company. The…
Welcome to the complete guide to WordPress security best practices in 2024. As technology evolves rapidly, implementing strong security measures…
Hey, wanted to learn about web hosting? Or do you want to start a new website and need hosting? Questions…
In today's digital world, the threat of DDoS attacks has become increasingly prevalent. These types of attacks have the power…