packages/admin/zabbix/patches/002-uclibc_loadavg.patch
Etienne CHAMPETIER fe88e0447a zabbix: update to zabbix 3.0.1
zabbix-agent doesn't exist anymore since 3.0

'-f' option (foreground) is now in zabbix-agentd

003-change-user-and-foreground.patch fixes pending
issue https://support.zabbix.com/browse/ZBX-10611

you might need to update your config file to add
LogType=system

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
2016-04-09 17:24:17 +00:00

48 lines
917 B
Diff

--- a/src/libs/zbxsysinfo/linux/cpu.c
+++ b/src/libs/zbxsysinfo/linux/cpu.c
@@ -22,6 +22,45 @@
#include "stats.h"
#include "log.h"
+
+/* uclibc and dietlibc do not have this junk -ReneR */
+#if defined (__UCLIBC__) || defined (__dietlibc__)
+static int getloadavg (double loadavg[], int nelem)
+{
+ int fd;
+
+ fd = open ("/proc/loadavg", O_RDONLY);
+ if (fd < 0)
+ return -1;
+ else
+ {
+ char buf[65], *p;
+ ssize_t nread;
+ int i;
+
+ nread = read (fd, buf, sizeof buf - 1);
+ close (fd);
+ if (nread <= 0)
+ return -1;
+ buf[nread - 1] = '\0';
+
+ if (nelem > 3)
+ nelem = 3;
+ p = buf;
+ for (i = 0; i < nelem; ++i)
+ {
+ char *endp;
+ loadavg[i] = strtod (p, &endp);
+ if (endp == p)
+ return -1;
+ p = endp;
+ }
+
+ return i;
+ }
+}
+#endif
+
int SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
{
char *type;