summaryrefslogtreecommitdiffstats
path: root/src/libs/zbxsysinfo/freebsd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/zbxsysinfo/freebsd')
-rw-r--r--src/libs/zbxsysinfo/freebsd/Makefile.am2
-rw-r--r--src/libs/zbxsysinfo/freebsd/kernel.c116
-rw-r--r--src/libs/zbxsysinfo/freebsd/net.c44
3 files changed, 161 insertions, 1 deletions
diff --git a/src/libs/zbxsysinfo/freebsd/Makefile.am b/src/libs/zbxsysinfo/freebsd/Makefile.am
index 40d55d50..94393287 100644
--- a/src/libs/zbxsysinfo/freebsd/Makefile.am
+++ b/src/libs/zbxsysinfo/freebsd/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS=
-libzbxsysinfo2_a_SOURCES=freebsd.c 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/freebsd/kernel.c b/src/libs/zbxsysinfo/freebsd/kernel.c
new file mode 100644
index 00000000..14157f22
--- /dev/null
+++ b/src/libs/zbxsysinfo/freebsd/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/freebsd/net.c b/src/libs/zbxsysinfo/freebsd/net.c
new file mode 100644
index 00000000..49867845
--- /dev/null
+++ b/src/libs/zbxsysinfo/freebsd/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;
+}
+