使用
Cacti
监控远程主机时的
snmp.conf
配置实例
使用cacti监控系统时,本机监控一般都比较好弄,可是在监控远程主机时,在snmp的配置这个地方经常容易出画,导致画不出图像来!下面这个是要被cacti监控的主机的snmp.conf的文件配置,需要修改的地方,你的snmp.conf文件中查找以下部分,把你的文件中没有的,添加上,就可以了。下面的IP地址是我随便写的10.10.10.10,这个要改成你的被监控的主机的IP地址。其它的地方照下面的复制粘贴就行了!
有几个地方貌似有点重复,没有太多时间去每个都检验,反正肯定是好用了,呵呵:)暂时就这样喽~~~这东西总是要真正的系统的去使用的时候,才能真正理解其中的每一步的意义。光看理论也没啥意思:)
# vi /etc/snmp/snmpd.conf
//
被监控的远程主机的
#
sec.name source community
com2sec notConfigUser
127.0.0.1 public
com2sec notConfigUser
10.10.10.10 public
# Second, map the security name into a group name:
#
groupName securityModel securityName
group
notConfigGroup v1 notConfigUser
group
notConfigGroup v2c notConfigUser
# Third, create a view for us to let the group have rights to:
# Make at least
snmpwalk -v 1 localhost -c public system fast again.
#
name incl/excl subtree mask(optional)
view
systemview included .1.3.6.1.2.1.1
view
systemview included .1.3.6.1.2.1.2
view
systemview included .1.3.6.1.2.1.25.1.1
view
all included .1
# Finally, grant the group read-only access to the systemview view.
#
group context sec.model sec.level prefix read write notif
#access
notConfigGroup "" any noauth exact mib2 none none
access
notConfigGroup "" any noauth exact all none none
##
sec.name source community
#com2sec local
localhost COMMUNITY
#com2sec mynetwork NETWORK/24
COMMUNITY
com2sec notConfigUser
default public
com2sec
*.*.*.0 10.10.10.10/24 public
##
group.name sec.model sec.name
group MyRWGroup
any local
group MyROGroup
any mynetwork
group notConfigUser
any zcom
#group MyRWGroup
any otherv3user
##
incl/excl subtree mask
view all
included .1 80
view mib2
included .iso.org.dod.internet.mgmt.mib-2 fc
##
context sec.model sec.level prefix read write notif
access MyROGroup ""
any noauth 0 all none none
access MyRWGroup ""
any noauth 0 all all all
配置完成后,重启snmp服务:
# service snmpd restart
然后在Cacti的主机使用snmpwalk命令测试一下:
# snmpwalk -v 1
10.10.10.10 -c public
显示一大堆下面的信息就是正常了!
…
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_linkDown' = STRING: _linkUpDown
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_linkUp' = STRING: _linkUpDown
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFailure' = STRING: _triggerFail
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFalling' = STRING: _triggerFire
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFired' = STRING: _triggerFire
DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerRising' = STRING: _triggerFire
NOTIFICATION-LOG-MIB::nlmConfigGlobalEntryLimit.0 = Gauge32: 1000
NOTIFICATION-LOG-MIB::nlmConfigGlobalAgeOut.0 = Gauge32: 1440 minutes
NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsLogged.0 = Counter32: 0 notifications
NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsBumped.0 = Counter32: 0 notifications
…
OK,现在去Cacti的控制台里面去添加远程主机,并添加图像设置,就可以看到曲线图了应该!