[patch] to register the notification log MIB at default context

Claus Klein <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi,

I want to have the notificationLogMib module at snmpd without a  
running snmptrapd.

I changed the following files to get this table back to the snmpd  
master agent.
I is till possible to start the snmptrapd with -x option (with  
register the same MIB) at snmptrapd context.

It is based on net-snmp V5.5.

//regards

Claus

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev

_______________________________________________
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
notification_log.diff (application/octet-stream, 2.6 KB)
--- ./agent/mibgroup/notification/snmpNotifyTable.c.orig	2010-05-21 21:41:20.000000000 +0200
+++ ./agent/mibgroup/notification/snmpNotifyTable.c.ck	2010-05-19 14:01:01.000000000 +0200
@@ -56,6 +56,16 @@
 oid             snmpNotifyTable_variables_oid[] =
     { 1, 3, 6, 1, 6, 3, 13, 1, 1 };
 
+// FIXME: added; ck
+#include "net-snmp/agent/sysORTable.h"
+static oid      snmpNotifyFullCompliance[] = { SNMP_OID_SNMPMODULES, 13, 3, 1, 3 }; // snmpNotificationMIB.3.1.3
+
+// FIXME: added but not used! ; ck
+static void shutdown_snmpNotifyTable(void)
+{
+    UNREGISTER_SYSOR_ENTRY(snmpNotifyFullCompliance);
+}
+
 
 /*
  * variable2 snmpNotifyTable_variables:
@@ -467,6 +477,10 @@
      * place any other initialization junk you need here 
      */
 
+    // FIXME: added; ck
+    REGISTER_SYSOR_ENTRY(snmpNotifyFullCompliance,
+                 "The MIB modules for managing SNMP Notification, "
+                 "plus filtering and all related tables");
 
     DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
 }
--- ./agent/mibgroup/notification-log-mib/notification_log.c.orig	2010-05-21 21:42:33.000000000 +0200
+++ ./agent/mibgroup/notification-log-mib/notification_log.c.ck	2010-08-06 21:18:33.000000000 +0200
@@ -57,6 +57,10 @@
 static netsnmp_table_data_set *nlmLogTable;
 static netsnmp_table_data_set *nlmLogVarTable;
 
+// FIXME: added; ck
+#include "net-snmp/agent/sysORTable.h"
+static oid      nlm_module_oid[] = { SNMP_OID_MIB2, 92 };
+
 static void
 netsnmp_notif_log_remove_oldest(int count)
 {
@@ -557,6 +561,9 @@
                                NETSNMP_DS_APPLICATION_ID,
                                NETSNMP_DS_AGENT_NOTIF_LOG_MAX);
 #endif
+
+// FIXME: added; ck
+    REGISTER_SYSOR_ENTRY(nlm_module_oid, "The MIB module for logging SNMP Notifications, that is, Traps and Informs");
 }
 
 void
@@ -564,6 +571,9 @@
 {
     max_logged = 0;
     check_log_size(0, NULL);
+
+// FIXME: added; ck
+    UNREGISTER_SYSOR_ENTRY(nlm_module_oid);
 }
 
 void
--- ./agent/snmpd.c.orig	2010-05-21 21:38:46.000000000 +0200
+++ ./agent/snmpd.c	2010-05-21 21:39:15.000000000 +0200
@@ -910,6 +910,16 @@
 
     SOCK_STARTUP;
     init_agent(app_name);        /* do what we need to do first. */
+
+//FIXME: added ck
+#ifdef USING_NOTIFICATION_LOG_MIB_NOTIFICATION_LOG_MODULE
+        /* register the notification log table at default context */
+        if (should_init("notificationLogMib")) {
+            netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_NOTIF_LOG_CTX, "");
+            //XXX called from init_mib_modules(); see agent/mibgroup/mib_module_inits.h  init_notification_log();
+        }
+#endif
+
     init_mib_modules();
 
     /*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.