设为首页 收藏本站
查看: 2367|回复: 0

nagios通过SNMP服务的网络监控

[复制链接]

尚未签到

发表于 2019-1-13 12:44:02 | 显示全部楼层 |阅读模式
  nagios通过SNMP服务的网络监控,当达到某个设定的值,那么就报警
  http://bbotte.blog.运维网.com/6205307/1403997 nagios服务端和客户端的安装配置
  http://bbotte.blog.运维网.com/6205307/1583484 Nagios结合pnp4nagios图形监控
  

  借助于网上提供的资源,做下面的操作

  https://github.com/cloved/check_traffic/releases  下载最新版本的shell脚本
下载check_traffic.sh  V1.4.0,在附件已经上传
  #被监控端/客户端
cd /usr/local/nagios/libexec/  #下载此脚本
chmod 755 check_traffic.sh
# yum install net-snmp-utils net-snmp net-snmp-libs bc -y  #因脚本里面需要用到bc
# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
# vim /etc/snmp/snmpd.conf                                 #配置snmp服务
# cat /etc/snmp/snmpd.conf|grep -v ^\# |sed '/^$/d'
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  all none none
view all    included  .1                               80
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
access notConfigGroup ""      any       noauth    exact  all none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root  (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
# service snmpd start
# snmpd -L                                                  #测试snmp配置文件
Error opening specified endpoint ""
Server Exiting with code 1
# ./check_traffic.sh -V 2c -C public -H localhost -L -vvvv  #测试本机的网口,主要的数值是index后面的数字
List Interface for host localhost.
Interface index 1 orresponding to  lo
Interface index 2 orresponding to  eth0
Interface index 3 orresponding to  eth1
# ./check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 2000,3000 -c 3001,5000 -K –B
OK - It is the first time of this plugins to run, or some data file lost. We will get the data from the next time.
# ll /var/tmp/check_traffic_127.0.0.1_2__itnms.hist_dat_64   #检查权限,所属用户和组都为nagios
#此脚本有帮助说明,用-h查看,上面 -I 2 即是对eth0做监控,-w 2000,3000是流入2000K/s,或发送3000K/s会提示warning
# -V    1|2c|3
#    Specify the version of snmp
#
# -C    Community
#    Specify the Community
#
# -H    host
#    Specify the host
#
# -6    Use 64 bit counter, ifHC*  instead of if*.
#
# -r    Use Range instead of single value in warning and critical Threshold;
#
# -I    interface
#    Specify the interface
#
# -N    interface name
#    Specify the interface name
#
# -L    List all Interfaces on specify host
#
# -B/b  Switch to B/s or bps, default is -b, bps
#
# -K/M  Switch to K or M (bsp,B/s), default is -K  #被监控端/客户端

vim /usr/local/nagios/etc/nrpe.cfg
command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 2000,4000 -c 4000,6000 -K -B
# service nrped restart  #监控端/服务端

vim /usr/local/nagios/etc/objects/linuxhost.cfg
define host{
        use                     mylinux-server,service-pnp
        host_name               192_168_23_2
        alias                   server tongji
        address                 192.168.23.2
        }
vim /usr/local/nagios/etc/objects/linux13.cfg
define service{
        use                             linux-service,service-pnp
        host_name                       192_168_1_2
        service_description             check network
        check_command                   check_nrpe!check_traffic
        }  完事把nagios重启一下,刚开始会搜集数据,如下面的提示 大概2分钟就能看到图形界面了,
  PNP4Nagios Version 0.6.24
Please check the documentation for information about the following error.
XMLfile
"/usr/local/pnp4nagios/var/perfdata/192_168_1_2/check_network.xml" not
found. Read FAQ
online
file [line]:
application/models/data.php [312]:
back
  在nagios页面会看到




  此图会有in,out的网卡流量,可以在服务器ifstat验证
  

  此外,http://nagios.manubulon.com/ 这个网站也值得一看,里面有 http://nagios.manubulon.com/check_snmp_int.pl 脚本,同样可以实现对网络的监控



附件:http://down.运维网.com/data/2365405


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-662750-1-1.html 上篇帖子: pnp4nagios工作模式详解 下篇帖子: Nagios缓存检测
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表