snmp 自定义OID返回shell,cacti配置数据源

来源:互联网 发布:java服务器发送消息 编辑:程序博客网 时间:2024/05/04 11:23

修改  /etc/snmp/snmpd.conf,

vi /etc/snmp/snmpd.conf


加入这句


extend  .1.3.6.1.4.1.2021.51  http_static  /etc/snmp/sh/http_static.sh 


新建

http_static.sh 


内容:


#!/bin/bash


ip=`ifconfig eth0 |grep "inet addr:" |awk '{print $2}'|cut -c 6-`
cout=`netstat -an -t | grep "$ip:80" | grep ESTABLISHED|wc -l`


echo $cout

重启
service snmpd restart


snmpwalk -v 2c -c public ip .1.3.6.1.4.1.2021.51.3.1.2.11.104.116.116.112.95.115.116.97.116.105.99


未完待续




0 0
原创粉丝点击