Re: Snmp proxy: how to react to 'default' context.
Dave Shield <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
On 24 June 2011 00:40, Wes Hardaker <[email protected]> wrote: > it'd be more efficient to get snmptrapd to > register under a different context. Really, we should make this > configurable instead of hard coding it Let's play Good news, Bad news. Good news: attached is a patch that attempts to handle this Bad news: it doesn't actually work :-( The config token is interpreted by 'init_snmp()', but the notification log and other MIBs are registered before this is called. Fixing this may simply be a matter of moving the init_snmp call to come earlier, but I'm not sure what else this might affect. Good news: That also applies the same context string to the other MIB objects that snmptrapd registers (USM users, Vacm config, and TLS certificates) which are currently hardcoded to the context "snmptrapd" Dave ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ 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
snmptrapd-context.diff
(text/x-patch, 2.7 KB)
Index: snmptrapd.c
===================================================================
--- snmptrapd.c (revision 20518)
+++ snmptrapd.c (working copy)
@@ -632,6 +632,9 @@
register_config_handler("snmptrapd", "doNotLogTraps",
parse_config_doNotLogTraps, NULL, "(1|yes|true|0|no|false)");
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_NOTIF_LOG_CTX, "snmptrapd");
+ netsnmp_ds_register_config(ASN_OCTET_STR, "snmptrapd", "logContext",
+ NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_NOTIF_LOG_CTX);
#if HAVE_GETPID
register_config_handler("snmptrapd", "pidFile",
parse_config_pidFile, NULL, "string");
@@ -1009,9 +1012,6 @@
#ifdef USING_NOTIFICATION_LOG_MIB_NOTIFICATION_LOG_MODULE
/* register the notification log table */
if (should_init("notificationLogMib")) {
- netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
- NETSNMP_DS_NOTIF_LOG_CTX,
- "snmptrapd");
traph = netsnmp_add_global_traphandler(NETSNMPTRAPD_POST_HANDLER,
notification_handler);
traph->authtypes = TRAP_AUTH_LOG;
@@ -1024,7 +1024,9 @@
* allows engineID probes via the master agent under the
* snmptrapd context
*/
- register_snmpEngine_scalars_context("snmptrapd");
+ register_snmpEngine_scalars_context(
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_NOTIF_LOG_CTX));
#endif
}
#endif /* USING_AGENTX_SUBAGENT_MODULE && !NETSNMP_SNMPTRAPD_DISABLE_AGENTX */
@@ -1043,14 +1045,20 @@
#endif /* NETSNMP_FEATURE_CHECKING */
extern void init_register_usmUser_context(const char *);
/* register ourselves as having a USM user database */
- init_register_usmUser_context("snmptrapd");
+ init_register_usmUser_context(
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_NOTIF_LOG_CTX));
#endif
#ifdef USING_AGENT_NSVACMACCESSTABLE_MODULE
/* register net-snmp vacm extensions */
- init_register_nsVacm_context("snmptrapd");
+ init_register_nsVacm_context(
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_NOTIF_LOG_CTX));
#endif
#ifdef USING_TLSTM_MIB_SNMPTLSTMCERTTOTSNTABLE_MODULE
- init_snmpTlstmCertToTSNTable_context("snmptrapd");
+ init_snmpTlstmCertToTSNTable_context(
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_NOTIF_LOG_CTX));
#endif
}
#endif