3) common monitoring objects of cacti
(1) server resources: CPU, memory, disk, process, connections, etc.
(2) server types: WEB, Mail, FTP, database, and Middleware
(3) Network Interfaces: traffic, forwarding speed, and Packet Loss Rate
(4) network device performance, configuration files (comparison and backup), and number of routes
(5) Security Device Performance, connections, and attacks
(6) device running status: fan, power supply, temperature
(7) data center operating environment: current, voltage, temperature and humidityThese are all materials found online .......
Now, the introduction is complete, and we will start to build it this time:
1. Build the lnmp platform and use yum, which is very simple ......
Service snmpd start
Service nginx start
Service php-fpm start
You need to ensure that the boot starts, and selinux is disabled .......
2. Install snmp and use SNMP to collect data
[Root @ www/] # yum-y install lm_sensors net-snmp-utils
3. cacti relies on rrdtool to generate charts. Therefore, you must first install rrdtool:
[Root @ www/] # yum-y install cairo-devel glib2-devel pango-devel intltool install dependency package
[Root @ www/] # wgethttp: // oss. oetiker. ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
[Root @ www/] # tar-zxvf rrdtool-1.4.7.tar.gz
[Root @ www/] # cd rrdtool-1.4.7
[Root @ www/] #./configure -- prefix =/usr/local & make install
4. Go to the database to create cacti data and create a user:
Create database cactidb default charactersetutf8; # create a database grant all on cactidb. * to cactiuser @ localhost identified by '20140901'; # create a mysql user
Use cactidb # use the database you just created
Source/usr/local/nginx/html/cacti. SQL # import cacti data
5. Edit the cacti configuration file
[Root @ www/] # vi/usr/share/nginx/html/cacti/include/config. php
$ Database_type = "mysql"; # Database Type
$ Database_default = "cactidb"; # Database Name
$ Database_hostname = "localhost"; # Database Host
$ Database_username = "cactiuser"; # Database User
$ Database_password = "123456"; # Database Password
$ Database_port = "3306"; # Database Port
$ Database_ssl = false;
6. Modify the nginx configuration file as follows:
[Root @ www cacti] # vi/etc/nginx/conf. d/default. conf
The nginx configuration file for lnmp installed with yum needs to be modified here. If location is modified in nginx. conf, The nginx startup will fail.
Location /{
Root html;
Index. php;
}
Location ~ \. Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Include fastcgi_params;
Fastcgi_buffer_size 8 k;
}
Note: This must be correct. Otherwise, the 403 error will be reported, or the page is too large ......
Then restart nginx.
7. Set the time zone:
If this is not set, the page may be full of logs when you access cacti, telling you that the time zone is incorrect.
[Root @ www cacti] # vi include/global_constants.php
Add
date_default_timezone_set("Asia/Chongqing");
8. Configure snmp and edit/etc/snmp/snmpd. conf:
vi /etc/snmp/snmpd.conf
Then, find line 41 and change the public name to a complicated name:
com2sec notConfigUser default public
Then 62 rows are found.
access notConfigGroup "" any noauth exact systemview none none
Change systemview to all:
access notConfigGroup "" any noauth exact all none none
Then remove the comment of 85 rows:
View all supported ded. 1 80
Sometimes this can also be commented out .......
Save the configuration file and start snmp
service snmpd start
9. Schedule Tasks
[Root @ www cacti] # crontab-u cactiuser-e
*/5 * cactier php/var/www/html/cacti/poller. php>/dev/null &# Use cactier to capture data every five minutes. This time should be the minimum interval. I do not recommend you change it to a smaller value.
Then you can access: http: // 192.168.1.31/cacti. In order to save trouble, you will not upload images ......