Running a script upon OID GET

685 views Asked by At

I am trying to use NET-SNMP to run a little script and return the value returned by the script I have my snmpd.conf file configured with the extend statement: enter image description here

although when I query the device using iReasonings MIB Browser, I get this: enter image description here

I haven't done anything to the default MIBs that come with the installation of snmpd so I think that might be the culprit, I just don't know how to define the simple value that will be returned by the script.

All my shell script does is call the below python script (supply.py):

#!/usr/bin/env python

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)

if(GPIO.input(23) == 1):
    print("Button 1 pressed")
elif(GPIO.input(23) == 0):
    print("Button 1 released")

GPIO.cleanup()

So how can I make the snmpd run the script when I query the OID as defined in the extend command?

0

There are 0 answers