I. Introduction of CACTI monitoring software
1. Cacti is a PHP language implementation of a software, its main function is to use the SNMP service to obtain data, and then use RRDtool to store and update data, when the user needs to view the data with the RRDtool to generate a chart presented to the user. Therefore,SNMP and RRDtool are the key to cacti. SNMP is related to the collection of data,RRDtool is related to data storage and chart generation.
2. mysql with PHP program to store some variable data and call the variable data, such as: Host name, host IP,SNMP community name, port number, template information and other variables
3. The SNMP catch data is not stored in MySQL, but exists in the RRDtool generated rrd file ( under the Rra folder in the cacti root directory ). rrdtool Data Update and storage is the rrd file processing, therrd file is a fixed size of the file (roundrobinarchive), it can store the number of data is defined at the time of creation.
Second, build cacti monitoring environment
1, setting up the environment introduction:
|
Hostname |
Ip |
Service side |
Webserver |
192.168.1.20 |
Client |
Hpf-linux |
192.168.1.110 |
2, cacti service side operation:
[[email protected] ~]# yum install epel-release//installation Epel extension source, ready to install cacti below
[[email protected] ~]# yum install-y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg -devel libpng libpng-devel//Build lamp environment
[email protected] ~]# yum install-y cacti net-snmp net-snmp-utils rrdtool//install cacti, NET-SNMP, RRDtool
Start the service:
[[email protected] ~]#/etc/init.d/mysqld start
[[email protected] ~]#/etc/init.d/httpd start
[[email protected] ~]#/etc/init.d/snmpd start
To change the httpd configuration file:
[[email protected] ~]# vi/etc/httpd/conf.d/cacti.conf//Change the configuration file "Deny from all" to "Allow from all"
[email protected] ~]#/etc/init.d/httpd restart
Import data to create a cacti library:
[email protected] ~]# mysql-uroot-e "CREATE Database Cacti"
[[email protected] ~]# mysql-uroot-e "Grant all on cacti.* to ' cacti ' @ ' 127.0.0.1 ' identified by ' cacti ';"
[email protected] ~]# mysql-uroot cacti </usr/share/doc/cacti-0.8.8b/cacti.sql
To edit the cacti configuration file:
[email protected] ~]# vi/usr/share/cacti/include/config.php
$database _type = "MySQL";
$database _default = "cacti";
$database _hostname = "127.0.0.1";
$database _username = "cacti";
$database _password = "cacti";
$database _port = "3306";
$database _ssl = false;
3. Web Access cacti and installation
The above three steps according to the system default steps click;
The first time entered the cacti admin password when the account and password are admin, input system by default requires the user to force change password;
4, execute poller.php, generate graphics, join the scheduled task
[[email protected] ~]# /usr/bin/php /usr/share/cacti/poller.php
ok u:0.01 s:0.02 r:0.67
OK u:0.01 s:0.02 r:0.67
ok u:0.01 s:0.02 r:0.71
ok u:0.01 s:0.02 r:0.71
ok u:0.01 s:0.02 r:0.78
ok u:0.01 s:0.02 r:0.78
OK u : 0.01 s:0.02 r:0.84
ok u:0.01 s:0.02 r:0.84
Ok u:0.01 s:0.02 r : 1.00
ok u:0.01 s:0.02 r:1.00
06/17/2015 02:53:39 am - system stats: time:1.2623 method:cmd.php processes:1 threads:n/a hosts:2 Hostsperprocess:2 datasources:5 rrdsprocessed:5
[[email protected] ~]# crontab -e
*/5
* * * *
/usr/bin/php
/usr/share/cacti/poller
.php
5. The following are the clients:
[email protected] mysql]# yum install-y net-snmp lm_sensors
[[email protected] ~]# vi/etc/snmp/snmpd.conf//Modify syslocation and Syscontact, where syslocation can write the IP of the monitoring client, Syscontact Write admin Mailbox
Syslocation 192.168.1.110
Syscontact Root [email protected]
At the same time in the configuration file by the following changes, if not modified will result in the addition of network card detection will not find the network card option;
View SystemView included. 1.3.6.1.2.1.1
Modified to:
View SystemView included. 1.3.6.1.2.1
[[email protected] ~]#/etc/init.d/snmpd start
Starting snmpd: [OK]
6, the browser configuration cacti detection
Enter the browser login cacti management background, point console, then click New Graphs, in the upper right corner "Create New Host";
Description write the name or custom of the monitoring client
Hostname write monitored client IP
Host Template Select Ucd/net SNMP Host
Version 2 of SNMP version selected
Click Create in the lower right corner
After the introduction of SNMP appears, click "Create Graphs for this Host" in the upper right corner;
In the box below select the hardware information to monitor or network card, such as Select Eth0,eth1, in the right side of the small box to tick, and then point to the bottom right corner of create;
Graph Types: Then select graph Template Based, in the box below, select the items you want to monitor, such as Unix-load Average, in the right side of the small box to tick, and then point to the bottom right corner of create;
Point to the left of graph Trees, select "Default Tree", point to the upper right corner of add;
Tree Item Type Select "Host", host select the machine IP we just added, point to the bottom right corner of create;
The graphs button in the upper left corner, can be seen on the left, the Defaut tree below has added the host we just added, the graphics will not come out so quickly, to wait a small meeting can be.
Build cacti monitoring under Linux