Error log is written twice when processing /proc/mtab and calling statfs() for 
each line in it. It stumbles upon this line:

proc net:[4026532288] proc rw,nosuid,nodev,noexec,relatime 0 0

Looking into the code, "Cannot statfs %s" is logged with "error" level. snmpd 
should log the error only once. 

See https://sourceforge.net/p/net-snmp/bugs/2870/
---
diff -urNp old/agent/mibgroup/hardware/fsys/fsys_mntctl.c 
new/agent/mibgroup/hardware/fsys/fsys_mntctl.c
--- old/agent/mibgroup/hardware/fsys/fsys_mntctl.c      2017-10-11 
14:54:48.111065174 +0200
+++ new/agent/mibgroup/hardware/fsys/fsys_mntctl.c      2017-10-11 
15:11:16.996918197 +0200
@@ -88,7 +88,6 @@ netsnmp_fsys_arch_load( void )
     char          *path;
     struct statfs  stat_buf;
     netsnmp_fsys_info *entry;
-    char               tmpbuf[1024];
 
     /*
      * Retrieve information about the currently mounted filesystems...
@@ -160,8 +159,7 @@ netsnmp_fsys_arch_load( void )
             continue;
 
         if ( statfs( entry->path, &stat_buf ) < 0 ) {
-            snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s\n", 
entry->path );
-            snmp_log_perror( tmpbuf );
+            NETSNMP_LOGONCE(( LOG_ERROR, "Cannot statfs %s\n", entry->path ));
             continue;
         }
         entry->units =  stat_buf.f_bsize;
---

Josef Ridky
Associate Software Engineer
Core Services Team
Red Hat Czech, s.r.o.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to