开发者

how to read SNMP for bandwidth using php

I would like to get data using SNMP开发者_C百科 from a router. The data shall be used for a graph I guess using the jquery flot.

But my issue is I do not know how to get my webpage to read the data using SNMP from the router.

I normally use MRTG but I would like to learn how to handcode it if possible.

BR. Anders


Use phpinfo() to check if your server's PHP binary was built with SNMP support. If so, you can do this:

<?php

$snmp_values = snmpwalk("10.0.0.1", "public", null);

print_r($snmp_values);

Where "10.0.0.1" is your router's IP; this will give you the SNMP values returned by your router (different routers return different data), and you can write a script to process that data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜