SNMPPD (SNMP Proxy Daemon) 0.5 README ------------------------------------- This version is a complete rewrite of my snmppd 0.4. Now it is multithreaded, uses config file, runs as unprivileged user and much more. snmppd 0.5 is quite stable, at least personally I use latest beta for several weeks without any problems (I restarted it only once to load new MIBs). As earlier, main function of snmppd is to be intermediate layer between Nagios(tm) and monitored SNMP agents, not to be _real_ SNMP proxy (As I understand, net-snmp itself can act as a proxy in such cases). Snmppd allows to reduce load of monitoring host when large amount of snmp checks executed as it reduces overhead needed to check_snmp to load MIBs. Snmppd comes with modified version of check_snmp (check_snmpp), which works as a client application. check_snmpp should be a drop-in replacement for check_snmp, but it does not support perfomance support yet, as I do not use it. HOW IT WORKS ------------ Snmppd loads all MIBs from net-snmp mibs directory on startup, then spawns configurable number of threads, and waits on TCP socket for requests. For security reasons I hardcoded loopback address (127.0.0.1) for listen, but this may be easily changed in sources. Anyway, it should be quite secure as it drops privileges after start. Snmppd wait for request in form [KEEPALIVE] is one of GET, GETNEXT. is either IP address or hostname of monitored host. is SNMPv1 community (snmppd support only this version right now). is a space-separated list of OIDs to get from host. Example session: [root@nms /]# telnet localhost 164 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. KEEPALIVE GET localhost public sysDescr.0 system.sysDescr.0 = Linux localhost.localdomain 2.4.21-27.ELsmp #1 SMP Mon Jan 24 14:53:13 EET 2005 i686 QUIT GOOD BYE Connection closed by foreign host. [root@nms /]# telnet localhost 164 Trying 127.0.0.1... KEEPALIVE GET localhost public sysDescr.0 sysLocation.0 system.sysDescr.0 = Linux localhost.localdomain 2.4.21-27.ELsmp #1 SMP Mon Jan 24 14:53:13 EET 2005 i686 system.sysLocation.0 = here KEEPALIVE GETNEXT localhost public sysDescr.0 system.sysObjectID.0 = enterprises.netSnmp.netSnmpEnumerations.netSnmpAgentOIDs.linux KEEPALIVE GET localhost public unknownOID.0 ERROR GET localhost public sysDescr.0 system.sysDescr.0 = Linux localhost.localdomain 2.4.21-27.ELsmp #1 SMP Mon Jan 24 14:53:13 EET 2005 i686 Connection closed by foreign host. [root@nms /]# I hope it is self-explaining. Check_snmpp does GET requests without keepalive. ABOUT DAEMON DESIGN ------------------- I used example published by Daniel Robbins of Gentoo somewhere at IBM alphaworks. It has clean producer-consumer model and fits perfectly (control.[ch], queue.[ch], modified threads.[ch]). I tried to use this example earlier, in 0.4 version, but didn't find the bug in queue.c near line 57 that time. I tried to write daemon without any compile-time dependencies on FD_SETSIZE, etc. It uses poll on dynamically allocated fd list, size of fd list is got from MaxThreads config parameter, so snmppd should not rely on any 'select' constraints, except if poll is realized through select. Don't set MaxThreads greater than 1024 it this case, but I do not know if it works at all. I hope snmppd should work perfectly on any modern linux distribution with greater MaxThreads value. There is no support for any other OSs for now. Snmppd allocates threads dynamically, only when there are no idle ones, and kills some of them when there are too many idle threads. This is controlled by {Min,Max}SpareThreads config parameters. Look at example config file in snmppd/snmppd.conf As always in my software, snmppd is rpm-ready, it should rebuild from tarball by issuing rpmbuild -tb snmppd-0.5.x.tar.gz REQUIREMENTS ------------ libpthread library, linux NPTL library is tested. libsplit library, get it from http://bubble.nsys.by/projects/libsplit/ net-snmp libraries and headers. native poll implementation in OS (linux has it). INSTALLATION ------------ # ./configure # make # make install Or, better, # rpmbuild -tb snmpdd-0.5.x.tar.gz # rpm -ivh /usr/src/redhat/RPMS/i386/snmpdd-0.5.x-1.i386.rpm # rpm -ivh /usr/src/redhat/RPMS/i386/snmpdd-nagios-0.5.x-1.i386.rpm Vladislav Bogdanov slava@nsys.by http://bubble.nsys.by/projects/snmppd/ Nagios is a registered trademark of Ethan Galstad. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.