File | Date | Author | Commit |
---|---|---|---|
extensions | 2014-11-10 |
![]() |
[5ec1d4] First release of version 0.1.0 |
README.md | 2014-11-10 |
![]() |
[afeccf] Download button not applicable in a README!... |
plugin.py | 2014-11-10 |
![]() |
[5ec1d4] First release of version 0.1.0 |
snmp.py | 2014-11-10 |
![]() |
[5ec1d4] First release of version 0.1.0 |
snmpfs.py | 2014-11-10 |
![]() |
[5ec1d4] First release of version 0.1.0 |
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.
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>
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.
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
As a service
start-stop-daemon -K -p /run/snmpfs.pid
Interactively
fusermount -u /run/snmp
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