配置cacti+thlod+monitor并实现mail报警

发布时间:2020-10-21编辑:脚本学堂
配置Cacti+thlod+monitor并实现mail报警,安装cacti之前,请先配置好php环境。

说明:安装cacti之前,请先配置好php环境。

接下来,进行cacti的安装与配置,thlod插件的安装与配置。

cacti下载地址 http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
thlod下载地址 http://cactiusers.org/downloads

版本:cacti-0.8.7e

安装thlod需要cacti-plugin和settings支持。
下载后将所有文件cp到/var/www/html
 

复制代码 代码如下:
[root@service html]#wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz
[root@service html]#wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.5.zip
[root@service html]#wget http://mirror.cactiusers.org/downloads/plugins/thold-0.4.1.tar.gz
[root@service html]#wget http://mirror.cactiusers.org/downloads/plugins/monitor-0.8.2.zip
[root@service html]#wget http://mirror.cactiusers.org/downloads/plugins/settings-0.5.zip

安装cacti
 

复制代码 代码如下:
[root@service html]# tar xzvf cacti-0.8.7e.tar.gz
[root@service html]# mv cacti-0.8.7e cacti //修改名字
[root@service html]# vim cacti/include/config.php //修改连接数据库
[root@service html]# vim cacti/include/global.php

建立cacti数据库并且导入数据库
 

复制代码 代码如下:
[root@service html]# mysql
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> use cacti
Database changed
mysql> source /var/www/html/cacti/cacti.sql;

nginx配的置文件
 

复制代码 代码如下:
server {
listen 80;
server_name cacti.test.com;
location / {
root /var/www/html/cacti/;
index index.php index.html index.htm;
#access_log logs/host.access.log main;
}
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/cacti/$fastcgi_script_name;
include fastcgi_params;

需要安装snmp,
 

复制代码 代码如下:
# yum install net-snmp*
[root@service html]# rpm -qa|grep net-snmp
net-snmp-5.3.2.2-5.el5_3.1
net-snmp-perl-5.3.2.2-5.el5_3.1
net-snmp-devel-5.3.2.2-5.el5_3.1
net-snmp-libs-5.3.2.2-5.el5_3.1
net-snmp-utils-5.3.2.2-5.el5_3.1

修改snmp文件并且启动
[root@service html]# vim /etc/snmp/snmpd.conf
 

复制代码 代码如下:
#com2sec notConfigUser default public //原
com2sec notConfigUser 127.0.0.1 public //修改后的
#access notConfigGroup "" any noauth exact systemview none none //原
access notConfigGroup "" any noauth exact all none none //修改后的
view all included .1 80 //去掉注释
[root@service html]# service snmpd start
Starting snmpd: [ OK ]

rrdtool 安装
 

复制代码 代码如下:
[root@service html]#wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@service html]#rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@service html]#yum install rrdtool

输入cacti.test.com 进行安装了 安装步骤直接下一步。
这里我就不输入了,默认密码是admin。
 

复制代码 代码如下:
[root@service html]#cp -R files-0.8.7e/* /var/www/html/cacti/
[root@service html]#mkdir cacti/plugins settings
[root@service html]#mkdir cacti/plugins/settings
[root@service html]#mkdir cacti/plugins/thold
[root@service html]#mkdir cacti/plugins/monitor
[root@service html]#cp monitor-0.8.2.zip cacti/plugins/monitor/
[root@service html]#cp settings-0.5.zip cacti/plugins/settings/
[root@service html]#cp thold-0.4.1.zip cacti/plugins/thold/
 

[root@service html]#vim cacti/include/global.php 进入添加
 

复制代码 代码如下:
$plugins[] = 'thold';
$plugins[] = 'settings';
$plugins[] = 'monitor';
[root@service html]#cd cacti/plugins
[root@service html]#cd monitor/
[root@service html]#unzip monitor-0.8.2.zip
[root@service plugins]#mysql cacti -u root -p < monitor.sql
[root@service plugins]#unzip thold-0.4.1.zip
[root@service plugins]#mysql cacti -u root -p < thold.sql
[root@service plugins]#unzip settings-0.5.zip
Plugin Management —->admin—–>Plugin Management //授权用户