views:

137

answers:

1

Hello

I would like to get data using SNMP 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

+1  A: 

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.

Brock Batsell
Super. Got this from phpinfo(): NET-SNMP Support enabled, NET-SNMP Version 5.4.1. Now I will look into the the snmpwalk function. Thanks a lot.
Tillebeck