安装cacti被监控主机始终处于Unknown状态;
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装cacti被监控主机始终处于Unknown状态;相关的知识,希望对你有一定的参考价值。
安装cacti被监控主机始终处于Unknown状态;在服务器端输入 提示错误;
cacti]# php poller.php
FATAL: Cannot connect to mysql server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'
rra/下面没有图像,权限755 执行上面的命令提示错误怎么回事?
Password:
# mysql>create database cacti;
# mysql>grant all on cacti.* to cacti@localhost identified by ‘cacti’;
修改cacti使之可以访问数据库
#vim /usr/local/cacti/include/config.php
# $database_type = "mysql";
#$database_default = "cacti";
#$database_hostname = "localhost";
#$database_username = "cacti";
#$database_password = "cacti";
#$database_port = "3306";
导入数据库文件
#mysql -u root -p cacti < cacti.sql 参考技术B 连上数据库再说吧
把include/config.php里面的localhost改为ip地址
try
Cacti添加主机
用户名:root 密码:CactiEZ
yum groupinstall "Development Tools"
yum groupinstall "Compatibility Libraries"
被监控端安装snmp
yum -y install net-snmp net-snmp-devel
被监控端安装配置snmp
vim /etc/snmp/snmpd.conf
com2sec notConfigUser default public
改为 ( cacti主机IP地址 )
com2sec notConfigUser 192.168.0.64 public
access notConfigGroup "" any noauth exact systemview none none
改为
access notConfigGroup "" any noauth exact all none none
#view all included .1 80
将#注释删掉
view all included .1 80
然后开启 snmp
service snmpd start
service snmpd reload
service snmpd restart
设置snmpd开机启动
chkconfig snmpd on
cacti服务端测试被监控端
snmpwalk -c public -v 2c 192.168.0.64
若检测不成
vi /etc/snmp/snmpd.conf
最后配置如下:
syslocation Server Room
syscontact Sysadmin ([email protected])
rocommunity public 127.0.0.1
agentaddress 161
rocommunity public
rwcommunity private
trapsink 192.168.0.150 public 162 --> 这里的ip=192.168.0.150为被监控主机ip
然后,再执行第二步操作即可。
添加windows需要注意的地方(接受任何主机的snmp数据包)
以上是关于安装cacti被监控主机始终处于Unknown状态;的主要内容,如果未能解决你的问题,请参考以下文章
Centos 6.7 安张nagios和cacti 并添加监控主机