zhouyi 发表于 2012-12-10 09:02:14

Nagios监控本地的流量安装配置

一、 linux主机主要步骤:
1、安装snmpd服务软件包并设置启动之。2、上传监控插件至被监控机nagios/libexec目录并授权3、网卡参数检测4、增加监控command5、 nagios服务器配置添加监控项
    具体实施:
1、 安装修改启动snmpd服务安装:# yum -y install net-snmp*修改vi /etc/snmp/snmp.conf
a)更改# sec.name source communitycom2sec notConfigUser default public为# sec.name source communitycom2sec notConfigUser 127.0.0.1(源IP) public(共同体名,即访问密码)b)更改access notConfigGroup "" any noauth exact systemview none none为access notConfigGroup "" any noauth exact mib2 none nonec)去掉该的##view mib2 included .iso.org.dod.internet.mgmt.mib-2 fcd)启动snmp/etc/init.d/snmpd start
2、上传插件被授权,上传check_traffic.sh至/usr/local/nagios/libexec
cp /root/nagios/nagios-cn-3.2.3/sample-config/check_traffic.sh /usr/local/nagios/libexec/改属主为:nagios
chown nagios.nagios ./check_traffic.shchmod 776 /var/tmp/*
3、网卡参数检测:
检查启动情况
Netstat –na|grep 161
测试snmpwalk -v 1 -c public localhost system
Traffic 脚本测试,如果不知道网卡, 命令列出
/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -L# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -LList Interface for host 127.0.0.1.Interface index 1 orresponding toloInterface index 2 orresponding toeth0Interface index 3 orresponding tosit0可以测试是否能够正常采集到数据# /usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 12,30 -c 15,35 -M -bOK - The Traffic In is 0.0Mbps, Out is 0.0Mbps, Total is 0.0Mbps. The Check Interval is 31s |In=0.0Mbps;12;15;0;0 Out=0.0Mbps;30;35;0;0 Total=0.0Mbps;42;50;0;0 Interval=31s;1200;1800;0;0注:-V snmp协议版本   -C 共同体名   -I 参数对应上面-L输出的网卡index值。标示监视相应的网卡。该插件其它使用方法及各参数解释详情”-help”或者看上面论坛石头描述4.增加监控command
修改commands.cfg,增加如下段define command{      command_name check_traffic      command_line   $USER1$/check_traffic.sh -V 2c -C public -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$ -c $ARG3$ -M -b      }5.nagios服务器配置添加监控项
修改localhost.cfg,增加如下段############监控流量####################define service{      use                           local-service,services-pnp         ; Name of service template to use      host_name                     localhost      service_description             check_trafficcheck_command               check_traffic!2!12,30!15,35notifications_enabled      1}重启nagios,snmpdService nagios restartService snmpd restart

xiguaqq20 发表于 2013-3-14 00:23:46

找到好贴不容易,我顶你了,谢了

jydg 发表于 2013-5-15 22:06:18

学习了,不错,讲的太有道理了

zhendeaini123 发表于 2013-5-17 06:11:00

如果有一双眼睛陪我一同哭泣,就值得我为生命受苦。

上都海奶茶馆 发表于 2013-5-18 04:01:24

只要不下流,我们就是主流!

奥飞火千万电 发表于 2013-5-19 09:47:13

我不在江湖,但江湖中有我的传说。

52037317 发表于 2013-5-20 14:52:07

看尽天下A片,心中自然无码~
页: [1]
查看完整版本: Nagios监控本地的流量安装配置