summaryrefslogtreecommitdiffstats
path: root/src/libs/zbxsysinfo/unknown
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-02 08:19:51 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-02 08:19:51 +0000
commit2c59896c6a430206f761bed2d35714deb9b890af (patch)
tree69eeb52e662027ab42b9aeb580df2042605d4f97 /src/libs/zbxsysinfo/unknown
parentb23f31b53d6c88c31e6142f9a21d3815a580114c (diff)
downloadzabbix-2c59896c6a430206f761bed2d35714deb9b890af.tar.gz
zabbix-2c59896c6a430206f761bed2d35714deb9b890af.tar.xz
zabbix-2c59896c6a430206f761bed2d35714deb9b890af.zip
- added kernel.c and net.c for all platforms (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2242 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxsysinfo/unknown')
-rw-r--r--src/libs/zbxsysinfo/unknown/Makefile.am2
-rw-r--r--src/libs/zbxsysinfo/unknown/kernel.c116
-rw-r--r--src/libs/zbxsysinfo/unknown/net.c44
3 files changed, 161 insertions, 1 deletions
diff --git a/src/libs/zbxsysinfo/unknown/Makefile.am b/src/libs/zbxsysinfo/unknown/Makefile.am
index 4e57c84f..94393287 100644
--- a/src/libs/zbxsysinfo/unknown/Makefile.am
+++ b/src/libs/zbxsysinfo/unknown/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS=
-libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c
+libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c
lib_LIBRARIES=libzbxsysinfo2.a
libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a
diff --git a/src/libs/zbxsysinfo/unknown/kernel.c b/src/libs/zbxsysinfo/unknown/kernel.c
new file mode 100644
index 00000000..14157f22
--- /dev/null
+++ b/src/libs/zbxsysinfo/unknown/kernel.c
@@ -0,0 +1,116 @@
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+
+#include "config.h"
+
+#include "common.h"
+#include "sysinfo.h"
+
+int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES
+ int mib[2],len;
+ int maxfiles;
+
+ assert(result);
+
+ clean_result(result);
+
+ mib[0]=CTL_KERN;
+ mib[1]=KERN_MAXFILES;
+
+ len=sizeof(maxfiles);
+
+ if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0)
+ {
+ return SYSINFO_RET_FAIL;
+ }
+
+ result->type |= AR_DOUBLE;
+ result->dbl = (double)(maxfiles);
+ return SYSINFO_RET_OK;
+#else
+ return SYSINFO_RET_FAIL;
+#endif
+}
+
+int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC
+ int mib[2],len;
+ int maxproc;
+
+ assert(result);
+
+ clean_result(result);
+
+ mib[0]=CTL_KERN;
+ mib[1]=KERN_MAXPROC;
+
+ len=sizeof(maxproc);
+
+ if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0)
+ {
+ return SYSINFO_RET_FAIL;
+/* printf("Errno [%m]");*/
+ }
+
+ result->type |= AR_DOUBLE;
+ result->dbl = (double)(maxproc);
+ return SYSINFO_RET_OK;
+#else
+ return SYSINFO_RET_FAIL;
+#endif
+}
+
+int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+ char key[MAX_STRING_LEN];
+ int ret;
+
+ assert(result);
+
+ clean_result(result);
+
+ if(num_param(param) > 1)
+ {
+ return SYSINFO_RET_FAIL;
+ }
+
+ if(get_param(param, 1, key, MAX_STRING_LEN) != 0)
+ {
+ return SYSINFO_RET_FAIL;
+ }
+
+ if(strcmp(key,"maxfiles") == 0)
+ {
+ ret = KERNEL_MAXFILES(cmd, param, flags, result);
+ }
+ else if(strcmp(key,"maxproc") == 0)
+ {
+ ret = KERNEL_MAXPROC(cmd, param, flags, result);
+ }
+ else
+ {
+ ret = SYSINFO_RET_FAIL;
+ }
+
+ return ret;
+}
+
diff --git a/src/libs/zbxsysinfo/unknown/net.c b/src/libs/zbxsysinfo/unknown/net.c
new file mode 100644
index 00000000..49867845
--- /dev/null
+++ b/src/libs/zbxsysinfo/unknown/net.c
@@ -0,0 +1,44 @@
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+
+#include "config.h"
+
+#include "common.h"
+#include "sysinfo.h"
+
+int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+
+ assert(result);
+
+ clean_result(result);
+
+ return SYSINFO_RET_FAIL;
+}
+
+int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+
+ assert(result);
+
+ clean_result(result);
+
+ return SYSINFO_RET_FAIL;
+}
+