summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-10-06 18:56:23 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-10-06 18:56:23 +0000
commit2e1f29e340b9ddfd54b3f5cfea8cf33da2d7f4b7 (patch)
tree146c9d0b48db455829624f7320cf48198e240281 /src
parent50ab014807ff47ca89b66070f29b9f86b8923b6d (diff)
downloadzabbix-2e1f29e340b9ddfd54b3f5cfea8cf33da2d7f4b7.tar.gz
zabbix-2e1f29e340b9ddfd54b3f5cfea8cf33da2d7f4b7.tar.xz
zabbix-2e1f29e340b9ddfd54b3f5cfea8cf33da2d7f4b7.zip
- added support for memory[free], memory[total] and memory[shared]
for FreeBSD (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@232 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_agent/sysinfo.c53
-rw-r--r--src/zabbix_agent/zabbix_agent.c2
2 files changed, 54 insertions, 1 deletions
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index ab0ee04f..27be556b 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -1,5 +1,6 @@
#include "config.h"
+
/* For bcopy */
#ifdef HAVE_STRING_H
#include <string.h>
@@ -71,6 +72,19 @@
#include <sys/swap.h>
#endif
+/* FreeBSD */
+#ifdef HAVE_SYS_SYSCTL_H
+ #include <sys/sysctl.h>
+#endif
+/* FreeBSD */
+#ifdef HAVE_VM_VM_PARAM_H
+ #include <vm/vm_param.h>
+#endif
+/* FreeBSD */
+#ifdef HAVE_SYS_VMMETER_H
+ #include <sys/vmmeter.h>
+#endif
+
#include "common.h"
#include "sysinfo.h"
@@ -572,8 +586,21 @@ float SHAREDMEM(void)
return FAIL;
}
#else
+#ifdef HAVE_SYS_VMMETER_H
+ int mib[2],len;
+ struct vmtotal v;
+
+ len=sizeof(struct vmtotal);
+ mib[0]=CTL_VM;
+ mib[1]=VM_METER;
+
+ sysctl(mib,2,&v,&len,NULL,0);
+
+ return (float)(v.t_armshr<<2);
+#else
return FAIL;
#endif
+#endif
}
float TOTALMEM(void)
@@ -606,9 +633,22 @@ float TOTALMEM(void)
return FAIL;
}
#else
+#ifdef HAVE_SYS_VMMETER_H
+ int mib[2],len;
+ struct vmtotal v;
+
+ len=sizeof(struct vmtotal);
+ mib[0]=CTL_VM;
+ mib[1]=VM_METER;
+
+ sysctl(mib,2,&v,&len,NULL,0);
+
+ return (float)(v.t_rm<<2);
+#else
return FAIL;
#endif
#endif
+#endif
}
float FREEMEM(void)
@@ -660,9 +700,22 @@ float FREEMEM(void)
return FAIL;
}
#else
+#ifdef HAVE_SYS_VMMETER_H
+ int mib[2],len;
+ struct vmtotal v;
+
+ len=sizeof(struct vmtotal);
+ mib[0]=CTL_VM;
+ mib[1]=VM_METER;
+
+ sysctl(mib,2,&v,&len,NULL,0);
+
+ return (float)(v.t_free<<2);
+#else
return FAIL;
#endif
#endif
+#endif
}
float UPTIME(void)
diff --git a/src/zabbix_agent/zabbix_agent.c b/src/zabbix_agent/zabbix_agent.c
index 8fdde829..8aa7986b 100644
--- a/src/zabbix_agent/zabbix_agent.c
+++ b/src/zabbix_agent/zabbix_agent.c
@@ -1,4 +1,4 @@
-/*#define TEST_PARAMETERS*/
+#define TEST_PARAMETERS
#include "config.h"