python-agentx Code
Status: Beta
Brought to you by:
phalaaxx
File | Date | Author | Commit |
---|---|---|---|
COPYING | 2010-02-09 | phalaaxx | [r1] Initial import, v0.1 |
PAX-TUTORIAL-MIB.mib | 2010-11-11 | phalaaxx | [r8] Changed interface to call main program's global... |
README | 2010-11-11 | phalaaxx | [r8] Changed interface to call main program's global... |
agentx.py | 2010-11-11 | phalaaxx | [r8] Changed interface to call main program's global... |
example.py | 2010-11-11 | phalaaxx | [r8] Changed interface to call main program's global... |
setup.py | 2010-11-11 | phalaaxx | [r8] Changed interface to call main program's global... |
Requirements: ------------- * net-snmp libraries * python with ctypes module support Installation: ------------- $ sudo python ./setup.py install or $ sudo python3 ./setup.py install Usage: ------ SNMP AgentX modules are usually supposed to collect data and serve it in SNMP requests. python-agentx module can be used to automate most of the work involved in building SNMP AgentX modules. This includes: SNMP initialization, register variables that will be served with SNMP requests, register handlers for read, write and both read/write requests, setting up time interval to interrupt module's main loop (for the purpose of updating variables), main loop routine. What follows is a demonstration program whose purpose is to show the very least steps required to write simple, yet functional AgentX module. It only registers one variable in cache for 15 seconds with a hardcoded value and serves SNMP requests forever: from agentx import AgentX # function that will be called every 15 seconds def onUpdate(ax, axd): # register variables axd.RegisterVar('paxModuleIntVarRO', 1) if __name__ == '__main__': # initialize snmp module AgentX( Name = 'module-name', #Master = True, # if we want the module to act as master agent MIBFile = '', RootOID = 'PAX-TUTORIAL-MIB::paxData', CacheInterval = 30, ) Limits: ------- This AgentX module uses ALARM signal to interrupt AgentX.Process(). This means it is not possible to use ALARM signal from within the same program that uses this agentx module. License: -------- This module is licensed under the terms of GNU GPL v3. For more details read the COPYING file.