Download Latest Version pysnmpfs-0.1.0.tar.gz (14.3 kB)
Email in envelope

Get an email when there's a new version of pysnmpfs

Home
Name Modified Size InfoDownloads / Week
README.md 2014-11-10 3.2 kB
pysnmpfs-0.1.0.tar.gz 2014-11-10 14.3 kB
Totals: 2 Items   17.4 kB 0

LICENSING

Copyright by Vince C.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

ABOUT

This script mounts a FUSE filesystem to retrieve SNMP data from agents. It is based on the loopback example that comes with fusepy by Terence Honles.

Syntax:

python snmpfs.py <community> [<mount_point>]

Snmpfs modules will create their respective tree and cache data in files. Access to the tree refreshes SNMP data transparently.

A cached copy is maintained in /var/cache/snmpfs with every subfolder being named with the community name the filesystem watches. Simply add a host by creating a directory with the IP address or name of the host; snmpfs will then populate it with each snmpfs module directory tree.

The cached tree will survive a reboot. Cached values are updated when queried based on the default TTL (Time To Live).

The default mount point is /run/snmp.

Monitor a host:

mkdir /run/snmp/<host_name_or_ip>

REQUIREMENTS

  • python 2.7.5+ (untested under Python 3.x)
  • fusepy 2.0 (latest version)
  • python-pysnmp4 (with recommends)
  • python-pysnmp4-mibs

INSTALLATION

  1. Unzip or install into /usr/local/bin
  2. Create a user account named snmp (can be skipped if package snmpd is installed)
  3. Create directory /var/cache/snmpfs, owner by user snmp

You may as well create the default mount point /run/snmp, owned by user snmp or use the mount point of your choice. For debugging purposes it's also a good choice to install the snmp package.

MOUNTING

  • As a service

    start-stop-daemon -S --chuid snmp \
        -b -m -p /run/snmpfs.pid -o \
        -a /usr/local/bin/snmpfs.py -- MyCommunity
    
  • Interactively

    sudo -u snmp snmpfs.py MyCommunity
    

UNMOUNTING

  • As a service

    start-stop-daemon -K -p /run/snmpfs.pid
    
  • Interactively

    fusermount -u /run/snmp
    

SNMP COMMAND LINE TOOLS

Here are some commnd line examples, for troubleshooting's sake.

  • Query a single value:

    snmpget -v2c -Ovq -c <community> <host> sysDescr.0
    
  • Query multiple values:

    snmpget -v2c -Ovq -c <community> <host> sysDescr.0 sysContact.0
    
  • Table, CSV style:

    snmptable -Cblf "," -v2c -c <community> <host> ifTable
    snmptable -Cblf "," -v2c -c <community> <host> hrStorageTable
    

ROADMAP

  • Filter with tables.
  • TODO: Host-specific plugins (use SNMPv2-MIB::sysObjectID.0)
  • TODO: SNMPFS controlling interface (FUSE memory FS)
Source: README.md, updated 2014-11-10