SNMP hostinfo

Screenshort of the resulting web page

I have written a very simple perl CGI script that extracts some basic information using SNMP and displays it in a web page. The information contains the basic SNMP information (name, contact, location, available services), and some basic information about IP addresses, routes, interfaces and storage. Not all devices will implement all the Management Information Bases (MIB) so do not be surprised if some fields remain empty.

The script uses two basic SNMP commands: snmpget and snmptable, those are typically available on Unix system by the way of Net-SNMP project. I’m using the script on Mac OS X, but it should run on any Unix with Net-SNMP installed. If this is not the case, I’m interested in hearing from you.

To use it, do the following:

  1. Download the
  2. Unzip it, the file is named hostinfo.
  3. Copy the file into the CGI folder of your server, on a Mac OS X client machine, this is /Library/WebServer/CGI-Executables/
  4. Make sure the file is executable: chmod uga+x hostinfo.
  5. The script assumes the SNMP commands are in /usr/bin, if this is not the case, edit lines 12 and 13, and add the correct path to the commands (you can use which snmpget and which snmptable to figure it out). If you want to run the script on windows, you will need to add the drive letters at those lines.
  6. The script is accessible (assuming you install it locally) at the following url:

As usual, this script is given as is. I took some care to avoid code injections issues, but I take no responsability if your computer crashes, your laptop explodes or your cat tries to become master of the universe. Below a sample output for my NAS.

One thought on “SNMP hostinfo”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.