zabbix自定义SNMP监控项

  1、snmp配置自定义OID

/etc/snmp/snmpd.conf

com2sec notConfigUser  default      public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c          notConfigUser
view    systemview    included   .1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
extend .1.3.6.1.4.1.2021.50  zabbix_agent /bin/bash /root/zabbix_check.sh
extend .1.3.6.1.4.1.2021.51  hadoop_QuorumPeerMain_check /bin/bash /root/hadoop_QuorumPeerMain_check.sh

添加OID内容:

extend .1.3.6.1.4.1.2021.50  zabbix_agent /root/zabbix_check.sh
extend:扩展OID
.1.3.6.1.4.1.2021.50:.1.3.6.1.4.1.2021不可变,表示用户自定义OID前缀,50用户自定义

zabbix_agent:标示、名称。用于区分不同扩展项目

/bin/bash /root/zabbix_check.sh:运行脚本,脚本的绝对路径
2、zabbix_check.sh内容
#!/bin/bash
echo `netstat -tnlp|grep -v tcp6|grep zabbix_agent|wc -l`

 

2、zabbix服务端查看

snmpwalk -v 2c -c public 192.168.8.47 .1.3.6.1.4.1.2021.50

内容如下:
UCD-SNMP-MIB::ucdavis.50.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.2.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = STRING: "/bin/bash"
UCD-SNMP-MIB::ucdavis.50.2.1.3.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = STRING: "/home/monitor/zabbix/app_connection_db.sh"
UCD-SNMP-MIB::ucdavis.50.2.1.4.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = ""
UCD-SNMP-MIB::ucdavis.50.2.1.5.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.50.2.1.6.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.7.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.20.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.50.2.1.21.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.3.1.1.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = STRING: "600"
UCD-SNMP-MIB::ucdavis.50.3.1.2.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = STRING: "600"
UCD-SNMP-MIB::ucdavis.50.3.1.3.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.3.1.4.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.50.4.1.2.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98.1 = STRING: "600"

 

完整UUID:

ucdavis.50.3.1.2.17.97.112.112.95.99.111.110.110.101.99.116.105.111.110.95.100.98

转载于:https://www.cnblogs.com/xue0123/p/9673309.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值