Hi there!

I am about finding a way for the net-snmp-agent(snmpd) to poll a value using
a specific polling-rate. To do this i checked out the
examples/notification.c and implemented my new file (SysSessionActive.c) the
same way as shown in the notification.c file. It compiled cleanly but if i
start the snmpd on the target-hardware following message appears:

"mteTriggerTable has been disable because the callback transport is not
available."

When the polltime expired following messages are repeately(pollrate) printed
on the terminal: 

"snmpd: send_trap: Error building ASN.1 representation"

It seems that there is something missing, however i have inserted the
Callback-transport into the configure-script (--with-transports="UDP
Callback"):

=============================================
./configure \
--build=i686 \
--host=arm-elf-linux-gnu \
--target=arm-elf-linux-gnu \
[...]
--with-cflags="-I$SRCROOTDIR/common -L$SRCROOTDIR/common
-DRAS_CONFIG_DEPLOY_1 -ggdb -DNO_MM -fno-builtin -DHAVE_SETLOCALE
-march=armv4 -DNO_SHARED_LIBS=1 -O2 -static -DCONFIG_ARCH_CNXT -D__uClinux__
-Dunix -D__linux__ -Dlinux -DEMBED" \
--with-ldflags="-I$SRCROOTDIR/common -L$SRCROOTDIR/common -lcommon -ggdb
-g,-W1,-T,/usr/local/arm-elf/lib/elf2flt.d -elf2flt -static-libgcc -Bstatic
-static" \
--with-libtool=no \
--without-kmem-usage \
--disable-mib-loading \
--enable-mini-agent \
--with-transports="UDP Callback" \
--with-out-transports="UDPIPv6 TCPIPv6 TCP Unix AAL5PVC IPX" \
--with-mib-modules="mibII target notification disman/event-mib
SysTrapsNotifications" \
--with-out-mib-modules="ucd_snmp agent_mibs agentx utilities snmpv3mips" \
[...]
--disable-md5 \
--disable-des \
--disable-privacy \
--disable-applications \
=============================================

The module SysTrapsNotifications refers to the SysSessionActive.* files(.c):

=============================================
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "SysSessionActive.h"

#define POLLCYCLE 10

static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};



void init_SysSessionActive(void)
{
DEBUGMSGTL(("test notification","initializing SysSessionActive\n"));

snmp_alarm_register     (
                                POLLCYCLE, /* seconds */
                                SA_REPEAT, /* repeat every POLLCYCLE seconds */
                                send_SysSessionActive_notification, /* callback 
function */
                                NULL /* no callback data needed */
                        );
}//end init_SysSessionActive

void send_SysSessionActive_notification(unsigned int clientreg, void
*clientarg)
{
        // oid of the notification that will be sent
        oid SysSessionActive_oid[] = { 1,3,6,1,4,1,22638,3,2,5,10 };
        size_t SysSessionActive_oid_len = OID_LENGTH(SysSessionActive_oid);

        oid             objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
        size_t          objid_snmptrap_len = OID_LENGTH(objid_snmptrap);

        /**/ int rate = 100;

        // oid's that will be included in the notification

        oid eventReason_oid[] = { 1,3,6,1,4,1,22638,3,2,5,5,1,2,0 /* insert 
index
here */ };
        size_t eventReason_oid_len = OID_LENGTH(eventReason_oid);

        /* store for the variables that will be sent with the traps */
        netsnmp_variable_list *SysSessionActive_vars = NULL;

        snmp_varlist_add_variable(      &SysSessionActive_vars,
                                        objid_snmptrap, objid_snmptrap_len,
                                        ASN_OBJECT_ID,
                                        (u_char *) SysSessionActive_oid,
                                        SysSessionActive_oid_len * sizeof(oid)
                                );

        snmp_varlist_add_variable(      &SysSessionActive_vars,
                                        eventReason_oid, eventReason_oid_len,
                                        ASN_OBJECT_ID,
                                        (u_char *) &rate,
                                        sizeof(rate)
                                );


    DEBUGMSGTL(("example_notification", "sending the trap\n"));
    send_v2trap(SysSessionActive_vars);

    /*
     * free the created notification variable list
     */
    DEBUGMSGTL(("example_notification", "cleaning up\n"));
    snmp_free_varbind(SysSessionActive_vars);

}
=============================================
 
Anyone got an idea what is working wrong here? Maybe some additional modules
need to be included to enable the notifications Callback functionality?

Thx in advance,
Bernhard



-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to