SNMP with CygWin

I love CygWin. I helps me to combine the best of 2 worlds, the easy of use and convenience of Windows and the command line functionality of Linux. (This statement is blasphemy in some circles. I know). The challenge though is that sometimes it is difficult to have all the tools you need without first connecting to a Linux box, especially for times when this is not possible.

This is one example. I needed snmpwalk but it was not installed on the Linux boxes at my disposal. This is how I got it working in CygWin.

Installing Cygwin

The first requirement is to have Cygwin installed. Cygwin can be download from the following Web site:

http://www.cygwin.com

You will find a a simple “Setup” program. Simply follow the instructions in the setup program to complete the install. If space is not a concern, I suggest you install the entire suite of tools. But there are certain packages which might be more relevant for this setup. These include:

  • make
  • gcc
  • openssl

Basically you want to look for and install packages necessary to compile/build binaries. If you run the “./configure” command (while installing a package from source) and it complains about missing libraries or packages you can rerun this process and add them. Then run “./configure” again.

Installing Net-SNMP

Net-SNMP is quite a safe install as well. Once you have Cygwin installed, you simply need to download the Net-SNMP source and execute a few commands from a bash shell and you will have finished.

Net-SNMP can be downloaded by following the link below:

http://www.net-snmp.org

You should download to a directory such as c:\cygwin\src\net-snmp-5.x.x. Once downloaded to that directory, open a bash shell and follow the steps below:

tar xvfz /src/net-snmp-5.x.x

cd /src/net-snmp-5.x.x
./configure
make
make install

If you haven’t done so already, you need to specify the following system environment variables:

MIBS=ALL
MIBSDIR=C:/PHP/MIBS

Test your work:
     snmpwalk -v 2c -c public [ipAddr] system
Advertisements

4 thoughts on “SNMP with CygWin

  1. I appreciate, lead to I discovered just what I was looking for.
    You’ve ended my four day lengthy hunt! God Bless you man. Have a great day. Bye

  2. Interesting comment for readers in 2013:
    “IMPORTANT NOTE FOR WINDOWS USERS: the Net-SNMP Windows binaries have been built with OpenSSL version 0.9.8r. Since the OpenSSL 0.9 and 1.0 DLLs are incompatible, any attempt to install Net-SNMP on a system where OpenSSL 1.0 has been installed will fail.”
    Cygwin comes now with OpenSSL 1.0.1e 11 Feb 2013 by default, so you’ll have to install OpenSSL 0.9 from Cygwin, if you could get it 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s