Use Cacti in Linux to monitor traffic

Source: Internet
Author: User

Use Cacti in Linux to monitor traffic

Cacti is a set of network traffic monitoring graphical analysis tools developed based on PHP, MySQL, SNMP, and RRDTool. It is developed using PHP, it is a software composed of some PHP pages, mainly for the monitoring service of a large number of network devices and server hosts of enterprises, it can monitor various data information such as CPU load, memory usage, number of Running Processes, disk space, and network card Traffic. cacti focuses on status monitoring and provides poor alarm and service recovery functions.


Official site:

Http://www.cacti.net

Download Page:

Http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz



Start Cacti installation and deployment

Machine IP Address: 192.168.1219.129


Software Download:

[Root @ rhel64 ~] # Wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz

[Root @ rhel64 ~] # Wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz

[Root @ rhel64 ~] # Wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz


Install the lamp environment:

[Root @ rhel64 ~] # Yum install-y httpd mysql-server php-mysql php-json php-pdo


Install the relevant lib Library:

[Root @ rhel64 ~] # Yum install-y cairo-devel libxml2-devel pango-devel


Install the compiler:

[Root @ rhel64 ~] # Yum-y install gcc make gcc-c ++


Decompress the compilation software:

[Root @ rhel64 ~] # Tar-xzf rrdtool-1.4.5.tar.gz

[Root @ rhel64 ~] # Cd rrdtool-1.4.5

[Root @ rhel64 rrdtool-1.4.5] #./configure -- prefix =/usr/local/rrdtool/

[Root @ rhel64 rrdtool-1.4.5] # make & make install

[Root @ rhel64 rrdtool-1.4.5] # ln-s/usr/local/rrdtool/bin/*/usr/local/bin/


Install the snmp service:

[Root @ rhel64 rrdtool-1.4.5] # yum-y install net-snmp-utils


Install the Cacti main program:

[Root @ rhel64 ~] # Tar xzf cacti-0.8.8a.tar.gz & mv cacti-0.8.8a/var/www/html/cacti


Create a Cacti database:

[Root @ rhel64 ~] # Service mysqld start

[Root @ rhel64 ~] #/Usr/bin/mysqladmin-u root-h rhel64 password '000000'

[Root @ rhel64 ~] #/Usr/bin/mysqladmin-u root password '123'

[Root @ rhel64 ~] # Mysql-uroot-p

Mysql> create database cacti;

Query OK, 1 row affected (0.00 sec)

Mysql> grant all on cacti. * to cacti @ 'localhost' identified by "123456 ";

Query OK, 0 rows affected (0.00 sec)

Mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

Mysql>



Import Cacti data to the Cacti database:

[Root @ rhel64 ~] # Mysql-ucacti-p123456 cacti </var/www/html/cacti. SQL

[Root @ rhel64 ~] # Chmod-R 777/var/www/html/cacti/rra

[Root @ rhel64 ~] # Chmod-R 777/var/www/html/cacti/log

[Root @ rhel64 ~] # Vi/var/www/html/cacti/include/config. php

<? Php

/*

+ ------------------------------------------------------------------------- +

| Copyright (C) 2004-2012 The Cacti Group |

|

| This program is free software; you can redistribute it and/or |

| Modify it under the terms of the GNU General Public License |

| As published by the Free Software Foundation; either version 2 |

| Of the License, or (at your option) any later version. |

|

| This program is distributed in the hope that it will be useful, |

| But without any warranty; without even the implied warranty of |

| MERCHANTABILITY or fitness for a special PURPOSE. See the |

| GNU General Public License for more details. |

+ ------------------------------------------------------------------------- +

| Cacti: The Complete RRDTool-based Graphing Solution |

+ ------------------------------------------------------------------------- +

| This code is designed, written, and maintained by the Cacti Group. See |

| About. php and/or the AUTHORS file for specific developer information. |

+ ------------------------------------------------------------------------- +

| Http://www.cacti.net/|

+ ------------------------------------------------------------------------- +

*/


/* Make sure these values refect your actual database/host/user/password */

$ Database_type = "mysql ";

$ Database_default = "cacti ";

$ Database_hostname = "localhost ";

$ Database_username = "cacti ";

$ Database_password = "123456 ";

$ Database_port = "3306 ";

$ Database_ssl = false;


/*

Edit this to point to the default URL of your Cacti install

Ex: if your cacti install as at http: // serverip/cacti/this

Wocould be set to/cacti/

*/

// $ Url_path = "/cacti /";


/* Default session name-Session name must contain alpha characters */

// $ Cacti_session_name = "Cacti ";


?>


[Root @ rhel64 ~] # Setenforce 0

[Root @ rhel64 ~] # Crontab-e

*/5 */usr/bin/php/var/www/html/cacti/poller. php>/tmp/cacti_rrdtool.log 2> & 1


Http: // 192.168.1219.129/cacti/


Click next. The default username and password are admin. admin. You need to change the password for the first login.











Define which devices to monitor:

Control Panel --> Create a device --> define a device --> Generate an image for a device --> Add a new device to the image tree

Console --> Devices --> add (upper left corner) --> define devices --> Create Graphs for this Host --> create

To install net-snmp on the monitored client, enter the IP address of the monitored client in line 41.

[Root @ rhel64 ~] # Yum-y install net-snmp

[Root @ rhel64 ~] # Vim/etc/snmp/snmpd. conf

62 access notConfigGroup "" any noauth exact all none

41 com2sec notConfigUser 192.168.1219.129 public

85 view all supported ded. 1 80


[Root @ rhel64 ~] # Service snmpd start


To be continued...

Welcome to my personal website

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.