How do I set up SNMPD to respond with script results?
Posted by LinuxIsFree@reddit | linuxadmin | View on Reddit | 0 comments
I have the following snmpd.conf config file:
# System Information
sysLocation My Desk
sysContact Me me@me.com
sysServices 72
# SNMPv3 user (optional)
rouser authPrivUser authpriv
# Agent Address (IPv4 and IPv6)
agentaddress 127.0.0.1,[::1]
# Views: Define accessible OIDs
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# SNMP Community Strings
rocommunity public default -V systemonly
rocommunity6 public default -V systemonly
# Include additional configuration files
includeDir /etc/snmp/snmpd.conf.d
###############################################################################
# Custom OID Mapping
###############################################################################
# Pass OID to custom script
view all included .1.3.6.1.4.1
extend .1.3.6.1.4.1.8008.1 lightlevel /usr/bin/python3 /path/to/snmp_serial_handler.py
The script /snmp_serial_handler.py
outputs a number when run, and works fine. However, when I run an snmpget: snmpget -v2c -c public localhost .1.3.6.1.4.1.8008.1
I get:
iso.3.6.1.4.1.8008.1 = No Such Object available on this agent at this OID
I've restarted snmpd when making a change. I've tried different OIDs with no luck. Anyone gotten this working?