Re: traps registration
"Alexander Bubnov" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi again! I have found out the right way! To see my object correctly I need to refer my mib file through MIBS environment variable or -m flag at snmpd startup. One more question please is it possible to register mib file using NET-SNMP API? 2008/9/11 Alexander Bubnov <[email protected]> > Hello! > I would like to register MIB named AVPROOT. It includes some notification > definitions > AVPROOT = 1,3,6,1,3,9999 > > ... > > notificator NOTIFICATION-TYPE > OBJECTS { f19 } > STATUS current > DESCRIPTION > "" > ::= { AVPROOT 1 } > > f19 OBJECT-TYPE > SYNTAX DateAndTime > MAX-ACCESS accessible-for-notify > STATUS current > DESCRIPTION > "datetime" > ::= { AVPROOT 22 } > > > ... > > here is the code to register: > > struct variable2 example_variables[] = { > {22, ASN_OCTET_STR, RONLY, NULL, 1, {22}} > }; > > oid f19_oid[] = {1,3,6,1,3,9999,22}; > const size_t f19_oid_length = OID_LENGTH(f19_oid); > > void > init_dateandtime_notification(void) > { > > oid example_variables_oid[] = {1,3,6,1,3,9999}; > > /* fist way */ > netsnmp_handler_registration *reg; > reg = > netsnmp_create_handler_registration("AVPROOT",NULL,f19_oid,f19_oid_length,HANDLER_CAN_RONLY); > netsnmp_register_handler(reg); > > /* second way */ > REGISTER_MIB("events", example_variables, variable2, > example_variables_oid); > > > snmp_alarm_register(5, > SA_REPEAT, > send_example_notification, > NULL > ); > } > > void > send_example_notification(unsigned int clientreg, void *clientarg) > { > ... > snmp_varlist_add_variable(¬ification_vars, > objid_snmptrap, objid_snmptrap_len, > ASN_OBJECT_ID, > (u_char *) notification_oid, > notification_oid_len * sizeof(oid)); > > snmp_varlist_add_variable( > ¬ification_vars, > f19_oid, > f19_oid_length, > ASN_OCTET_STR, > (const u_char *) f19_value, > f19_value_length > ); > ... > > > Can you please point right direction to see dateandtime type? > > Thanks in advance. > > -- > /BR, Alexander > -- /BR, Alexander ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users