Re: can't get linkUpDownNotifications working

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Mon, 2006-03-13 at 09:56 +0100, H. McManus wrote:
> I'm trying to get linkUpDownNotifications to work without much success.

OK - I've now managed to find the time to have a look at this,
and put together a patch that seems to address the problem.
It's still a little rough around the edges (and there's still
the question of -S vs -s behaviour), but it seems to do the trick.

The relevant code changes have been applied to the CVS code,
and I'll append the patch for you to have a play with.
Let me know how you get on.

Dave

PS:  If you have any further questions about the DisMan stuff,
     it's probably worth asking them on the -coders list.
     I'm about to unsubscribe from the -users list for a while,
     due to pressure of work, so won't see anything raised there.
mteTriggerConf.diff (text/x-patch, 3.2 KB)
--- mteTriggerConf.c.cln	2006-03-13 22:38:44.000000000 +0000
+++ mteTriggerConf.c	2006-03-13 22:45:48.000000000 +0000
@@ -558,7 +558,10 @@
              * ... and the specified event...
              */
             memset(entry->mteTExEvOwner,  0,     MTE_STR1_LEN+1);
-            memcpy(entry->mteTExEvOwner,  "snmpd.conf",      10);
+            if ( ename[0] == '_' )
+                memcpy(entry->mteTExEvOwner,  "_snmpd",       6);
+            else
+                memcpy(entry->mteTExEvOwner,  "snmpd.conf",  10);
             memcpy(entry->mteTExEvent,    ename, MTE_STR1_LEN+1);
         } else {
             /*
@@ -588,7 +591,10 @@
              * ... and the specified event...
              */
             memset(entry->mteTBoolEvOwner,  0,     MTE_STR1_LEN+1);
-            memcpy(entry->mteTBoolEvOwner,  "snmpd.conf",      10);
+            if ( ename[0] == '_' )
+                memcpy(entry->mteTBoolEvOwner,  "_snmpd",       6);
+            else
+                memcpy(entry->mteTBoolEvOwner,  "snmpd.conf",  10);
             memcpy(entry->mteTBoolEvent,    ename, MTE_STR1_LEN+1);
         } else {
             /*
@@ -621,10 +627,16 @@
                  *  (using the same event for all triggers)
                  */
                 memset(entry->mteTThRiseOwner,  0,     MTE_STR1_LEN+1);
-                memcpy(entry->mteTThRiseOwner,  "snmpd.conf",      10);
+                if ( ename[0] == '_' )
+                    memcpy(entry->mteTThRiseOwner,  "_snmpd",       6);
+                else
+                    memcpy(entry->mteTThRiseOwner,  "snmpd.conf",  10);
                 memcpy(entry->mteTThRiseEvent,  ename, MTE_STR1_LEN+1);
                 memset(entry->mteTThFallOwner,  0,     MTE_STR1_LEN+1);
-                memcpy(entry->mteTThFallOwner,  "snmpd.conf",      10);
+                if ( ename[0] == '_' )
+                    memcpy(entry->mteTThFallOwner,  "_snmpd",       6);
+                else
+                    memcpy(entry->mteTThFallOwner,  "snmpd.conf",  10);
                 memcpy(entry->mteTThFallEvent,  ename, MTE_STR1_LEN+1);
             } else {
                 /*
@@ -663,10 +675,16 @@
              */
             if ( ename[0] ) {
                 memset(entry->mteTThDRiseOwner,  0,     MTE_STR1_LEN+1);
-                memcpy(entry->mteTThDRiseOwner,  "snmpd.conf",      10);
+                if ( ename[0] == '_' )
+                    memcpy(entry->mteTThDRiseOwner,  "_snmpd",       6);
+                else
+                    memcpy(entry->mteTThDRiseOwner,  "snmpd.conf",  10);
                 memcpy(entry->mteTThDRiseEvent,  ename, MTE_STR1_LEN+1);
                 memset(entry->mteTThDFallOwner,  0,     MTE_STR1_LEN+1);
-                memcpy(entry->mteTThDFallOwner,  "snmpd.conf",      10);
+                if ( ename[0] == '_' )
+                    memcpy(entry->mteTThDFallOwner,  "_snmpd",       6);
+                else
+                    memcpy(entry->mteTThDFallOwner,  "snmpd.conf",  10);
                 memcpy(entry->mteTThDFallEvent,  ename, MTE_STR1_LEN+1);
             } else {
                 memset(entry->mteTThDRiseOwner,  0,     MTE_STR1_LEN+1);
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.