http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475158
snmpd: keeps complaining on missing /proc/ stats inside vserver flooding syslog
-diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp-5.4.1~dfsg.puck/agent/mibgroup/hardware/cpu/cpu_linux.c
---- net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c 2007-02-16 00:09:45.000000000 +1300
-+++ net-snmp-5.4.1~dfsg.puck/agent/mibgroup/hardware/cpu/cpu_linux.c 2009-05-04 14:35:53.000000000 +1200
-@@ -249,7 +249,7 @@
- cpu->pageOut = (unsigned long)pout;
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp-5.9/agent/mibgroup/hardware/cpu/cpu_linux.c
+--- net-snmp-5.9.org/agent/mibgroup/hardware/cpu/cpu_linux.c 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/agent/mibgroup/hardware/cpu/cpu_linux.c 2021-02-28 14:29:33.661445570 +0100
+@@ -309,7 +309,7 @@ void _cpu_load_swap_etc( char *buff, net
+ cpu->pageOut = (unsigned long long)pout;
} else {
if (first)
- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
cpu->pageIn = cpu->pageOut = 0;
}
b = strstr(buff, "swap ");
-@@ -259,7 +259,7 @@
- cpu->swapOut = (unsigned long)swpout;
+@@ -319,7 +319,7 @@ void _cpu_load_swap_etc( char *buff, net
+ cpu->swapOut = (unsigned long long)swpout;
} else {
if (first)
- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
cpu->swapIn = cpu->swapOut = 0;
}
}
-diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5.4.1~dfsg.puck/agent/mibgroup/ucd-snmp/vmstat_linux.c
---- net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c 2006-09-15 12:48:50.000000000 +1200
-+++ net-snmp-5.4.1~dfsg.puck/agent/mibgroup/ucd-snmp/vmstat_linux.c 2009-05-04 14:35:32.000000000 +1200
-@@ -316,7 +316,7 @@
- sscanf(b, "page %u %u", pin, pout);
- else {
- if (first)
-- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
-+ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE);
- *pin = *pout = 0;
- }
- b = strstr(buff, "swap ");
-@@ -324,7 +324,7 @@
- sscanf(b, "swap %u %u", swpin, swpout);
- else {
- if (first)
-- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
-+ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE);
- *swpin = *swpout = 0;
- }
- }
---- net-snmp-5.7.1/./agent/mibgroup/ucd-snmp/diskio.c~ 2011-09-28 07:53:47.000000000 +0300
-+++ net-snmp-5.7.1/./agent/mibgroup/ucd-snmp/diskio.c 2011-12-27 16:33:10.128099629 +0200
-@@ -979,7 +979,8 @@
- {
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c
+--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c 2021-02-28 14:29:33.661445570 +0100
+@@ -1367,7 +1367,8 @@ getstats(void)
+ struct stat stbuf;
FILE* parts;
time_t now;
-
now = time(NULL);
if (cache_time + CACHE_TIMEOUT > now) {
return 0;
-@@ -1024,7 +1025,11 @@
+@@ -1423,7 +1424,11 @@ getstats(void)
int rc;
parts = fopen("/proc/partitions", "r");
if (!parts) {
return 1;
}
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5.9/agent/mibgroup/ucd-snmp/vmstat_linux.c
+--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/vmstat_linux.c 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/agent/mibgroup/ucd-snmp/vmstat_linux.c 2021-02-28 14:29:33.661445570 +0100
+@@ -337,7 +337,7 @@ getstat(unsigned long *cuse, unsigned lo
+ sscanf(b, "page %u %u", pin, pout);
+ else {
+ if (first)
+- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
++ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE);
+ *pin = *pout = 0;
+ }
+ b = strstr(buff, "swap ");
+@@ -345,7 +345,7 @@ getstat(unsigned long *cuse, unsigned lo
+ sscanf(b, "swap %u %u", swpin, swpout);
+ else {
+ if (first)
+- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
++ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE);
+ *swpin = *swpout = 0;
+ }
+ }
---- net-snmp-5.4.1/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:05:07.575307614 +0300
-+++ net-snmp-5.4.1.hrmib/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:04:24.676830108 +0300
-@@ -183,6 +183,10 @@
- #define _PATH_HRSW_directory "/var/db/pkg"
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h
+--- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h 2021-02-28 14:29:14.950860864 +0100
+@@ -11,6 +11,10 @@
+ #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H
+ #define NETSNMP_ACCESS_SWINST_CONFIG_H
+
++// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now
++#define RPM_HRMIB_PATH "/var/cache/hrmib"
++
++
+ /*
+ * all platforms use this generic code
+ */
+@@ -25,7 +29,7 @@ config_exclude(host/hr_swinst)
+ config_require(host/data_access/swinst_apt)
+ #elif defined( HAVE_LIBRPM ) && defined( linux )
+ config_require(host/data_access/swinst_rpm)
+-#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
++#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
+ config_require(host/data_access/swinst_pkginfo)
+ #else
+ config_warning(This platform does not yet support hrSWInstalledTable rewrites)
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c
+--- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c 2021-02-28 14:29:14.950860864 +0100
+@@ -61,6 +61,8 @@ netsnmp_swinst_arch_init(void)
+ {
+ #if defined(PKGLOC)
+ snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC );
++#elif defined(RPM_HRMIB_PATH)
++ snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH);
+ #elif defined(hpux9)
+ snprintf( pkg_directory, SNMP_MAXPATH, "/system" );
+ #elif defined(hpux10) || defined(hpux11)
+diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c net-snmp-5.9/agent/mibgroup/host/hr_swinst.c
+--- net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.640851176 +0100
++++ net-snmp-5.9/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.950860864 +0100
+@@ -196,6 +196,10 @@ oid hrswinst_variables_oid[]
+ #define _PATH_HRSW_directory "/var/cache/hrmib"
#endif
+#if defined(RPM_HRMIB_PATH)
void
init_hr_swinst(void)
{
---- net-snmp-5.8/configure.d/config_os_libs1.orig 2018-08-25 22:50:35.841023154 +0200
-+++ net-snmp-5.8/configure.d/config_os_libs1 2018-08-26 08:07:04.487308581 +0200
+diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_functions net-snmp-5.9/configure.d/config_os_functions
+--- net-snmp-5.9.org/configure.d/config_os_functions 2020-08-14 23:41:47.000000000 +0200
++++ net-snmp-5.9/configure.d/config_os_functions 2021-02-28 14:29:14.950860864 +0100
+@@ -188,15 +188,6 @@ AC_CHECK_FUNCS([if_freenameindex
+ # (Agent)
+ ##
+
+-# rpmGetPath check needs clean LIBS environment (Linux)
+-#
+-if test "x$with_rpm" != "xno"; then
+- OLDLIBS=$LIBS
+- LIBS=$LMIBLIBS
+- AC_CHECK_FUNCS(rpmGetPath)
+- LIBS=$OLDLIBS
+-fi
+-
+ # statfs( char *, struct fs_data* ) (Ultrix)
+ #
+ AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
+diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_libs1 net-snmp-5.9/configure.d/config_os_libs1
+--- net-snmp-5.9.org/configure.d/config_os_libs1 2021-02-28 14:29:14.630850863 +0100
++++ net-snmp-5.9/configure.d/config_os_libs1 2021-02-28 14:29:14.950860864 +0100
@@ -11,18 +11,33 @@
# RPM checks
#
#
# rpm libraries only needed for the host resources mib software
-@@ -46,6 +61,12 @@
+@@ -46,6 +61,12 @@ if test "x$with_rpm" != "xno"; then
NETSNMP_SEARCH_LIBS(headerGet,, [
AC_DEFINE(HAVE_HEADERGET, 1,
[Define to 1 if you have the headerGet function.])],, $LMIBLIBS)
fi
#
---- net-snmp-5.5/configure.d/config_os_functions~ 2009-07-26 20:20:55.000000000 +0200
-+++ net-snmp-5.5/configure.d/config_os_functions 2010-05-12 14:35:39.421276242 +0200
-@@ -114,15 +114,6 @@
- # (Agent)
- ##
-
--# rpmGetPath check needs clean LIBS environment (Linux)
--#
--if test "x$with_rpm" != "xno"; then
-- OLDLIBS=$LIBS
-- LIBS=$LMIBLIBS
-- AC_CHECK_FUNCS(rpmGetPath)
-- LIBS=$OLDLIBS
--fi
--
- # statfs( char *, struct fs_data* ) (Ultrix)
- #
- AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
---- net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c~ 2010-01-26 23:24:14.000000000 +0200
-+++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c 2010-12-16 00:13:22.027247692 +0200
-@@ -52,6 +52,8 @@
- {
- #if defined(PKGLOC)
- snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC );
-+#elif defined(RPM_HRMIB_PATH)
-+ snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH);
- #elif defined(hpux9)
- snprintf( pkg_directory, SNMP_MAXPATH, "/system" );
- #elif defined(hpux10) || defined(hpux11)
---- net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 00:14:13.634392176 +0200
-+++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 01:27:48.195543278 +0200
-@@ -11,6 +11,10 @@
- #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H
- #define NETSNMP_ACCESS_SWINST_CONFIG_H
-
-+// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now
-+#define RPM_HRMIB_PATH "/var/cache/hrmib"
-+
-+
- /*
- * all platforms use this generic code
- */
-@@ -29,7 +29,7 @@
- config_require(host/data_access/swinst_apt)
- #elif defined( HAVE_LIBRPM ) && defined( linux )
- config_require(host/data_access/swinst_rpm)
--#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
-+#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
- config_require(host/data_access/swinst_pkginfo)
- #else
- config_warning(This platform does not yet support hrSWInstalledTable rewrites)