Skip to main content

SNMP Agent Simulator

Project description

SNMP Agent Simulator

This tool allows you to take the output of an snmpwalk command and then pretend to be the agent that it was gathered from. This can be useful when you’re developing SNMP management tools.

Requirements

Twisted, TwistedSNMP and PySNMP-SE.

Twisted is available from PyPI and will be automatically installed if you go the route of easy_install or pip. TwistedSNMP and PySNMP-SE are not currently available from PyPI and should be individually downloaded from sourceforge and installed from source.

Installation

I recommend installing snmposter within a Python virtualenv. This makes it easier to install on operating systems such as CentOS 5 where the default system Python version is older than 2.5. Due to the dependency on Twisted, snmposter requires Python 2.5 or newer.

The following steps are specific to Red Hat Enterprise Linux 5 or one of its binary compatible distributions such as CentOS.

  1. Install the EPEL repository.

    rpm -ivh http://mirror.cogentco.com/pub/linux/epel/5/i386/epel-release-5-4.noarch.rpm
    
  2. Install Python 2.6 and development tools.

    yum -y --enablerepo=epel install python26-devel gcc
    
  1. Install, setup and activate virtualenv.

    yum -y --enablerepo=epel install python26-virtualenv
    virtualenv-2.6 /snmposter
    source /snmposter/bin/activate
    
  2. Install TwistedSNMP dependency.

    wget http://downloads.sourceforge.net/project/twistedsnmp/twistedsnmp/0.3.13/TwistedSNMP-0.3.13.tar.gz
    tar -xzf TwistedSNMP-0.3.13.tar.gz
    cd TwistedSNMP-0.3.13
    python setup.py install
    cd ..
    
  3. Install PySNMP-SE dependency.

    wget http://downloads.sourceforge.net/project/twistedsnmp/pysnmp-se/3.5.2/pysnmp-se-3.5.2.tar.gz
    tar -xzf pysnmp-se-3.5.2.tar.gz
    cd pysnmp-se-3.5.2
    python setup.py install
    cd ..
    
  4. Install snmposter.

    pip install snmposter
    

Usage

Installing will create a command line tool called snmposter. This tool requires root access because it listens on 161/udp and creates loopback aliases to support emulating multiple SNMP agents simultaneously.

The snmposter command takes a single command line argument: -f or –file. The file passed to this option must contain one or more rows with two columns each. The first column should be the absolute or relative path to a file containing the output of an snmpwalk command. The second column should contain an IP address that this snmpwalk data will be exposed on.

Example usage:

source /snmposter/bin/activate
snmposter -f /etc/snmposter/agents.csv

Example contents of /etc/snmposter/agents.csv:

/etc/snmposter/agents/Cisco_2811.snmpwalk,127.0.1.11
/etc/snmposter/agents/NetApp_Filer_FAS3020.snmpwalk,127.0.1.12

This example usage will cause snmposter to run in the background, create two new IP aliases on the loopback interface (127.0.1.11 and 127.0.1.12), and expose the contents of each snmpwalk file as an SNMP agent on UDP port 161 of the appropriate IP address. If you’re going to be using this frequently I would recommend adding some entries to your /etc/hosts file to make it even easier.

Example additions to /etc/hosts:

127.0.1.11      cisco-2811
127.0.1.12      netapp-filer-fa3020

Important Note: The snmpwalk output file that snmposter consumes must be generated with very specific snmpwalk command line options. These options allow snmposter to get the most raw data possible and provides the most accurate simulation.

Example snmpwalk command to generate the above Cisco_2811.snmpwalk file:

snmpwalk -v2c -c public -ObentU localhost .1 > Cisco_2811.snmpwalk

The important command line options are -m none -O enU to get the raw output and ‘-C c’ to ignore out of sequence responses from the switch. (Sometimes this validation error is triggered when walking routing MIBS on some switches)

Don’t worry if you get an error like Cannot find module (none): At line 0 in (none) as this is expected and a result of us trying to load a non-existent MIB.

Project details


Release history Release notifications

History Node

1.0.4

This version
History Node

1.0.3

History Node

1.0.2

History Node

1.0.1dev

History Node

1.0.0dev

History Node

0.9.11dev

History Node

0.9.10dev

History Node

0.9.9dev

History Node

0.9.8dev

History Node

0.9.7dev

History Node

0.9.6dev

History Node

0.9.5dev

History Node

0.9.4dev

History Node

0.9.3dev

History Node

0.9.2dev

History Node

0.9.1dev

History Node

0.9dev

History Node

0.8dev

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
snmposter-1.0.3.tar.gz (5.8 kB) Copy SHA256 hash SHA256 Source None Feb 6, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page