]> git.pld-linux.org Git - packages/net-snmp.git/blame - net-snmp-logging.patch
rebuild with perl 5.32
[packages/net-snmp.git] / net-snmp-logging.patch
CommitLineData
0b08da3b
ER
1http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475158
2snmpd: keeps complaining on missing /proc/ stats inside vserver flooding syslog
3
aa008d13
AM
4diff -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
5--- net-snmp-5.9.org/agent/mibgroup/hardware/cpu/cpu_linux.c 2020-08-14 23:41:47.000000000 +0200
6+++ net-snmp-5.9/agent/mibgroup/hardware/cpu/cpu_linux.c 2021-02-28 14:29:33.661445570 +0100
7@@ -309,7 +309,7 @@ void _cpu_load_swap_etc( char *buff, net
8 cpu->pageOut = (unsigned long long)pout;
0b08da3b
ER
9 } else {
10 if (first)
11- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
12+ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE);
13 cpu->pageIn = cpu->pageOut = 0;
14 }
15 b = strstr(buff, "swap ");
aa008d13
AM
16@@ -319,7 +319,7 @@ void _cpu_load_swap_etc( char *buff, net
17 cpu->swapOut = (unsigned long long)swpout;
0b08da3b
ER
18 } else {
19 if (first)
20- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
21+ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE);
22 cpu->swapIn = cpu->swapOut = 0;
23 }
24 }
aa008d13
AM
25diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c
26--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c 2020-08-14 23:41:47.000000000 +0200
27+++ net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c 2021-02-28 14:29:33.661445570 +0100
28@@ -1367,7 +1367,8 @@ getstats(void)
29 struct stat stbuf;
61bd956b
ER
30 FILE* parts;
31 time_t now;
32-
33+ static int first = 1;
34+
35 now = time(NULL);
36 if (cache_time + CACHE_TIMEOUT > now) {
37 return 0;
aa008d13 38@@ -1423,7 +1424,11 @@ getstats(void)
61bd956b
ER
39 int rc;
40 parts = fopen("/proc/partitions", "r");
41 if (!parts) {
42- snmp_log_perror("/proc/partitions");
43+ if (first) {
44+ // log error only once
45+ snmp_log_perror("/proc/partitions");
46+ first = 0;
47+ }
48 return 1;
49 }
50
aa008d13
AM
51diff -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
52--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/vmstat_linux.c 2020-08-14 23:41:47.000000000 +0200
53+++ net-snmp-5.9/agent/mibgroup/ucd-snmp/vmstat_linux.c 2021-02-28 14:29:33.661445570 +0100
54@@ -337,7 +337,7 @@ getstat(unsigned long *cuse, unsigned lo
55 sscanf(b, "page %u %u", pin, pout);
56 else {
57 if (first)
58- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
59+ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE);
60 *pin = *pout = 0;
61 }
62 b = strstr(buff, "swap ");
63@@ -345,7 +345,7 @@ getstat(unsigned long *cuse, unsigned lo
64 sscanf(b, "swap %u %u", swpin, swpout);
65 else {
66 if (first)
67- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
68+ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE);
69 *swpin = *swpout = 0;
70 }
71 }
This page took 0.04348 seconds and 4 git commands to generate.