Outline
I. Brief introduction of CACTI
Second, configure Nginx, PHP, MySQL
Third, cacti + spine construction
First, brief
The cacti collects data sources based on SNMP, RRDtool stores data and plots it to users. The data source that SNMP obtains is the. rrd file, which is stored in the RRA directory under the cacti directory.
Work flow
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/32/wKiom1c6vJWja0XgAABXDtGTAsA133.png "title=" 2.png " alt= "Wkiom1c6vjwja0xgaabxdtgtasa133.png"/>
Second, configure Nginx, PHP, MySQL (ignoring LNMP environment deployment process)
1. Configure Nginx
#在nginx中加入一个server [[email protected]_6.213 cacti-spine-0.8.8h] $vim /usr/local/nginx/conf/ nginx.conf server { listen 8888; access_log log/access_catic.log main; location / { index index.html index.php; root /usr/local /cacti/; } Location ~.*\. (PHP|PHP5)?$ { root /usr/local/cacti/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_ filename /usr/local/cacti/$fastcgi _script_name; include fastcgi_params; } location = /favicon.ico { log_not_found off; access_log off; } } #添加完成后, test the configuration file syntax properly [[email protected]_6.213 cacti-spine-0.8.8h]$/usr/local/ Nginx/sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful# Create cacti log file [[email protected]_6.213 cacti-spine-0.8.8h] $touch /usr /local/nginx/log/access_cacti.log# change the genus of nginx and subdirectories [[email protected]_6.213 cacti-spine-0.8.8h] $chown -r nginx.nginx /usr/local/nginx/#启动nginx [[email protected]_6.213 cacti-spine-0.8.8h] $/usr/local/nginx/sbin/nginx# viewing Nginx-Initiated ports [[email protected]_6.213 cacti-spine-0.8.8h] $netstat - ntlp | grep nginxtcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 29641/nginx tcp 0 0 0.0.0.0:8888 0.0.0.0:* listen 29641/nginx
2. Configure PHP:
#更改php. ini time zone [[[email protected]_6.213 cacti-spine-0.8.8h] $vim /etc/php.inidate.timezone = asia/shanghai# changing the PHP-FPM group [[email protected]_6.213 conf] $vim /etc/php-fpm.d/www.confuser = nginxgroup = nginx# start php-fpm and view its port status [[Email protected]_6.213 conf] $service php-fpm startStarting php-fpm: [ OK  ][[EMAIL PROTECTED]_6.213 CONF] $netstat -ntlp | grep phptcp 0 0 127.0.0.1:9000 0.0.0.0:* listen 3773/php-fpm# Create a new Session directory and change the directory genera Group and permissions (defined session path in/etc/php-fpm.d/www.conf) [[Email protected]_6.213 local] $mkdir -p /var/lib/php/session[[email protected]_6.213 local] $chown nginx.nginx /var/ Lib/php/session[[email protected]_6.213 local] $chmod -r 770 /var/lib/php/session
3. Create and import cacti database and user password authorization
Mysql> CREATE database cacti;mysql> use cacti;mysql> \. /usr/local/cacti/cacti.sqlmysql> create user ' cactiuser ' @ ' 192.168.%.% ' identified by ' CACTIPASSWD ';mysql> grant All on cacti.* to ' cactiuser ' @ ' 192.168.%.% ' identified by ' cactipasswd ';mysql> flush privileges;
Iii. Construction of Cacti+spine
#1. Installing snmp[[email protected]_6.213 ~] $yum -y install net-snmp net-snmp-utils net-snmp-devel# Change the community name and Objectid (the community name can remain the default): [[email protected] ~]# vim /etc/snmp/ snmpd.conf# Modify Previous: com2sec notconfiguser default public# Modified after: com2sec notconfiguser default test# Modify the first two: view systemview included .1.3.6.1.2.1.1# Modified Second: view systemview included .1# start the SNMPD service: [ [email protected]_6.213 ~] $service snmpd startStarting snmpd: [ ok ] #SNMP数据采集测试: [[email protected]_6.213 ~]$ Snmpnetstat -v 2c -c&nbSp test -cna -cp tcp 127.0.0.1active internet (TCP) Connections ( Including servers) proto local address Remote Address (state) tcp *. 22 *.* LISTENtcp *.80 *.* LISTENtcp *.111 *.* listentcp *.23177 *.* listentcp 127.0.0.1.199 *.* listentcp 192.168.6.213.22 192.168.4.95.50605 ESTABLISHEDtcp 192.168.6.213.22 192.168.4.95.55708 established
#2. Installation rrdtool:[[email protected]_6.213 ~] $yum -y Install rrdtool rrdtool-devel
#3. Installation Cacti[[email protected]_6.213 data] $wget http:// Www.cacti.net/downloads/cacti-0.8.8h.tar.gz[[email protected]_6.213 ~] $tar zxvf Cacti-0.8.8h.tar.gz -c /usr/local/[[email protected]_6.213 ~] $CD /usr/local/[[email protected]_6.213 local] $MV cacti-0.8.8h/ cacti /[[email protected]_6.213 Local] $chown -r nginx.nginx cacti/#修改cacti配置文件: [[email protected]_6.213 local] $vim cacti/include/config.php$database_type = "MySQL"; $database _default = "cacti"; $ database_hostname = "192.168.6.213"; $database _username = "Cactiuser"; $database _password = "cactipasswd"; $database _port = "3306"; $database _ssl = false;
#4. Installing spine[[email protected]_6.213] $wget http://www.cacti.net/downloads/spine/ Cacti-spine-0.8.8h.tar.gz[[email protected]_6.213 ~] $tar zxvf cacti-spine-0.8.8h.tar.gz[[ email protected]_6.213 cacti-spine-0.8.8h]$./configure --prefix=/usr/local/spine/[[email PROTECTED]_6.213 CACTI-SPINE-0.8.8H] $make && make install[[email protected]_ 6.213 CACTI-SPINE-0.8.8H] $chown -r nginx.nginx /usr/local/spine/[[email protected]_ 6.213 CACTI-SPINE-0.8.8H] $CP /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/ spine.conf# Modifying the spine configuration file: [[email protected]_6.213 cacti-spine-0.8.8h] $vim /usr/local/spine/etc/ spine.confdb_host 192.168.6.213db_database cactiDB_User cactiuserDB_Pass cactipasswddb_port 3306# Test Spine Whether the installation was successful: [[Email protected]_ 6.213 local] $spine/bin/spine -c spine/etc/spine.confspine: using spine config file [spine/etc/spine.conf]SPINE: Version 0.8.8h startingSPINE: Time: 0.1398 s, threads: 5, hosts: 2
#5. Cacti Pull data delivery rrdtool drawings per minute. [Email protected]_6.213 Local] $crontab-UNGINX-L*/1 * * * */usr/bin/php/usr/local/cacti/poller.php &>/dev/null #获取数据测试: [[email protected]_6.213 ~] $su nginx[[email protected]_6.213 Root] $php/usr/local/cacti/poller.php--forceok u :0.00 s:0.01 r:0.11OK u:0.00 s:0.01 r:0.15OK u:0.00 s:0.01 r:0.18OK u:0.00 s:0.01 r:0.23OK u:0.00 s:0.01 r:0.3005/17/2016 02:05:57 pm-system stats:time:0.4624 Method:cmd.php processes:1 threads:n/a hosts:2 hostsperprocess:2 DataSources:5 RRD Sprocessed:5
#6. Web interface Configuration Chapter #a. Open the browser, enter the cacti server IP address and port (default 80, no input), enter the installation interface, for example, click Next:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/30/wKioL1c6xsST2WcbAACYkHTtRoI115.png "title=" 3.png " alt= "Wkiol1c6xsst2wcbaacykhttroi115.png"/>
#b. Depending on the actual situation, choose Install or upgrade, we are a new installation, so choose the NEX install, then next:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/32/wKiom1c6xhjSMZwwAABbgehC6_c453.png "title=" 4.png " alt= "Wkiom1c6xhjsmzwwaabbgehc6_c453.png"/>
#c. Check all path configuration, the correct configuration will prompt OK, marked with green font; Generally without changes, we directly finish:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/32/wKiom1c6xkGxHxdrAAEC-_NGm0k951.png "title=" 5.png " alt= "Wkiom1c6xkgxhxdraaec-_ngm0k951.png"/>
#d. Prompt for user name password, default is admin. Click Login after entering:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/30/wKioL1c6x06Du_jhAACkPzaKZMs341.png "title=" 6.png " alt= "Wkiol1c6x06du_jhaackpzakzms341.png"/>
#e. Prompt to force change password, enter new password after save, that is, login cacti management interface
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/32/wKiom1c6xqiz_IeAAAC8zNUupJ8877.png "title=" E.png " alt= "Wkiom1c6xqiz_ieaaac8znuupj8877.png"/>
#f. Go to "console-configuration-settings-general", locate the SNMP Defaults, change the SNMP version to version 2, change the community name that SNMP community set for you, The default is public.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/30/wKioL1c6x8OBZGrAAAGDIpPmV3s222.png "title=" F.png " alt= "Wkiol1c6x8obzgraaagdippmv3s222.png"/>
#g. Under "Console-configuration-settings-pathes", locate alternate Poller path, and after spine poller File path, fill in the path where you installed spine and save it. Normal will prompt "Ok:file FOUND"
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/32/wKiom1c6xwOxVolUAAAypGeChF4006.png "title=" G.png " alt= "Wkiom1c6xwoxvoluaaaypgechf4006.png"/>
#h. Enter "Console-configuration-settings-poller", change Poller type to spine (default = cmd.php), modify Poller Interval, Cron Interval schedule the time and save the task you set.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/80/32/wKiom1c6xyTjeDyZAAEKPrMqbjg699.png "title=" H.png " alt= "Wkiom1c6xytjedyzaaekprmqbjg699.png"/>
#i. To this, cacti installation is complete. Cacti by default, this machine is added to monitor to see the graphical display effect. Click "Graphs-default tree-host:localhost" in the top left corner of the admin interface:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/30/wKioL1c6yEKSpZx4AABip10gZiQ187.png "title=" I.png " alt= "Wkiol1c6yekspzx4aabip10gziq187.png"/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/80/32/wKiom1c6x2aDEuxRAAA-uSWai6Y623.png "title=" ii.png "alt=" Wkiom1c6x2adeuxraaa-uswai6y623.png "/>
This article is from the "My Words" blog, please be sure to keep this source http://wuyanc.blog.51cto.com/11569260/1774350
Cacti series of installation chapter Lnmp+cacti+spine (i)