码迷,mamicode.com
首页 > 其他好文 > 详细

cacti监控工具之安装篇

时间:2015-06-27 11:47:25      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:cacti安装

目录

1、引言

2、cacti概述

3、cacti的宏观架构及工作流程

4、cacti安装

5、总结

1、引言  

    在前边的两篇博文《SNMP基础知识整理》和《RRDTool工具使用详解》的讲解中,我们知道利用snmp协议可以收集远程主机的状态数据,rrdtool这个工具呢可以利用收集工具收集过来的数据进行图形的绘制。而今天我这里要讲解的cacti就是可以利用snmp协议(当然不只是snmp)和rrdtool工具来监控我们的网络,cacti这个工具使用户不直接面对rrdtool那复杂而又冗长的命令,而是在一个GUI窗口就能完成对主机的监控,下边就让我们慢慢来说说cacti。说明:博文中涉及的图片来自互联网。

2、cacti概述

    Cacti是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。它通过snmpget来获取数据,使用 RRDtool绘画图形,而且你完全可以不需要了解RRDtool复杂的参数。因此,snmp和rrdtool是cacti的关键。Snmp关系着数据的收集,rrdtool关系着数据存储和图表的生成。它提供了非常强大的数据和用户管理功能,可以指定每一个用户能查看树状结构、host以及任何一张图,还可以与LDAP结合进行用户验证,同时也能自己增加模板,功能非常强大完善,界面友好。

    需要注意的是snmp抓取的数据可不是存放在mysql数据库中的,而是rrdtool的轮转数据库中,即以rrd为后缀的rrd文件,rrdtool绘图的数据源就是来自此rrd文件,这个数据库是一个大小固定的数据库,它所能存储的数据量及采用哪种聚合函数组织数据在创建时就已确定了。

3、cacti的宏观架构及工作流程

    下边以一张图来说明cacti的架构:

技术分享

这张图形象的描述了cacti的架构,从图中可见cacti其实是一个构架,它把mysql、rrdtool工具、snmp及模板组织在一起工作,snmp用于数据的收集,数据会源源不断的填充到rrd数据库中,而mysql数据库存放模板、主机对应信息及经过rrd聚合后的rra归档数据等。

cacti的工作流程以一张图来说明,见下图:

技术分享

简单描述一下这个流程,cacti通过计划任务定时把数据采集填充到rrd数据库中,当用户需要查看被监控对象的流量数据时就像cacti发出查询某设备流量数据的命令,cacti在mysql数据库中检索此被监控对象的名称及所对应的rra数据,再调用rrdtool工具进行绘图操作,再把图形返回给用户,这样用户就能观看到图形了。

4、cacti安装

    在cacti概述中说过cacti是一个php程序,而它需要rrdtool工具进行绘图,需要snmp工具来收集数据,所以要想让cacti工作起你就需要一个php程序的运行环境、需要安装上rrdtool工作,以及snmp工具。在《SNMP基础知识整理》博文中谈到过snmp有两个安装包,一个是net-snmp,这是agent端(被监控端)所安装的包,另一个是net-snmp-utils,这个包需要安装在NMS(网络管理站)上,即安装在cacti程序所在的主机上,当然NMS通常也需要安装上net-snmp包,这样才能让cacti对自身实现监控。

    php的运行环境在linux的世界最流行的就是LAMP了,如果在cacti所监控主机规模不大的情况下,可以把LAMP的各个组件都安装在同一主机上,但涉及监控主机规模较大的,建议还是把php与mysql数据库分离出来,让php已fpm的方式运行,毕竟以模块的方式运行时,效率要低许多,我这里就把这些组件都安装在同一主机上了,并且都是采用yum源来安装。

    yum源请自行配置好后采用下边的命令就可以把所需要的所有软件包都安装上:

[root@nod1 ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@nod1 ~]# uname -r
2.6.32-358.el6.x86_64
[root@nod1 ~]# service iptables stop  #关闭防火墙
[root@nod1 ~]# chkconfig iptables off
[root@nod1 ~]# grep ‘SELINUX‘ /etc/sysconfig/selinux  #系统默认时开启了selinux,需要关闭
# SELINUX= can take one of these three values:
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
SELINUXTYPE=targeted
[root@nod1 ~]# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled   #关闭selinx
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@nod1 ~]# shutdown -r now  #重新启动系统

系统重新启动后再安装所需要的各种包:

[root@nod1 ~]# yum -y install httpd php php-mysql php-snmp mysql mysql-server net-snmp net-snmp-utils rrdtool

启动mysql、snmp相应的服务以及httpd,并测试rrdtool、snmp工具是否安装成功:

[root@nod1 ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password‘
/usr/bin/mysqladmin -u root -h nod1.test.com password ‘new-password‘
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@nod1 ~]# chkconfig mysqld on  #设置mysql开机启动
[root@nod1 ~]# service snmpd start
Starting snmpd:                                            [  OK  ]
[root@nod1 ~]# chkconfig snmpd on  #设置snmpd开机启动
[root@nod1 ~]# service snmptrapd start
Starting snmptrapd:                                        [  OK  ]
[root@nod1 ~]# chkconfig snmptrapd on  #设置snmptrapd开机启动
[root@nod1 ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@nod1 ~]# chkconfig httpd on  #设置httpd开机启动
[root@nod1 ~]# for svc in mysqld snmpd snmptrapd httpd;do chkconfig --list $svc;done   #查看各个服务是否已是开机启动状态
mysqld         0:off1:off2:on3:on4:on5:on6:off
snmpd          0:off1:off2:on3:on4:on5:on6:off
snmptrapd      0:off1:off2:on3:on4:on5:on6:off
httpd          0:off1:off2:on3:on4:on5:on6:off
[root@nod1 ~]# ss -tunl
Netid  State      Recv-Q Send-Q            Local Address:Port              Peer Address:Port
udp    UNCONN     0      0                             *:161                          *:*    
udp    UNCONN     0      0                             *:162                          *:*    
tcp    LISTEN     0      128                          :::80                          :::*    
tcp    LISTEN     0      128                          :::22                          :::*    
tcp    LISTEN     0      128                           *:22                           *:*    
tcp    LISTEN     0      100                         ::1:25                          :::*    
tcp    LISTEN     0      100                   127.0.0.1:25                           *:*    
tcp    LISTEN     0      128                   127.0.0.1:199                          *:*    
tcp    LISTEN     0      50                            *:3306                         *:* 
[root@nod1 ~]# rrdtool  #直接运行rrdtool会输出版本信息
RRDtool 1.3.8  Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
               Compiled Apr  3 2014 13:07:03
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv,  dump, restore,
  last, lastupdate, first, info, fetch, tune,
  resize, xport
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root@nod1 ~]# snmpd -v   #下边输出了snmp的版本信息
NET-SNMP version:  5.5
Web:               http://www.net-snmp.org/
Email:             net-snmp-coders@lists.sourceforge.net

创建一个测试文件,测试我们的环境是否能解析php程序:

[root@nod1 ~]# vim /var/www/html/index.php
<?php
    phpinfo();
?>
[root@nod1 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

用浏览器访问我们的主页,只要能出现像下边这们的php测试页面,那就说明我们的环境已支持php了

技术分享

上边已把php的环境准备好了,接下来配置mysql,我们需要为cacti创建一个数据库、一个接入用户及密码:

[root@nod1 ~]# mysql   #默认时mysql没有密码root就可以登陆
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql> CREATE DATABASE cacti;  #创建一个cacti数据库
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘111111‘;   #创建一个用户及密码
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

现在数据库和接入用户已创建好了,下边来准备cacti的程序:

[root@nod1 cacti]# pwd
/root/software/cacti
[root@nod1 cacti]# ls
cacti-0.8.8c.tar.gz
[root@nod1 cacti]# tar xf cacti-0.8.8c.tar.gz
[root@nod1 cacti]# ls
cacti-0.8.8c  cacti-0.8.8c.tar.gz
[root@nod1 cacti]# ls cacti-0.8.8c | grep cacti  
cacti.sql  #这个sql脚本就是用来创建cacti所需表的
[root@nod1 cacti]# mysql cacti < cacti-0.8.8c/cacti.sql  #导入脚本
mysql> show tables from cacti;  #验证表是否创建
+---------------------------+
| Tables_in_cacti           |
+---------------------------+
| cdef                      |
| cdef_items                |
| colors                    |
| data_input                |
| data_input_data           |
| data_input_fields         |
| data_local                |
| data_template             |
| data_template_data        |
| data_template_data_rra    |
| data_template_rrd         |
| graph_local               |
| graph_template_input      |
| graph_template_input_defs |
| graph_templates           |
| graph_templates_gprint    |
| graph_templates_graph     |
| graph_templates_item      |
| graph_tree                |
| graph_tree_items          |
| host                      |
| host_graph                |
| host_snmp_cache           |
| host_snmp_query           |
| host_template             |
| host_template_graph       |
| host_template_snmp_query  |
| plugin_config             |
| plugin_db_changes         |
| plugin_hooks              |
| plugin_realms             |
| poller                    |
| poller_command            |
| poller_item               |
| poller_output             |
| poller_reindex            |
| poller_time               |
| rra                       |
| rra_cf                    |
| settings                  |
| settings_graphs           |
| settings_tree             |
| snmp_query                |
| snmp_query_graph          |
| snmp_query_graph_rrd      |
| snmp_query_graph_rrd_sv   |
| snmp_query_graph_sv       |
| user_auth                 |
| user_auth_perms           |
| user_auth_realm           |
| user_log                  |
| version                   |
+---------------------------+
52 rows in set (0.00 sec)

接下为cacti配置一个虚拟主机:

[root@nod1 cacti]# vim /etc/httpd/conf/httpd.conf
.....
#DocumentRoot "/var/www/html"  #中心主机注释掉
...
#在最后启用一个虚拟主机
<VirtualHost *:80>
    DocumentRoot /web/vhosts/cacti
    ServerName nod1.test.com
    ErrorLog logs/nod1.test.com-error_log
    CustomLog logs/nod1.test.com-access_log common
    <Directory "/web/vhosts/cacti">
        Options Indexes FollowSymLinks
        DirectoryIndex index.php index.html index.htm
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
[root@nod1 cacti]# mkdir -pv /web/vhosts  #创建虚拟主机目录
mkdir: created directory `/web‘
mkdir: created directory `/web/vhosts‘
[root@nod1 cacti]# pwd
/root/software/cacti
[root@nod1 cacti]# tar xf cacti-0.8.8c.tar.gz -C /web/vhosts/
[root@nod1 cacti]# cp -r cacti-0.8.8c/* /web/vhosts/cacti    #把cacti的所有程序拷贝到虚拟主机目录
[root@nod1 cacti]# cd /web/vhosts/
[root@nod1 vhosts]# ln -sv cacti-0.8.8c cacti   #创建一个链接文件
[root@nod1 vhosts]# cd cacti
[root@nod1 cacti]# vim include/config.php
......
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "111111";
$database_port = "3306";
$database_ssl = false;
$url_path = "/";   #这一项是可选项,默认是“$url_path = "/cacti/”,表示在访问cacti控制台时需要加上"/cacti"这个URI,而修改为“$url_path = "/”后,访问cacti的控制台只需要“http://IP”即可
.......

还有一件事情不要忘记了,cacti要想把snmp收集的数据填入rrd数据库,那就需要周期性的执行php程序才行,执行这个程序的用户不应该使用root,所以应该为执行php程序创建一个用户:

[root@nod1 cacti]# useradd -r cacti
[root@nod1 cacti]# chown -R cacti rra/ log/   #需要把这两个目录的属主更改为cacti,因为php程序由此用户运行,rrd文件就在rra这个目录下,程序在执行时会产生的日志信息也应该由此用户写入
[root@nod1 cacti]# ll
total 1072
-rw-r--r--. 1 root  root   5860 Jun 26 17:16 about.php
-rw-r--r--. 1 root  root   5348 Jun 26 17:16 auth_changepassword.php
-rw-r--r--. 1 root  root  14270 Jun 26 17:16 auth_login.php
-rw-r--r--. 1 root  root 178349 Jun 26 17:16 cacti.sql
-rw-r--r--. 1 root  root  19668 Jun 26 17:16 cdef.php
drwxr-xr-x. 2 root  root   4096 Jun 26 17:16 cli
-rw-r--r--. 1 root  root  26620 Jun 26 17:16 cmd.php
-rw-r--r--. 1 root  root   6549 Jun 26 17:16 color.php
-rw-r--r--. 1 root  root  23137 Jun 26 17:16 data_input.php
-rw-r--r--. 1 root  root  33139 Jun 26 17:16 data_queries.php
-rw-r--r--. 1 root  root  58125 Jun 26 17:16 data_sources.php
-rw-r--r--. 1 root  root  31339 Jun 26 17:16 data_templates.php
drwxr-xr-x. 5 root  root   4096 Jun 26 17:16 docs
-rw-r--r--. 1 root  root   5926 Jun 26 17:16 gprint_presets.php
-rw-r--r--. 1 root  root   3657 Jun 26 17:16 graph_image.php
-rw-r--r--. 1 root  root  12796 Jun 26 17:16 graph.php
-rw-r--r--. 1 root  root   9438 Jun 26 17:16 graph_settings.php
-rw-r--r--. 1 root  root  17365 Jun 26 17:16 graphs_items.php
-rw-r--r--. 1 root  root  37671 Jun 26 17:16 graphs_new.php
-rw-r--r--. 1 root  root  58217 Jun 26 17:16 graphs.php
-rw-r--r--. 1 root  root  10229 Jun 26 17:16 graph_templates_inputs.php
-rw-r--r--. 1 root  root  18518 Jun 26 17:16 graph_templates_items.php
-rw-r--r--. 1 root  root  25283 Jun 26 17:16 graph_templates.php
-rw-r--r--. 1 root  root  42307 Jun 26 17:16 graph_view.php
-rw-r--r--. 1 root  root   6480 Jun 26 17:16 graph_xport.php
-rw-r--r--. 1 root  root  58058 Jun 26 17:16 host.php
-rw-r--r--. 1 root  root  18717 Jun 26 17:16 host_templates.php
drwxr-xr-x. 2 root  root   4096 Jun 26 17:16 images
drwxr-xr-x. 5 root  root   4096 Jun 26 17:36 include
-rw-r--r--. 1 root  root   2323 Jun 26 17:16 index.php
drwxr-xr-x. 2 root  root   4096 Jun 26 17:16 install
drwxr-xr-x. 3 root  root   4096 Jun 26 17:16 lib
-rw-r--r--. 1 root  root  15141 Jun 26 17:16 LICENSE
drwxr-xr-x. 2 cacti root   4096 Jun 26 17:16 log
-rw-r--r--. 1 root  root   2838 Jun 26 17:16 logout.php
drwxr-xr-x. 2 root  root   4096 Jun 26 17:16 plugins
-rw-r--r--. 1 root  root  24716 Jun 26 17:16 plugins.php
-rw-r--r--. 1 root  root   4310 Jun 26 17:16 poller_commands.php
-rw-r--r--. 1 root  root   3375 Jun 26 17:16 poller_export.php
-rw-r--r--. 1 root  root  18589 Jun 26 17:16 poller.php
-rw-r--r--. 1 root  root     48 Jun 26 17:16 README
drwxr-xr-x. 5 root  root   4096 Jun 26 17:16 resource
drwxr-xr-x. 2 cacti root   4096 Jun 26 17:16 rra
-rw-r--r--. 1 root  root   7293 Jun 26 17:16 rra.php
drwxr-xr-x. 2 root  root   4096 Jun 26 17:16 scripts
-rw-r--r--. 1 root  root  10819 Jun 26 17:16 script_server.php
-rw-r--r--. 1 root  root    353 Jun 26 17:16 script_server.pl
-rw-r--r--. 1 root  root   5926 Jun 26 17:16 settings.php
-rw-r--r--. 1 root  root   6215 Jun 26 17:16 templates_export.php
-rw-r--r--. 1 root  root   5771 Jun 26 17:16 templates_import.php
-rw-r--r--. 1 root  root  18717 Jun 26 17:16 tree.php
-rw-r--r--. 1 root  root  42565 Jun 26 17:16 user_admin.php
-rw-r--r--. 1 root  root  58393 Jun 26 17:16 utilities.php

再重启httpd服务就可以访问站点进行cacti的安装:

[root@nod1 cacti]# rm -rf /var/www/html/index.php 
[root@nod1 cacti]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

接下来就需要用浏览器来对cacti进行初始化,在浏览器中直接输入“http://nod1.test.com”,回车后打开下边的页面:

技术分享点击“Next”后打开如下页面:

技术分享点击“Next”后打如下页面:

技术分享点击“Finish”后打下如下页面:

技术分享默认的用户名和密码都是“admin”,第一次登陆后要求修改你的密码,最后打开的页面如下图:

技术分享

到现在cacti的控制台算是能正常访问了,接下需要设置一个计划任务,让cacti这个系统用户能够定时去执行poller.php这个程序,这个程序就是让snmp收集的数据写入到rrd中的:

[root@nod1 ~]# echo "*/5 * * * * su -s /bin/bash -c \"/usr/bin/php /web/vhosts/cacti/poller.php\" cacti > /dev/null 2>&1" > /var/spool/cron/root

注:因为在前边建立cacti这个用户时我们建立的是一个系统用户(加了"-r"选项),所以cacti这个用户没有shell,要想让cacti能执行命令,所以就写成了上边的样子

[root@nod1 ~]# crontab -l  #验证计划任务是否增加成功
*/5 * * * * su -s /bin/bash -c "/usr/bin/php /web/vhosts/cacti/poller.php" cacti > /dev/null 2>&1

为了验证cacti这个用户能成功的运行poller.php程序,需要手工来执行测试一下:

[root@nod1 ~]# su -s /bin/bash -c "/usr/bin/php /web/vhosts/cacti/poller.php" cacti   #cacti这个用户是系统用户,没有shell,所以可用这样的方式来让cacti用户执行命令
PHP Warning:  strtotime(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘ instead in /web/vhosts/cacti-0.8.8c/include/global_constants.php on line 165
PHP Warning:  date(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘ instead in /web/vhosts/cacti-0.8.8c/include/global_constants.php on line 165
PHP Warning:  strtotime(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘ instead in /web/vhosts/cacti-0.8.8c/include/global_constants.php on line 166
PHP Warning:  date(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘ instead in /web/vhosts/cacti-0.8.8c/include/global_constants.php on line 166
.......
#从输出结果中可以发现报了一堆的警告信息,这是因为我们没有设置时区导致的

修正时区的错误:

[root@nod1 ~]# vim /etc/php.ini
.....
[Date]
date.timezone = Asia/Shanghai
[root@nod1 ~]# service httpd restart   #重启httpd
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

再来测试一下:

[root@nod1 ~]# su -s /bin/bash -c "/usr/bin/php /web/vhosts/cacti/poller.php" cacti
OK u:0.00 s:0.00 r:0.02
OK u:0.00 s:0.00 r:0.03
OK u:0.00 s:0.00 r:0.04
OK u:0.00 s:0.00 r:0.06
OK u:0.00 s:0.00 r:0.09
06/26/2015 08:07:25 PM - SYSTEM STATS: Time:0.2135 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5

再去观察一下日志文件:

[root@nod1 ~]# tailf /web/vhosts/cacti/log/cacti.log
06/26/2015 07:52:17 PM - SYSTEM STATS: Time:0.4547 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 07:57:34 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is ‘300‘ seconds, with a maximum of a ‘300‘ second Cron, but 317 seconds have passed since the last poll!
06/26/2015 07:57:34 PM - SYSTEM STATS: Time:0.2409 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:03:32 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is ‘300‘ seconds, with a maximum of a ‘300‘ second Cron, but 358 seconds have passed since the last poll!
06/26/2015 08:03:32 PM - SYSTEM STATS: Time:0.2010 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:07:25 PM - SYSTEM STATS: Time:0.2135 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:24:18 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is ‘300‘ seconds, with a maximum of a ‘300‘ second Cron, but 1013 seconds have passed since the last poll!
06/26/2015 08:24:18 PM - SYSTEM STATS: Time:0.3220 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:30:02 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is ‘300‘ seconds, with a maximum of a ‘300‘ second Cron, but 344 seconds have passed since the last poll!
06/26/2015 08:30:02 PM - SYSTEM STATS: Time:0.2117 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:35:01 PM - SYSTEM STATS: Time:0.2150 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
06/26/2015 08:40:02 PM - SYSTEM STATS: Time:0.2210 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5

#最上边有些警告信息,说是在执行poller时超过了300秒,这是我在做测试时手动执行poller导致的,最后一次程序测试好后,就不会再有警告信息了。

至此,cacti我们就安装配置完成了。

5、总结

    如果你第一次部署cacti肯定会遇到这样那要的问题,为了避免少走弯路,所以我建议在部署环境时要关闭防火墙,关闭selinux,不然有时你会发现明明自己的操作是正确的,但测试的结果就是不对,我在没有关闭selinux时,配置好cacti后重新启动httpd,就发现httpd无法识别"/web/vhosts/cacti"这个链接文件,把selinux关闭后故障就排除了。所以在最初的环境部署还是建议先关闭selinux。



本文出自 “专注运维,与Linux共舞” 博客,请务必保留此出处http://zhaochj.blog.51cto.com/368705/1666191

cacti监控工具之安装篇

标签:cacti安装

原文地址:http://zhaochj.blog.51cto.com/368705/1666191

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!