aboutsummaryrefslogtreecommitdiffstats
path: root/main/zabbix/zabbix-getloadavg.patch
diff options
context:
space:
mode:
authorDuane Hughes <duanejevon@gmail.com>2010-12-06 07:22:40 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-12-06 15:48:16 +0000
commita30088cd2aef91d15628678e307e8682529c2df9 (patch)
treea0ddd69555736f34872b6035d6183f00b7b03f49 /main/zabbix/zabbix-getloadavg.patch
parent0b9cf0748b5f8df6561e1863c93150e9c260bbb0 (diff)
downloadaports-a30088cd2aef91d15628678e307e8682529c2df9.tar.bz2
aports-a30088cd2aef91d15628678e307e8682529c2df9.tar.xz
main/zabbix: moved from testing
fixes #251
Diffstat (limited to 'main/zabbix/zabbix-getloadavg.patch')
-rw-r--r--main/zabbix/zabbix-getloadavg.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/zabbix/zabbix-getloadavg.patch b/main/zabbix/zabbix-getloadavg.patch
new file mode 100644
index 0000000000..44706abeb8
--- /dev/null
+++ b/main/zabbix/zabbix-getloadavg.patch
@@ -0,0 +1,33 @@
+diff --git a/src/libs/zbxsysinfo/linux/cpu.c b/src/libs/zbxsysinfo/linux/cpu.c
+index a76e756..9f9031d 100644
+--- a/src/libs/zbxsysinfo/linux/cpu.c
++++ b/src/libs/zbxsysinfo/linux/cpu.c
+@@ -22,6 +22,28 @@
+ #include "sysinfo.h"
+ #include "stats.h"
+
++#ifndef HAVE_GETLOADAVG
++/*! \brief Alternative method of getting load avg on Linux only */
++int getloadavg(double *list, int nelem)
++{
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ list[i] = avg[i];
++ }
++
++ return res;
++}
++#endif
++
+ int SYSTEM_CPU_NUM(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+ {
+ char mode[32];