Cacti : A perfect tool to Monitor Network Bandwidth

Cacti : A perfect tool to Monitor Network Bandwidth

0
0
SHARE
Linux Reseller Hosting

A. How to install Cacti Network Monitoring App?

Introduction

To monitor server and services we can use Nagios which provide enterprise class monitoring. Its one of the standard tool, but to monitor Bandwidth utilization over the network, Cacti is a complete network graphing solution that useful for network administrator to monitor their network bandwidth. It is very easy to use and have the following features:

1. Graphs

2. Data Sources

3. Data Collection

4. Graph Display

5. user Management

Server side requirements to install Cacti

The Cacti required following packages to be installed on your Linux operating system.

1. HTTP/apache : A Web server to display network graphs created by PHP and RRDTool.

2. MySQL/MariaDB : A database server.

3. PHP : To run or support script module to create graphs using RRDTool.

4. PHP-SNMP : A PHP extension for SNMP to access data.

5. NET-SNMP : A SNMP (Simple Network Management Protocol) is used to manage network.

6. RRDTool : A database tool to manage and retrieve time series data like CPU load, Network Bandwidth etc.

Installation:

1. First install apache/httpd if its not installed on the server using yum.

yum install httpd httpd-devel

2. Next, install mysql / MariaDB

yum install mysql mysql-server

3. Now Install PHP

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

4. Install PHP-SNMP with NET-SNMP

yum install php-snmp net-snmp-utils p net-snmp-libs php-pear-Net-SMTP

5. Now install RRDTool

yum install rrdtool

Once you done with all above software requirements for Cacti installation, lets proceed with 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

B. Now how to add new server in a cacti configuration.

1. Login to cacti as a admin user

2. Go to Console -> Devices and choose Add from top right corner

3. Enter name in description and address / FQDN in Hostname

4. Choose host template as ‘Generic SNMP Enabled host or Linux Generic’

5. Click create

On the same page after clicking creates under ‘Associated Graph Templates’ section add 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 Save button

Next,

6. Click on ‘Create Graphs for this host’ link at top-right from page resulting after ‘save’.

Choose all graph templates by clicking at top-most check-box on right side

Choose interesting interfaces by clicking on corresponding check-boxes from below table In ‘Select a graph type:’ drop down at bottom right choose ‘In/Out Bytes with Total Bandwitdh’ Click Create

Again click Create on next page, Go to Console Graph Trees

Click on Add at top right corner, Type name for tree, preferably same as name written in description while adding device.

Click create

Now click on Console -> ‘Graph management’. Select Host in host drop-down menu so that only graphs related to chosen host appear.

Select all graphs for this new host using check-box at top right corner

From Choose an action drop-down menu choose ‘Place on a tree (<description>)’ to place all graphs for this host on tree created for this host.

Then click go and then continue on next page. Now go to ‘Graphs’ and in Tree-mode click on name of new host added to see its graphs.

C. Client side SNMP configuration.

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

D. How to create user with limited access to cacti

1. Login to cacti as a admin

2. Click on Console -> User Management

3. Click Add from top right corner of the page

4. Type User Name and Password

5. Next, click on View Graphs under Realm Permissions

6. Click on Graph Permissions

7. Select the host name/device for which you want to give permission to the user to view the graphs and click on Add button

8. Next Tree Permissions. : Select the tree under which the host/device belongs. Next click on add button

9. Last click on SAVE button at the end.

10. Logout as an admin and try with newly created users with limited access.

That’s all.

Windows Shared Hosting

Our Partner

partner-cloudflare
partner-cloudlinux
partner-cpanel-whm
partner-Paralleles-plesk-panel
partner-sitelock
partners-OpenVZ
R1Soft
partners-RV-Globalsoft
partners-Softaculous-auto-installer
partners-solusvm
partners-whmcs
services-cpanel
services-MySQL
services-Perl
services-swsoft-plesk
support-sevices-php