开发者

Best way of adding SNMP support to your own application on Debian

I am working on Debian and I have this server we want to monitor.

The application is ours and there are around a hundred real-time counters we want to export for monitoring purposes, graphs and alarms.

I've been looking at the Debian way of doing this because we do use Debian packaging to install the app, and Debian uses snmpd daemon, based on net-snmp, to export SNMP. So far every approach I've seen looks very complicated, from recompiling snmpd to load a dynamic library into it, and compiling a form of subagent that replicates what snmpd does.

While all of those options make me think I should go for something else than SNMP I don't want to give up that early an开发者_JS百科d I was wondering if anybody has found a feasible implementation.

Ideally it should be coded in C or C++ as the app is in C++, but I'm open to wrappers or other kind of suggestions.


net-snmp supports both the smux and agentx agent extension protocols, allowing sub-agents to live in different processes. They also have a tutorial on writing AgentX subagents in C.


An often overlooked solution is Agent++ API, which to me looks pretty nice and is under the Apache license. As far as I understand, you can modify that agent to answer to your own MIBs.

That said, doing a subagent isn't such a bad choice. You start the standard unpatched snmpd (from net-snmp). Then you connect to it with your subagent, which only adds those OIDs you want it to add. The net-snmp kit for coding AgentX (as the protocol is called) sub-agents is not dead simple to use, but not very hard either. There is also a Perl module for sub-agent development: https://metacpan.org/pod/NetSNMP::agent


The traditional way to do this in linux is to use the net-snmp package. Make sure you write the MIB first. Everything is based on the MIB and changes to the MIB usually results in lots of changes in the code. Coding for net-snmp is not difficult and there is lots of documentation to get you started, eg: http://www.net-snmp.org/wiki/index.php/Tutorials#Coding_Tutorials


Have you tried net-snmp?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜