Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>lilik-openwrt-22.03
@ -0,0 +1,243 @@ | |||
# | |||
# Copyright (C) 2006-2013 OpenWrt.org | |||
# | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=zabbix | |||
PKG_VERSION:=2.2.2 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||
PKG_SOURCE_URL:=@SF/zabbix | |||
PKG_MD5SUM:=7f680ad3ef7145840e3de5c7a0f19b7c | |||
PKG_INSTALL:=1 | |||
PKG_FIXUP:=autoreconf | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/nls.mk | |||
define Package/zabbix/Default | |||
SECTION:=admin | |||
CATEGORY:=Administration | |||
TITLE:=Zabbix | |||
URL:=http://www.zabbix.com/ | |||
SUBMENU:=zabbix | |||
MAINTAINER:=Mirko Vogt <mirko@openwrt.org> | |||
endef | |||
define Package/zabbix-agent | |||
$(call Package/zabbix/Default) | |||
TITLE+= agent | |||
endef | |||
define Package/zabbix-agentd | |||
$(call Package/zabbix/Default) | |||
TITLE+= agentd | |||
endef | |||
define Package/zabbix-extra-mac80211 | |||
$(call Package/zabbix/Default) | |||
TITLE+= discovery/userparameters for mac80211 | |||
DEPENDS += +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS | |||
endef | |||
define Package/zabbix-extra-network | |||
$(call Package/zabbix/Default) | |||
TITLE+= discovery/userparameters for network | |||
DEPENDS += +zabbix-agentd +libuci-lua +lua | |||
endef | |||
define Package/zabbix-extra-wifi | |||
$(call Package/zabbix/Default) | |||
TITLE+= discovery/userparameters for wifi | |||
DEPENDS += +zabbix-agentd +libiwinfo-lua +libuci-lua +lua | |||
endef | |||
define Package/zabbix-sender | |||
$(call Package/zabbix/Default) | |||
TITLE+= sender | |||
endef | |||
define Package/zabbix-get | |||
$(call Package/zabbix/Default) | |||
TITLE+= get | |||
endef | |||
define Package/zabbix-server | |||
$(call Package/zabbix/Default) | |||
TITLE+= server | |||
DEPENDS += +libsqlite3 | |||
endef | |||
define Package/zabbix-proxy | |||
$(call Package/zabbix/Default) | |||
TITLE+= proxy | |||
DEPENDS += +libsqlite3 | |||
endef | |||
define Package/zabbix-extra-mac80211/description | |||
An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters. | |||
It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root. | |||
See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. | |||
endef | |||
define Package/zabbix-extra-network/description | |||
An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces. | |||
The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0) | |||
See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. | |||
endef | |||
define Package/zabbix-extra-wifi/description | |||
An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters. | |||
As it uses libiwinfo, it works with all wifi devices supported by openwrt. | |||
See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. | |||
endef | |||
CONFIGURE_ARGS+= \ | |||
--enable-agent \ | |||
--enable-server \ | |||
--enable-proxy \ | |||
--disable-java \ | |||
--with-sqlite3="$(STAGING_DIR)/usr" | |||
MAKE_FLAGS += ARCH="linux" | |||
define Package/zabbix/install/sbin | |||
$(INSTALL_DIR) \ | |||
$(1)/usr/sbin | |||
$(INSTALL_BIN) \ | |||
$(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \ | |||
$(1)/usr/sbin/ | |||
endef | |||
define Package/zabbix/install/bin | |||
$(INSTALL_DIR) \ | |||
$(1)/usr/bin | |||
$(INSTALL_BIN) \ | |||
$(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \ | |||
$(1)/usr/bin/ | |||
endef | |||
define Package/zabbix/install/etc | |||
$(INSTALL_DIR) \ | |||
$(1)/etc | |||
$(INSTALL_CONF) \ | |||
$(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \ | |||
$(1)/etc/ | |||
endef | |||
define Package/zabbix/install/init.d | |||
$(INSTALL_DIR) \ | |||
$(1)/etc/init.d | |||
$(INSTALL_BIN) \ | |||
./files/zabbix_$(2).init \ | |||
$(1)/etc/init.d/zabbix_$(2) | |||
endef | |||
define Package/zabbix/install/zabbix.conf.d | |||
$(INSTALL_DIR) \ | |||
$(1)/etc/zabbix_agentd.conf.d | |||
$(INSTALL_BIN) \ | |||
./files/$(2) \ | |||
$(1)/etc/zabbix_agentd.conf.d/$(2) | |||
endef | |||
define Package/zabbix-agent/conffiles | |||
/etc/zabbix_agent.conf | |||
endef | |||
define Package/zabbix-agentd/conffiles | |||
/etc/zabbix_agentd.conf | |||
endef | |||
define Package/zabbix-server/conffiles | |||
/etc/zabbix_server.conf | |||
endef | |||
define Package/zabbix-proxy/conffiles | |||
/etc/zabbix_proxy.conf | |||
endef | |||
ifdef CONFIG_PACKAGE_zabbix-extra-mac80211 | |||
define Build/Prepare/zabbix-extra-mac80211 | |||
mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211 | |||
$(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/ | |||
endef | |||
define Build/Compile/zabbix-extra-mac80211 | |||
$(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 | |||
endef | |||
endif | |||
define Build/Prepare | |||
$(call Build/Prepare/Default) | |||
$(call Build/Prepare/zabbix-extra-mac80211) | |||
endef | |||
define Build/Compile | |||
$(call Build/Compile/Default) | |||
$(call Build/Compile/zabbix-extra-mac80211) | |||
endef | |||
define Package/zabbix-agent/install | |||
$(call Package/zabbix/install/sbin,$(1),agent) | |||
$(call Package/zabbix/install/etc,$(1),agent) | |||
endef | |||
define Package/zabbix-agentd/install | |||
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d | |||
$(call Package/zabbix/install/sbin,$(1),agentd) | |||
$(call Package/zabbix/install/etc,$(1),agentd) | |||
$(call Package/zabbix/install/init.d,$(1),agentd) | |||
endef | |||
define Package/zabbix-extra-mac80211/install | |||
$(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211) | |||
$(INSTALL_DIR) $(1)/usr/bin | |||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/ | |||
chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211 | |||
endef | |||
define Package/zabbix-extra-network/install | |||
$(call Package/zabbix/install/zabbix.conf.d,$(1),network) | |||
endef | |||
define Package/zabbix-extra-wifi/install | |||
$(call Package/zabbix/install/zabbix.conf.d,$(1),wifi) | |||
endef | |||
define Package/zabbix-sender/install | |||
$(call Package/zabbix/install/bin,$(1),sender) | |||
endef | |||
define Package/zabbix-get/install | |||
$(call Package/zabbix/install/bin,$(1),get) | |||
endef | |||
define Package/zabbix-server/install | |||
$(call Package/zabbix/install/sbin,$(1),server) | |||
$(call Package/zabbix/install/etc,$(1),server) | |||
endef | |||
define Package/zabbix-proxy/install | |||
$(call Package/zabbix/install/sbin,$(1),proxy) | |||
$(call Package/zabbix/install/etc,$(1),proxy) | |||
endef | |||
$(eval $(call BuildPackage,zabbix-agent)) | |||
$(eval $(call BuildPackage,zabbix-agentd)) | |||
$(eval $(call BuildPackage,zabbix-extra-mac80211)) | |||
$(eval $(call BuildPackage,zabbix-extra-network)) | |||
$(eval $(call BuildPackage,zabbix-extra-wifi)) | |||
$(eval $(call BuildPackage,zabbix-sender)) | |||
$(eval $(call BuildPackage,zabbix-server)) | |||
$(eval $(call BuildPackage,zabbix-proxy)) | |||
$(eval $(call BuildPackage,zabbix-get)) |
@ -0,0 +1,27 @@ | |||
#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates | |||
# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard: | |||
# http://standards.ieee.org/getieee802/download/802.11-2012.pdf | |||
# exemple: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145) | |||
# mac80211 phy discovery (like 'phy0') | |||
# exemple: {"data":[{"{#PHY}":"phy0"}]} | |||
# | |||
UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery | |||
#phy statistics (you need {#PHY} as parameter) | |||
# | |||
UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount | |||
UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount | |||
UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount | |||
UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount | |||
UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 failed_count | |||
UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 frame_duplicate_count | |||
UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 multicast_received_frame_count | |||
UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 multicast_transmitted_frame_count | |||
UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 multiple_retry_count | |||
UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 received_fragment_count | |||
UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 retry_count | |||
UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 transmitted_fragment_count | |||
UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 transmitted_frame_count | |||
@ -0,0 +1,9 @@ | |||
#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates | |||
# network interface discovery | |||
# exemple: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]} | |||
# | |||
UserParameter=netowrt.discovery,lua -l uci -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("network", "interface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#NET}\":\""..s[".name"].."\"}," end); list=string.gsub(list,",$",""); print(list.."]}")' | |||
@ -0,0 +1,29 @@ | |||
#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates | |||
# wifi interface discovery | |||
# exemple: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]} | |||
# | |||
UserParameter=wifi.ifdiscovery,lua -l uci -l iwinfo -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("wireless", "wifi-iface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#MODE}\":\""..s.mode.."\", \"{#SSID}\":\""..s.ssid.."\", \"{#NET}\":\""..s.network.."\", \"{#DEV}\":\""..s.device.."\", \"{#ENC}\":\""..(s.encryption or "?").."\", \"{#TYPE}\":\""..x:get("wireless",s.device,"type").."\", \"{#HWMODE}\":\""..(x:get("wireless",s.device,"hwmode") or "?").."\", \"{#CHANNEL}\":\""..x:get("wireless",s.device,"channel").."\", \"{#BSSID}\":\""..iwinfo[iwinfo.type(s.ifname)].bssid(s.ifname).."\"}," end); list=string.gsub(list,",$",""); print(list.."]}")' | |||
#iwinfo info (you need {#IF} as parameter, like 'wlan0') | |||
UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))" | |||
UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))" | |||
UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))" | |||
UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')" | |||
UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')" | |||
UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))" | |||
UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))" | |||
UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))" | |||
UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))" | |||
UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))" | |||
UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))" | |||
UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))" | |||
UserParameter=wifi.iwinfo.nbusers[*],lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('$1')].assoclist('$1')) do n = n + 1 end; print(n)" | |||
UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')" | |||
UserParameter=wifi.iwinfo.hwmode[*],lua -l iwinfo -e "x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))" | |||
#uci info (you need {#DEV} as parameter, like 'radio0') | |||
UserParameter=wifi.uci.hwmode[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','hwmode'))" | |||
UserParameter=wifi.uci.channel[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','channel'))" | |||
UserParameter=wifi.uci.txpower[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','txpower'))" |
@ -0,0 +1,33 @@ | |||
#!/bin/sh /etc/rc.common | |||
# Copyright (C) 2008-2011 OpenWrt.org | |||
START=60 | |||
PROG=/usr/sbin/zabbix_agentd | |||
CONFIG=/etc/zabbix_agentd.conf | |||
SERVICE_PID_FILE=/var/run/zabbix_agentd.pid | |||
start() { | |||
# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf | |||
[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG} | |||
[ -f ${CONFIG} ] || return 1 | |||
grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || { | |||
logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported" | |||
return 1 | |||
} | |||
grep -q "^AllowRoot=1" ${CONFIG} || { | |||
user_exists zabbix 53 || user_add zabbix 53 | |||
group_exists zabbix 53 || group_add zabbix 53 | |||
touch ${SERVICE_PID_FILE} | |||
chown zabbix:zabbix ${SERVICE_PID_FILE} | |||
} | |||
service_start ${PROG} -c ${CONFIG} | |||
} | |||
stop() { | |||
service_stop ${PROG} | |||
} |
@ -0,0 +1,77 @@ | |||
#define _GNU_SOURCE | |||
#include <stdio.h> | |||
#include <string.h> | |||
#include <stdlib.h> | |||
#include <sys/types.h> | |||
#include <dirent.h> | |||
#include <stdbool.h> | |||
int discovery() | |||
{ | |||
DIR *dir; | |||
struct dirent *ent; | |||
bool comma = false; | |||
if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) { | |||
printf("{\"data\":["); | |||
while ((ent = readdir (dir)) != NULL) { | |||
if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) { | |||
if (comma) | |||
printf(","); | |||
printf("{\"{#PHY}\":\"%s\"}", ent->d_name); | |||
comma = true; | |||
} | |||
} | |||
printf("]}\n"); | |||
closedir(dir); | |||
} else { | |||
perror(""); | |||
return EXIT_FAILURE; | |||
} | |||
return EXIT_SUCCESS; | |||
} | |||
int get_param(char *phy, char *stat) | |||
{ | |||
char *filename = NULL; | |||
FILE *f = NULL; | |||
phy = basename(phy); | |||
stat = basename(stat); | |||
if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0) | |||
f = fopen(filename, "r"); | |||
if (f != NULL) { | |||
char temp[256]; | |||
while (fgets(temp, 256, f) != NULL) | |||
printf("%s",temp); | |||
fclose(f); | |||
} else { | |||
perror(""); | |||
return EXIT_FAILURE; | |||
} | |||
free(filename); | |||
return EXIT_SUCCESS; | |||
} | |||
int usage(char *name) | |||
{ | |||
fprintf(stderr, "Usage:\n"); | |||
fprintf(stderr, " %s discovery\n", name); | |||
fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n"); | |||
fprintf(stderr, " %s PHY STAT\n", name); | |||
fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n"); | |||
return EXIT_FAILURE; | |||
} | |||
int main(int argc, char *argv[]) | |||
{ | |||
switch (argc) { | |||
case 2: | |||
return discovery(); | |||
case 3: | |||
return get_param(argv[1], argv[2]); | |||
default: | |||
return usage(argv[0]); | |||
} | |||
} |
@ -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 ####### | |||