Environment: centos 5.4 cacti server address: 192.168.1.100
1. Automatic Installation of rrdtool through yum source (for plotting)
# Vi/etc/yum. repos. d/dag. repo
[Dag]
Name = Dag RPM Repository for Red Hat Enterprise Linux
Baseurl = http://apt.sw.be/redhat/el?releasever/en/?basearch/dag
Gpgcheck = 1
Gpgkey = http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Enabled = 1
Then install yum:
# Yum install rrdtool
2. Install the lamp environment (refer to the lamp installation I wrote)
Note:
A. You need to add the parameter -- enable-sockets to compile php. Otherwise, an Error will be prompted when you access cacti.
The following PHP extensions are missing:
* Sockets
Please install those PHP extensions and retry
B. lamp requires gd support
3. Install snmp
# Yum install net-snmp-devel net-snmp-utils net-snmp
Modify the snmp configuration file and set the management string to testsnmp for security.
A. Change com2sec notConfigUser 127.0.0.1 public
Com2sec notConfigUser 127.0.0.1 testsnmp
Modify access notConfigGroup "" any noauth exact systemview none to: access notConfigGroup "" any noauth exact all none
Delete the # Number of the following line
View all supported ded. 1 80
B. Restart snmp and set startup of the startup service.
Service snmpd restart
Chkconfig -- levels 35 snmpd on
4. Install cacti
Mkdir-p/usr/local/httpd/htdocs/cacti
Tar-zxvf cacti-0.8.7g.tar.gz
Cd cacti-0.8.7g
Mv */usr/local/httpd/htdocs/cacti
Chmod + w/usr/local/httpd/htdocs/cacti
5. Start apache
/Usr/local/httpd/bin/apachectl start
6. log on to mysql using mysql root to create a cacti database.
Create database cacti;
Use cacti
Source/usr/local/httpd/htdocs/cacti. SQL
7. To improve security, cacti does not apply root to create users corresponding to cacit.
Grant all privileges on cacti. * to cactitest @ "%" identified by "cactitest ";
Flush privileges;
8. Modify the cacti configuration file/usr/local/httpd/htdocs/cacti/include/config. php as follows:
$ Database_type = "mysql ";
$ Database_default = "cacti ";
$ Database_hostname = "localhost ";
$ Database_username = "cactitest ";
$ Database_password = "cactitest ";
$ Database_port = "3306 ";
9 access http: // 192.168.1.1/cacti through a browser
Select new install
Cacti automatically selects the required software path. If no software path is found, it is manually specified.
PHP Binary Path:/usr/local/php/bin/php
10 cacti default administrator password is admin
11 use the following command to generate an initial image file
/Usr/local/php/bin/php/usr/local/httpd/htdocs/cacti/poller. php>/dev/null 2> & 1
12 use crontab-e to add Automatic Execution content
*/5 */usr/local/php/bin/php/usr/local/httpd/htdocs/cacti/poller. php>/dev/null 2> & 1
13. log onto the system and click graphs. The system collects data once every five minutes by default.
14 considering that the interval between 5-minute data collection is too large, please change it to 1 minute
A. Change crontab from 5 minutes to 1 minute.
B. Change console-settings-poller Poller Interval and Cron Interval to-save every minute.
C. Change the Data Sources step (sampling time) to 60, and heartbeat (timeout) to 120. You can also use the SQL command to modify it.
Use cacti
UPDATE data_template_data SET rrd_step = 60 WHERE rrd_step = 300;
UPDATE data_template_rrd SET rrd_heartbeat = 120 WHERE rrd_heartbeat = 600;
UPDATE poller_item SET rrd_step = 60 WHERE rrd_step = 300;
D. Modify RRAs to set the display time to 1 minute, and retain the drawing time to 5 minutes.
Reduce the steps of RRAS by five times, and increase Rows by five times. You can also use SQL statements
Mysql> delete from rra;
Mysql> insert into rra values (1, "c21df5178e5c955013591239eb0afd46", "Daily (1 Minute Average)", 0.5, 86400 );
Insert into rra values (2, "0d9c0af8b8acdc7807943937b3208e29", "Weekly (30 Minute Average)", 0.5, 604800 );
Insert into rra values (3, "6fc2d038fb42950138b0ce3e9874cc60", "Monthly (2 Hour Average)", 0.5, 2678400 );
Insert into rra values (4, "e36f3adb9f152adfa5dc50fd2b23337e", "Yearly (1 Day Average)", 0.5, 1440,1600, 33053184 );
E. Discard the data obtained every five minutes and delete all the files in the rra directory.
Rm-rf/usr/local/httpd/htdocs/cacti/rra /*
Next we configure a local monitoring object to monitor Nic traffic
1. Select console-device and click add.
2. On the Add monitoring site page, enter the Description. enter 127.0.0.1 as the IP address (Hostname) of the monitoring Host, and set Host Templete to ucd/net, select Version 2 SNMP Community for Snmp Host SNMP Options and fill in testsnmp. Click create and then click Save in the pop-up window. If snmp information appears, the configuration is successful.
3. Click Create Graphs for this Host in the upper-right corner to check the box on the right of the NIC and then click create
4. To view the graphic interface in graph, click Graph Trees Point Default Tree and click Add.
Select root for Parent Item, Host for Tree Item Type, Host for Host, Graph Grouping Style for Graph Template, click Create, and then click save.
The network card Traffic diagram will be displayed in graphs in a few minutes.