summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent/sysinfo.c
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-04-12 15:03:02 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-04-12 15:03:02 +0000
commitd1d87fd102418669d1d9400dd5e3602b1245d278 (patch)
tree166baef577541d7b7a87f51e0d67ecfc3da5582f /src/zabbix_agent/sysinfo.c
parent37021e0847e56768cc5f8bc448ce54989b3fe706 (diff)
downloadzabbix-d1d87fd102418669d1d9400dd5e3602b1245d278.tar.gz
zabbix-d1d87fd102418669d1d9400dd5e3602b1245d278.tar.xz
zabbix-d1d87fd102418669d1d9400dd5e3602b1245d278.zip
Support for memory[total] and memory[free] for HP-UX.
git-svn-id: svn://svn.zabbix.com/trunk@39 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_agent/sysinfo.c')
-rw-r--r--src/zabbix_agent/sysinfo.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index d0ebba54..038309d6 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -17,6 +17,11 @@
#include <sys/mount.h>
#endif
+/* HP-UX */
+#ifdef HAVE_SYS_PSTAT_H
+ #include <sys/pstat.h>
+#endif
+
#include <string.h>
#include "common.h"
@@ -141,12 +146,65 @@ float SHAREDMEM(void)
float TOTALMEM(void)
{
+#ifdef HAVE_SYS_PSTAT_H
+ struct pst_static pst;
+ long page;
+
+ if(pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == -1)
+ {
+ return FAIL;
+ }
+ else
+ {
+ /* Get page size */
+ page = pst.page_size;
+ /* Total physical memory in bytes */
+ return page*pst.physical_memory;
+ }
+#else
return getPROC("/proc/meminfo",4,2);
+#endif
}
float FREEMEM(void)
{
+#ifdef HAVE_SYS_PSTAT_H
+ struct pst_static pst;
+ struct pst_dynamic dyn;
+ long page;
+
+ if(pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == -1)
+ {
+ return FAIL;
+ }
+ else
+ {
+ /* Get page size */
+ page = pst.page_size;
+// return pst.physical_memory;
+
+ if (pstat_getdynamic(&dyn, sizeof(dyn), 1, 0) == -1)
+ {
+ return FAIL;
+ }
+ else
+ {
+//cout<<"total virtual memory allocated is " << dyn.psd_vm << "
+//pages, " << dyn.psd_vm * page << " bytes" << endl;
+//cout<<"active virtual memory is " << dyn.psd_avm <<" pages, " <<
+//dyn.psd_avm * page << " bytes" << endl;
+//cout<<"total real memory is " << dyn.psd_rm << " pages, " <<
+//dyn.psd_rm * page << " bytes" << endl;
+//cout<<"active real memory is " << dyn.psd_arm << " pages, " <<
+//dyn.psd_arm * page << " bytes" << endl;
+//cout<<"free memory is " << dyn.psd_free << " pages, " <<
+ /* Free memory in bytes */
+ return dyn.psd_free * page;
+ }
+ }
+#else
return getPROC("/proc/meminfo",5,2);
+#endif
}
float UPTIME(void)