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

【5】nagios从零学习使用

[复制链接]

尚未签到

发表于 2019-1-14 08:15:03 | 显示全部楼层 |阅读模式
  centreon已定义了非常多常用的snmp命令,对一些服务器若是不想安装nsclient++插件的,可以使用snmp协议。
  

  centreon已定义snmp命令:
/usr/local/nagios/libexec
[root@centreon libexec]# ls check_centreon_*
check_centreon_dummy                 check_centreon_snmp_multiple_process  check_centreon_snmp_TcpConn
check_centreon_MS_multiple_services  check_centreon_snmp_packetErrors      check_centreon_snmp_traffic
check_centreon_ping                  check_centreon_snmp_process           check_centreon_snmp_uptime
check_centreon_snmp_cpu              check_centreon_snmp_process_detailed  check_centreon_snmp_value
check_centreon_snmp_loadaverage      check_centreon_snmp_remote_storage    check_centreon_snmp_value_table.pl
check_centreon_snmp_memory           check_centreon_snmp_string  一般的监控基本上可以满足
  

  windows安装snmp并设置:

  在安全中添加public只读,以及填写centreon所在的服务器IP地址。

  

  Linux安装snmp并设置:
  

  [root@centreon libexec]# rpm -qa | grep snmp
  net-snmp-libs-5.5-49.el6_5.1.x86_64
  net-snmp-perl-5.5-49.el6_5.1.x86_64
  net-snmp-utils-5.5-49.el6_5.1.x86_64
  net-snmp-5.5-49.el6_5.1.x86_64
  php-snmp-5.3.3-27.el6_5.x86_64
  

  设置如下:
  [root@centreon log]# cat /etc/snmp/snmpd.conf | grep -v '^#'|sed /^$/d
  com2sec notConfigUser  127.0.0.1       public
  com2sec notConfigUser  192.168.198.250       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
  syslocation Unknown (edit /etc/snmp/snmpd.conf)
  syscontact Root  (configure /etc/snmp/snmp.local.conf)
  dontLogTCPWrappersConnects yes
  

  

  以check_centreon_snmp_remote_storage为例:
[root@centreon libexec]# ./check_centreon_snmp_remote_storage  --help
##############################################
#    Copyright (c) 2004-2013 Centreon        #
#    Bugs to http://forge.centreon.com/      #
##############################################
Usage:
./check_centreon_snmp_remote_storage
-H (--hostname)   Hostname to query (required)
-C (--community)  SNMP read community (defaults to public)
used with SNMP v1 and v2c
-v (--snmp-version)  1 for SNMP v1 (default)
2 for SNMP v2c
3 for SNMP v3
-P (--snmp-port)  SNMP port (default: 161)
-k (--authkey)    snmp V3 key
-u (--username)   snmp V3 username
-p (--password)   snmp V3 password
--authprotocol    protocol MD5/SHA  (v3)
--privprotocol    encryption system (DES/AES)(v3)
--privpassword    passphrase (v3)
--64-bits         Use 64 bits OID
--maxrepetitions  To use when you have the error: 'Message size exceeded buffer maxMsgSize'
Work only with SNMP v2c and v3 (Example: --maxrepetitions=1)
--snmp-timeout    SNMP Timeout
-d (--disk)       Set the disk (number expected) ex: 1, 2,... (default: 2 )
-n (--name)       Allows to use disk name with option -d instead of disk oid index
(ex: -d "C:" -n, -d "E:" -n, -d "Swap Memory" -n, -d "Real Memory" -n
(choose an unique expression for each disk)
-s (--show)       Lists all disks (debug mode)
-w (--warn)       Minimum fill level at which a warning message will be generated
(default 80)
By using the optional suffixes MB/GB the argument is interpreted as absolute size
and it becomes a threshold for free space. (ex. 100MB; 3GB)
-c (--crit)       Minimum fill level at which a critical message will be generated
(default 95)
By using the optional suffixes MB/GB the argument is interpreted as absolute size
and it becomes a threshold for free space. (ex. 50MB; 1GB)
ex.: -w 1GB -c 256MB generates a warning when free space reaches 1GB
and critical when there are less than 256MB left
-V (--version)    Plugin version
-L                add Windows drive label to output
-M                Shows the size in output in MB instead of GB
-t                To use for AIX or AS/400 (ex. 'AIX' or 'AS/400')
-a (--cache)      Updates cache file every n hours instead of doing snmpwalk for every check (default: 3)
-h (--help)       usage help  

  查看这198.1这台window主机的所以存储设备
[root@centreon libexec]# ./check_centreon_snmp_remote_storage -H 192.168.198.1 -s
hrStorage 1 :: C:\ Label:  Serial Number 9067daf7
hrStorage 2 :: D:\ Label:  Serial Number 82944
hrStorage 3 :: E:\ Label:  Serial Number ab609
hrStorage 4 :: F:\ Label:  Serial Number 8c504
hrStorage 5 :: G:\ Label:  Serial Number e0aa9
hrStorage 6 :: H:\
hrStorage 7 :: I:\
hrStorage 8 :: Virtual Memory
hrStorage 9 :: Physical Memory  

[root@centreon libexec]# ./check_centreon_snmp_remote_storage -H 192.168.198.1 -n -d "C:" -w 80 -c 90 -v 2 -C public
Disk WARNING - C: TOTAL: 50.000GB USED: 41.674GB (83%) FREE: 8.326GB (17%)|size=53687091200B used=44747120640B;42949672960;48318382080;0;53687091200  注意:里面的盘符需要大写:C
  

  centreon里面的设置如下:

  

  

  检测命令定义之后,可以定义服务模板,这个模板可以给主机模板引用。

  

  主机模板中的关系中可以引用服务,这样常用的模板可以把一些常用的监控添加来。

  

  





运维网声明 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-662963-1-1.html 上篇帖子: Nagios监控系统详解 下篇帖子: 解决naigos+pnp4nagios部分不出图的问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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