nagios 监控流量插件check_traffic

本文详细介绍了如何安装并配置SNMP和Nagios监控系统,包括安装所需软件、修复SNMP配置、启动和服务设置、上传插件、配置测试脚本等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一,安装所需软件net-snmp net-snmp-utils net-snmp-libs net-snmp-devel

yum install net-snmp net-snmp-utils net-snmp-libs net-snmp-devel bc

二,修复snmp配置:

vim /etc/snmp/snmp.conf 修改为:

# sec.name source community

#com2sec notConfigUser default public

com2sec notConfigUser localhost public

access notConfigGroup "" any noauth exact mib2 none none

view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

三,启动snmp服务:

service snmpd start

四,设置开启启动:

chkconfig snmpd on

五,上传插件到/usr/local/nagios/libexec (插件在附件中)

六,配置

测试check_traffic 脚本:

cd /usr/local/nagios/libexec

./check_traffic -V 2c -C nagios -H localhost –L命令列出网络接口

然后更改所属 chown nagios:nagios check_traffic.sh
执行如下命令查看网卡 /usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -L (which: no bc in (/program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) Can not found command bc in you system PATH: /program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin, pleas check it *****解决办法 yum install bc )


cd /usr/local/nagios/etc

vim nrpe.cfg #添加

command[check_traffic]=/usr/local/nagios/libexec/check_traffic -V 2c -C public -H localhost -I 2 -w 2200,4000 -c 2500,4500 -K -B

-I 2 指网卡接口(就是你要监控的网卡接口)

修改chown nagios:nagios /var/tmp/check_traffic_localhost_2.hist_dat

重启nrpe 服务

七,配置监控服务器:

cd /usr/local/nagios/etc/objects

编辑vim services.cfg中添加:

define service {
use services-pnp
host_name xxx-Server
service_description check-traffic
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_traffic
}

八,测试
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值