Zabbix: import 2.2.2 from packages

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>
This commit is contained in:
Etienne CHAMPETIER
2014-06-04 00:13:16 +02:00
parent bf78697adf
commit 99dcd289e4
10 changed files with 591 additions and 0 deletions
@@ -0,0 +1,29 @@
--- a/configure.ac
+++ b/configure.ac
@@ -805,25 +805,8 @@ dnl ************************************
dnl Check for %qu format (FreeBSD 4.x)
dnl FreeBSD 4.x does not support %llu
-AC_MSG_CHECKING(for long long format)
-AC_TRY_RUN(
-[
-#include <sys/types.h>
-int main()
-{
- uint64_t i;
-
- sscanf("200000000010020", "%qu", &i);
-
- if (i == 200000000010020) return 0;
- else return -1;
-}
-],
-AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.])
-AC_MSG_RESULT(yes),
-AC_MSG_RESULT(no))
-
dnl option -rdynamic is needed for readable backtraces
+
AC_MSG_CHECKING(for -rdynamic linking option)
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="-rdynamic $LDFLAGS"
@@ -0,0 +1,35 @@
--- a/configure.ac
+++ b/configure.ac
@@ -152,6 +152,10 @@ if test "x$found_resolv" != "xyes"; then
AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
fi
LIBS="${LIBS} ${RESOLV_LIBS}"
+AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
+AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
+AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
+AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
dnl *****************************************************************
dnl * *
--- a/src/libs/zbxsysinfo/common/net.c
+++ b/src/libs/zbxsysinfo/common/net.c
@@ -424,6 +424,7 @@ static int dns_query(AGENT_REQUEST *requ
if (-1 == res_init()) /* initialize always, settings might have changed */
return SYSINFO_RET_FAIL;
+#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND)
if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
return SYSINFO_RET_FAIL;
@@ -448,6 +449,11 @@ static int dns_query(AGENT_REQUEST *requ
_res.retry = retry;
res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
+#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */
+ /* retrand and retry are ignored */
+ if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer))))
+ return SYSINFO_RET_FAIL;
+#endif
_res.retrans = saved_retrans;
_res.retry = saved_retry;
@@ -0,0 +1,48 @@
--- a/src/libs/zbxsysinfo/linux/cpu.c
+++ b/src/libs/zbxsysinfo/linux/cpu.c
@@ -21,6 +21,45 @@
#include "sysinfo.h"
#include "stats.h"
+
+/* uclibc and dietlibc do not have this junk -ReneR */
+#if defined (__UCLIBC__) || defined (__dietlibc__)
+static int getloadavg (double loadavg[], int nelem)
+{
+ int fd;
+
+ fd = open ("/proc/loadavg", O_RDONLY);
+ if (fd < 0)
+ return -1;
+ else
+ {
+ char buf[65], *p;
+ ssize_t nread;
+ int i;
+
+ nread = read (fd, buf, sizeof buf - 1);
+ close (fd);
+ if (nread <= 0)
+ return -1;
+ buf[nread - 1] = '\0';
+
+ if (nelem > 3)
+ nelem = 3;
+ p = buf;
+ for (i = 0; i < nelem; ++i)
+ {
+ char *endp;
+ loadavg[i] = strtod (p, &endp);
+ if (endp == p)
+ return -1;
+ p = endp;
+ }
+
+ return i;
+ }
+}
+#endif
+
int SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
{
char *type;
@@ -0,0 +1,61 @@
--- a/conf/zabbix_agentd.conf
+++ b/conf/zabbix_agentd.conf
@@ -3,12 +3,8 @@
############ GENERAL PARAMETERS #################
-### Option: PidFile
-# Name of PID file.
-#
-# Mandatory: no
-# Default:
-# PidFile=/tmp/zabbix_agentd.pid
+# Only /var/run/zabbix_agentd.pid supported
+PidFile=/var/run/zabbix_agentd.pid
### Option: LogFile
# Name of log file.
@@ -18,8 +14,6 @@
# Default:
# LogFile=
-LogFile=/tmp/zabbix_agentd.log
-
### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
@@ -104,6 +98,7 @@ Server=127.0.0.1
# Range: 0-100
# Default:
# StartAgents=3
+StartAgents=1
##### Active checks related
@@ -119,8 +114,6 @@ Server=127.0.0.1
# Default:
# ServerActive=
-ServerActive=127.0.0.1
-
### Option: Hostname
# Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server.
@@ -130,8 +123,6 @@ ServerActive=127.0.0.1
# Default:
# Hostname=
-Hostname=Zabbix server
-
### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
# Does not support UserParameters or aliases.
@@ -240,7 +231,7 @@ Hostname=Zabbix server
# Include=
# Include=/usr/local/etc/zabbix_agentd.userparams.conf
-# Include=/usr/local/etc/zabbix_agentd.conf.d/
+Include=/etc/zabbix_agentd.conf.d/
####### USER-DEFINED MONITORED PARAMETERS #######