summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-05-29 19:22:22 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-05-29 19:22:22 +0000
commitfc925cfc3acff0cc959ef03ec2ab4a0d4956ae9f (patch)
tree55f120d494f2fa70f951b6470bf681ae9be5fe19
parent6535b76645bf0001cdbaa8dc26938cdd56940bb9 (diff)
downloadzabbix-fc925cfc3acff0cc959ef03ec2ab4a0d4956ae9f.tar.gz
zabbix-fc925cfc3acff0cc959ef03ec2ab4a0d4956ae9f.tar.xz
zabbix-fc925cfc3acff0cc959ef03ec2ab4a0d4956ae9f.zip
- support for memory[free] and memory[total] under Solaris (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@792 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog1
-rw-r--r--acconfig.h3
-rw-r--r--configure.in15
-rw-r--r--src/zabbix_agent/sysinfo.c10
-rw-r--r--src/zabbix_agent/sysinfo.h2
5 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 169e7b1d..6545ae55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes for 1.0beta10:
+ - support for memory[free] and memory[total] under Solaris (Alexei)
- fixed compilation of the agent under FreeBSD (Alexei)
Changes for 1.0beta9:
diff --git a/acconfig.h b/acconfig.h
index 52833f2a..c58d2c33 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -10,6 +10,9 @@
/* Define if file /proc/loadavg exists */
#undef HAVE_PROC_LOADAVG
+/* Define if function sysconf is in unistd.h */
+#undef HAVE_UNISTD_SYSCONF
+
/* Define if function sysctl accepts KERN_BOOTTIME */
#undef HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME
diff --git a/configure.in b/configure.in
index a64dfa8d..3af02433 100644
--- a/configure.in
+++ b/configure.in
@@ -107,6 +107,21 @@ AC_DEFINE(HAVE_SYSINFO_FREESWAP)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
+dnl Check for function sysconf in unistd.h
+AC_MSG_CHECKING(for function sysconf() in unistd.h)
+AC_TRY_COMPILE(
+[
+#include <unistd.h>
+],
+[ int i;
+
+ i=sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
+ i=sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PHYS_PAGES);
+],
+AC_DEFINE(HAVE_UNISTD_SYSCONF)
+AC_MSG_RESULT(yes),
+AC_MSG_RESULT(no))
+
dnl Check for vmtotal in sys/vmmeter.h
AC_MSG_CHECKING(for vmtotal in struct sys/vmmeter.h)
AC_TRY_COMPILE(
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index e72ca22c..7204137a 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -1196,6 +1196,10 @@ double SHAREDMEM(void)
double TOTALMEM(void)
{
+/* Solaris */
+#ifdef HAVE_UNISTD_SYSCONF
+ return (double)sysconf(_SC_PHYS_PAGES)*sysconf(_SC_PAGESIZE);
+#else
#ifdef HAVE_SYS_PSTAT_H
struct pst_static pst;
long page;
@@ -1240,10 +1244,15 @@ double TOTALMEM(void)
#endif
#endif
#endif
+#endif
}
double FREEMEM(void)
{
+/* Solaris */
+#ifdef HAVE_UNISTD_SYSCONF
+ return (double)sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE);
+#else
#ifdef HAVE_SYS_PSTAT_H
struct pst_static pst;
struct pst_dynamic dyn;
@@ -1309,6 +1318,7 @@ double FREEMEM(void)
#endif
#endif
#endif
+#endif
}
double KERNEL_MAXFILES(void)
diff --git a/src/zabbix_agent/sysinfo.h b/src/zabbix_agent/sysinfo.h
index 00e4843e..3fd3ccb8 100644
--- a/src/zabbix_agent/sysinfo.h
+++ b/src/zabbix_agent/sysinfo.h
@@ -21,7 +21,7 @@
#ifndef ZABBIX_SYSINFO_H
#define ZABBIX_SYSINFO_H
-/* #define TEST_PARAMETERS */
+#define TEST_PARAMETERS
void process(char *command, char *value);