Cacti监控
1)cacti是用PHP语言实现的一个软件
2)使用snmp服务获取数据,nnmp关系着数据的收集
3)当用户需要查看数据的时候用rrdtool生成图表
搭建Cacti监控平台
1)部署Cacti服务运行环境LAMP/LNMP
#yum -y install httpd php php-MySQL mariadb
#systemctl restart httpd
#systemctl restart mariadb
2)搭建cacti服务器
#yum -y install rrdtool net-snmp-* /安装依赖包 snmp 简单的网络管理协议
#tar zxf cacti-0.8.8h.tar.gz
#cp -r cacti-0.8.8h /var/www/html/cacti
#chown apache:apache /var/www/html/cacti /属主,属组为apache
创建存储配置信息的库及表
#create database cactidb;
#grant all on cactidb.* to cacti@"localhost" identified by "123456"
#mysql -ucacti -p123456 cactidb < /var/www/html/cacti/cacti.sql /导入存储配置信息的表
修改配置文件,设置存储配置信息使用的库
/var/www/html/cacti/include/config.php
$database_type = "mysql"; /类型为mysql数据库
$database_default = "cactidb"; /库名为创建的cactidb
$database_hostname = "localhost"; /数据库本地主机名 localhost
$database_username = "cacti"; /登录数据库用户 cacti
$database_password = "123456";
$database_port = "3306";
$database_ssl = false;
安装数据高速采集器spine
#yum -y install mariadb-devel
#tar zxf cacti-0.8.8h.tar.gz
#cd cacti-0.8.8h
#./configure --with-mysql 默认目录为/usr/local/spine
#make
#make install
#cp usr/local/spine/etc/spine.conf.dist /etc/spine.conf
#vim /etc/spine.conf
DB_Host localhost
DB_Database cactidb
DB_User cacti
DB_Pass 123456
DB_Port 3306
web页面上进行修改
settings --> path --->Spine Poller File Path /usr/local/spine/bin/spine ---> poller--->poller Type spine
监控远端主机
a)配置被监控端[host17]
#yum -y install net-snmp-*
#sed -n '41p,62p,85p' /etc/snmp/snmpd.conf
#systemctl restart snmpd
#systemctl enable snmpd
b)配置监控服务器
1)添加监控主机 并选择监控模版
web页面 --->Devices --->add--->host17/192.168.4.17/...--->save
2)设置监控项
3)创建图片
Devices--->create Graphs for this Host
4)创建图像树,并把监控主机的图片添加到图像数里
Graph Trees--->add
5)编写抓取数据的cron任务
*/5 * * * * php /var/www/html/cacti/poller.php &> /dev/null
#ls /var/www/html/cacti/rra -l
监控报警
1)安装插件: 解压并移动到插件目录下然后激活
2)配置监控报警
要求: 对本机登录用户数做监控报警
a)创建消息列表
notification Lists
b)设置监控报警项
Thresholds
c)指定服务器
setting---> Mail/DNS
当前标题:Cacti监控
地址分享:
http://cdxtjz.com/article/jsgpgc.html