修改 /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