Squid的SNMP使用

本文可自由转载,但请遵循“署名-非商业用途-保持一致”的创作共用协议。 永久链接:JoeCen's 小猫窝
-----------------------------

After installing NET-SNMP, copy the Squid MIB file to the directory where the utilities can find it. By default, this is the /usr/local/share/snmp/mibs directory:

# cp squid-2.5.STABLE4/src/mib.txt /usr/local/share/snmp/mibs/SQUID-MIB.txt

# chmod 644 /usr/local/share/snmp/mibs/SQUID-MIB.txt
You should then be able to use the snmpget command. Note that Squid is an SNMPv1 agent:

% snmpget -v 1 -c public -m SQUID-MIB localhost:3401 cacheDnsSvcTime.5

SQUID-MIB::cacheDnsSvcTime.5 = INTEGER: 44

If you want to see the entire Squid MIB tree, use snmpwalk. The -Cc option tells snmpwalk to ignore nonincreasing OIDs:

% snmpwalk -v 1 -c public -m SQUID-MIB -Cc localhost:3401 squid | less
If you can't get the Squid MIB installed so that snmpwalk sees it, you can use the numeric OID value instead:

% snmpwalk -v 1 -c public -m SQUID-MIB -Cc localhost:3401 .1.3.6.1.4.1.3495.1 | less

注意:mib.txt的名字一定要改为大写的“MIB”,如SQUID-MIB.txt。否则不能使用!

比较遗憾的是squid的SNMP功能开发一直没有进行下去,所以一些有用的或新的性能指标也无法通过snmp来获得。比如:http request时间,objests in memory.

随机日志

  • 纳闷
  • 将MRTG的数据转换为RRDTool的格式
  • 如何让cacti显示中文
  • dd 命令的用法
  • 好玩的CLI theme
  • Leave a Reply