Procházet zdrojové kódy

Zabbix: import 2.2.2 from packages

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>
Etienne CHAMPETIER před 10 roky
rodič
revize
99dcd289e4

+ 243
- 0
admin/zabbix/Makefile Zobrazit soubor

@@ -0,0 +1,243 @@
1
+#
2
+# Copyright (C) 2006-2013 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=zabbix
11
+PKG_VERSION:=2.2.2
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=@SF/zabbix
16
+PKG_MD5SUM:=7f680ad3ef7145840e3de5c7a0f19b7c
17
+
18
+PKG_INSTALL:=1
19
+
20
+PKG_FIXUP:=autoreconf
21
+
22
+include $(INCLUDE_DIR)/package.mk
23
+include $(INCLUDE_DIR)/nls.mk
24
+
25
+define Package/zabbix/Default
26
+  SECTION:=admin
27
+  CATEGORY:=Administration
28
+  TITLE:=Zabbix
29
+  URL:=http://www.zabbix.com/
30
+  SUBMENU:=zabbix
31
+  MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
32
+endef
33
+
34
+define Package/zabbix-agent
35
+  $(call Package/zabbix/Default)
36
+  TITLE+= agent
37
+endef
38
+
39
+define Package/zabbix-agentd
40
+  $(call Package/zabbix/Default)
41
+  TITLE+= agentd
42
+endef
43
+
44
+define Package/zabbix-extra-mac80211
45
+  $(call Package/zabbix/Default)
46
+  TITLE+= discovery/userparameters for mac80211
47
+  DEPENDS += +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS
48
+endef
49
+
50
+define Package/zabbix-extra-network
51
+  $(call Package/zabbix/Default)
52
+  TITLE+= discovery/userparameters for network
53
+  DEPENDS += +zabbix-agentd +libuci-lua +lua
54
+endef
55
+
56
+define Package/zabbix-extra-wifi
57
+  $(call Package/zabbix/Default)
58
+  TITLE+= discovery/userparameters for wifi
59
+  DEPENDS += +zabbix-agentd +libiwinfo-lua +libuci-lua +lua
60
+endef
61
+
62
+define Package/zabbix-sender
63
+  $(call Package/zabbix/Default)
64
+  TITLE+= sender
65
+endef
66
+
67
+define Package/zabbix-get
68
+  $(call Package/zabbix/Default)
69
+  TITLE+= get
70
+endef
71
+
72
+define Package/zabbix-server
73
+  $(call Package/zabbix/Default)
74
+  TITLE+= server
75
+  DEPENDS += +libsqlite3
76
+endef
77
+
78
+define Package/zabbix-proxy
79
+  $(call Package/zabbix/Default)
80
+  TITLE+= proxy
81
+  DEPENDS += +libsqlite3
82
+endef
83
+
84
+define Package/zabbix-extra-mac80211/description
85
+An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters.
86
+It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root.
87
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
88
+endef
89
+
90
+define Package/zabbix-extra-network/description
91
+An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces.
92
+The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0)
93
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
94
+endef
95
+
96
+define Package/zabbix-extra-wifi/description
97
+An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters.
98
+As it uses libiwinfo, it works with all wifi devices supported by openwrt.
99
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
100
+endef
101
+
102
+CONFIGURE_ARGS+= \
103
+	--enable-agent \
104
+	--enable-server \
105
+	--enable-proxy \
106
+	--disable-java \
107
+	--with-sqlite3="$(STAGING_DIR)/usr"
108
+
109
+MAKE_FLAGS += ARCH="linux"
110
+
111
+define Package/zabbix/install/sbin
112
+	$(INSTALL_DIR) \
113
+		$(1)/usr/sbin
114
+
115
+	$(INSTALL_BIN) \
116
+		$(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
117
+		$(1)/usr/sbin/
118
+endef
119
+
120
+define Package/zabbix/install/bin
121
+	$(INSTALL_DIR) \
122
+		$(1)/usr/bin
123
+
124
+	$(INSTALL_BIN) \
125
+		$(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
126
+		$(1)/usr/bin/
127
+endef
128
+
129
+define Package/zabbix/install/etc
130
+	$(INSTALL_DIR) \
131
+		$(1)/etc
132
+
133
+	$(INSTALL_CONF) \
134
+		$(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
135
+		$(1)/etc/
136
+endef
137
+
138
+define Package/zabbix/install/init.d
139
+	$(INSTALL_DIR) \
140
+		$(1)/etc/init.d
141
+
142
+	$(INSTALL_BIN) \
143
+		./files/zabbix_$(2).init \
144
+		$(1)/etc/init.d/zabbix_$(2)
145
+endef
146
+
147
+define Package/zabbix/install/zabbix.conf.d
148
+	$(INSTALL_DIR) \
149
+		$(1)/etc/zabbix_agentd.conf.d
150
+
151
+	$(INSTALL_BIN) \
152
+		./files/$(2) \
153
+		$(1)/etc/zabbix_agentd.conf.d/$(2)
154
+endef
155
+
156
+define Package/zabbix-agent/conffiles
157
+/etc/zabbix_agent.conf
158
+endef
159
+define Package/zabbix-agentd/conffiles
160
+/etc/zabbix_agentd.conf
161
+endef
162
+define Package/zabbix-server/conffiles
163
+/etc/zabbix_server.conf
164
+endef
165
+define Package/zabbix-proxy/conffiles
166
+/etc/zabbix_proxy.conf
167
+endef
168
+
169
+ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
170
+define Build/Prepare/zabbix-extra-mac80211
171
+	mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
172
+	$(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
173
+endef
174
+
175
+define Build/Compile/zabbix-extra-mac80211
176
+	$(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
177
+endef
178
+endif
179
+
180
+define Build/Prepare
181
+	$(call Build/Prepare/Default)
182
+	$(call Build/Prepare/zabbix-extra-mac80211)
183
+endef
184
+
185
+define Build/Compile
186
+	$(call Build/Compile/Default)
187
+	$(call Build/Compile/zabbix-extra-mac80211)
188
+endef
189
+
190
+define Package/zabbix-agent/install
191
+	$(call Package/zabbix/install/sbin,$(1),agent)
192
+	$(call Package/zabbix/install/etc,$(1),agent)
193
+endef
194
+
195
+define Package/zabbix-agentd/install
196
+	$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
197
+	$(call Package/zabbix/install/sbin,$(1),agentd)
198
+	$(call Package/zabbix/install/etc,$(1),agentd)
199
+	$(call Package/zabbix/install/init.d,$(1),agentd)
200
+endef
201
+
202
+define Package/zabbix-extra-mac80211/install
203
+	$(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
204
+	$(INSTALL_DIR) $(1)/usr/bin
205
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
206
+	chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
207
+endef
208
+
209
+define Package/zabbix-extra-network/install
210
+	$(call Package/zabbix/install/zabbix.conf.d,$(1),network)
211
+endef
212
+
213
+define Package/zabbix-extra-wifi/install
214
+	$(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
215
+endef
216
+
217
+define Package/zabbix-sender/install
218
+	$(call Package/zabbix/install/bin,$(1),sender)
219
+endef
220
+
221
+define Package/zabbix-get/install
222
+	$(call Package/zabbix/install/bin,$(1),get)
223
+endef
224
+
225
+define Package/zabbix-server/install
226
+	$(call Package/zabbix/install/sbin,$(1),server)
227
+	$(call Package/zabbix/install/etc,$(1),server)
228
+endef
229
+
230
+define Package/zabbix-proxy/install
231
+	$(call Package/zabbix/install/sbin,$(1),proxy)
232
+	$(call Package/zabbix/install/etc,$(1),proxy)
233
+endef
234
+
235
+$(eval $(call BuildPackage,zabbix-agent))
236
+$(eval $(call BuildPackage,zabbix-agentd))
237
+$(eval $(call BuildPackage,zabbix-extra-mac80211))
238
+$(eval $(call BuildPackage,zabbix-extra-network))
239
+$(eval $(call BuildPackage,zabbix-extra-wifi))
240
+$(eval $(call BuildPackage,zabbix-sender))
241
+$(eval $(call BuildPackage,zabbix-server))
242
+$(eval $(call BuildPackage,zabbix-proxy))
243
+$(eval $(call BuildPackage,zabbix-get))

+ 27
- 0
admin/zabbix/files/mac80211 Zobrazit soubor

@@ -0,0 +1,27 @@
1
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
2
+
3
+# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard:
4
+# http://standards.ieee.org/getieee802/download/802.11-2012.pdf
5
+# exemple: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145)
6
+
7
+# mac80211 phy discovery (like 'phy0')
8
+# exemple: {"data":[{"{#PHY}":"phy0"}]}
9
+#
10
+UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery
11
+
12
+#phy statistics (you need {#PHY} as parameter)
13
+#
14
+UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount
15
+UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount
16
+UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount
17
+UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount
18
+UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 failed_count
19
+UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 frame_duplicate_count
20
+UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 multicast_received_frame_count
21
+UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 multicast_transmitted_frame_count
22
+UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 multiple_retry_count
23
+UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 received_fragment_count
24
+UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 retry_count
25
+UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 transmitted_fragment_count
26
+UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 transmitted_frame_count
27
+

+ 9
- 0
admin/zabbix/files/network Zobrazit soubor

@@ -0,0 +1,9 @@
1
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
2
+
3
+# network interface discovery
4
+# exemple: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]}
5
+#
6
+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.."]}")'
7
+
8
+
9
+

+ 29
- 0
admin/zabbix/files/wifi Zobrazit soubor

@@ -0,0 +1,29 @@
1
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
2
+
3
+# wifi interface discovery
4
+# 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"}]}
5
+#
6
+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.."]}")'
7
+
8
+
9
+#iwinfo info (you need {#IF} as parameter, like 'wlan0')
10
+UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))"
11
+UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))"
12
+UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))"
13
+UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')"
14
+UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')"
15
+UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))"
16
+UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))"
17
+UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))"
18
+UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))"
19
+UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))"
20
+UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))"
21
+UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))"
22
+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)"
23
+UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')"
24
+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 ''))"
25
+
26
+#uci info (you need {#DEV} as parameter, like 'radio0')
27
+UserParameter=wifi.uci.hwmode[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','hwmode'))"
28
+UserParameter=wifi.uci.channel[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','channel'))"
29
+UserParameter=wifi.uci.txpower[*],lua -l uci -e "x = uci.cursor(nil, '/var/state'); print(x:get('wireless','$1','txpower'))"

+ 33
- 0
admin/zabbix/files/zabbix_agentd.init Zobrazit soubor

@@ -0,0 +1,33 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2008-2011 OpenWrt.org
3
+
4
+START=60
5
+
6
+PROG=/usr/sbin/zabbix_agentd
7
+CONFIG=/etc/zabbix_agentd.conf
8
+SERVICE_PID_FILE=/var/run/zabbix_agentd.pid
9
+
10
+start() {
11
+	# Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
12
+	[ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
13
+
14
+	[ -f ${CONFIG} ] || return 1
15
+
16
+	grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
17
+		logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
18
+		return 1
19
+	}
20
+
21
+	grep -q "^AllowRoot=1" ${CONFIG} || {
22
+		user_exists zabbix 53 || user_add zabbix 53
23
+		group_exists zabbix 53 || group_add zabbix 53
24
+		touch ${SERVICE_PID_FILE}
25
+		chown zabbix:zabbix ${SERVICE_PID_FILE}
26
+	}
27
+
28
+	service_start ${PROG} -c ${CONFIG}
29
+}
30
+
31
+stop() {
32
+	service_stop ${PROG}
33
+}

+ 77
- 0
admin/zabbix/files/zabbix_helper_mac80211.c Zobrazit soubor

@@ -0,0 +1,77 @@
1
+#define _GNU_SOURCE
2
+#include <stdio.h>
3
+#include <string.h>
4
+#include <stdlib.h>
5
+#include <sys/types.h>
6
+#include <dirent.h>
7
+#include <stdbool.h>
8
+
9
+int discovery()
10
+{
11
+    DIR *dir;
12
+    struct dirent *ent;
13
+    bool comma = false;
14
+    if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) {
15
+        printf("{\"data\":[");
16
+        while ((ent = readdir (dir)) != NULL) {
17
+            if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) {
18
+                if (comma)
19
+                    printf(",");
20
+                printf("{\"{#PHY}\":\"%s\"}", ent->d_name);
21
+                comma = true;
22
+            }
23
+        }
24
+        printf("]}\n");
25
+        closedir(dir);
26
+    } else {
27
+        perror("");
28
+        return EXIT_FAILURE;
29
+    }
30
+    return EXIT_SUCCESS;
31
+}
32
+
33
+int get_param(char *phy, char *stat)
34
+{
35
+    char *filename = NULL;
36
+    FILE *f = NULL;
37
+    phy = basename(phy);
38
+    stat = basename(stat);
39
+    if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0)
40
+        f = fopen(filename, "r");
41
+
42
+    if (f != NULL) {
43
+        char temp[256];
44
+        while (fgets(temp, 256, f) != NULL)
45
+            printf("%s",temp);
46
+
47
+        fclose(f);
48
+    } else {
49
+        perror("");
50
+        return EXIT_FAILURE;
51
+    }
52
+    free(filename);
53
+    return EXIT_SUCCESS;
54
+}
55
+
56
+int usage(char *name)
57
+{
58
+    fprintf(stderr, "Usage:\n");
59
+    fprintf(stderr, " %s discovery\n", name);
60
+    fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n");
61
+    fprintf(stderr, " %s PHY STAT\n", name);
62
+    fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n");
63
+    return EXIT_FAILURE;
64
+}
65
+
66
+int main(int argc, char *argv[])
67
+{
68
+
69
+    switch (argc) {
70
+    case 2:
71
+        return discovery();
72
+    case 3:
73
+        return get_param(argv[1], argv[2]);
74
+    default:
75
+        return usage(argv[0]);
76
+    }
77
+}

+ 29
- 0
admin/zabbix/patches/001-cross_compile.patch Zobrazit soubor

@@ -0,0 +1,29 @@
1
+--- a/configure.ac
2
++++ b/configure.ac
3
+@@ -805,25 +805,8 @@ dnl ************************************
4
+ 
5
+ dnl Check for %qu format (FreeBSD 4.x)
6
+ dnl FreeBSD 4.x does not support %llu
7
+-AC_MSG_CHECKING(for long long format)
8
+-AC_TRY_RUN(
9
+-[
10
+-#include <sys/types.h>
11
+-int main()
12
+-{
13
+-        uint64_t i;
14
+-
15
+-        sscanf("200000000010020", "%qu", &i);
16
+-
17
+-        if (i == 200000000010020) return 0;
18
+-        else return -1;
19
+-}
20
+-],
21
+-AC_DEFINE(HAVE_LONG_LONG_QU, 1 ,[Define to 1 if format '%qu' exists.])
22
+-AC_MSG_RESULT(yes),
23
+-AC_MSG_RESULT(no))
24
+-
25
+ dnl option -rdynamic is needed for readable backtraces
26
++
27
+ AC_MSG_CHECKING(for -rdynamic linking option)
28
+ saved_LDFLAGS="$LDFLAGS"
29
+ LDFLAGS="-rdynamic $LDFLAGS"

+ 35
- 0
admin/zabbix/patches/002-fix-res_send-on-uclibc.patch Zobrazit soubor

@@ -0,0 +1,35 @@
1
+--- a/configure.ac
2
++++ b/configure.ac
3
+@@ -152,6 +152,10 @@ if test "x$found_resolv" != "xyes"; then
4
+ 	AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
5
+ fi
6
+ LIBS="${LIBS} ${RESOLV_LIBS}"
7
++AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
8
++AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
9
++AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
10
++AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) 
11
+ 
12
+ dnl *****************************************************************
13
+ dnl *                                                               *
14
+--- a/src/libs/zbxsysinfo/common/net.c
15
++++ b/src/libs/zbxsysinfo/common/net.c
16
+@@ -424,6 +424,7 @@ static int	dns_query(AGENT_REQUEST *requ
17
+ 	if (-1 == res_init())	/* initialize always, settings might have changed */
18
+ 		return SYSINFO_RET_FAIL;
19
+ 
20
++#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND) 
21
+ 	if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
22
+ 		return SYSINFO_RET_FAIL;
23
+ 
24
+@@ -448,6 +449,11 @@ static int	dns_query(AGENT_REQUEST *requ
25
+ 	_res.retry = retry;
26
+ 
27
+ 	res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
28
++#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */
29
++	/* retrand and retry are ignored */
30
++	if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer))))
31
++	return SYSINFO_RET_FAIL;
32
++#endif 
33
+ 
34
+ 	_res.retrans = saved_retrans;
35
+ 	_res.retry = saved_retry;

+ 48
- 0
admin/zabbix/patches/002-uclibc_loadavg.patch Zobrazit soubor

@@ -0,0 +1,48 @@
1
+--- a/src/libs/zbxsysinfo/linux/cpu.c
2
++++ b/src/libs/zbxsysinfo/linux/cpu.c
3
+@@ -21,6 +21,45 @@
4
+ #include "sysinfo.h"
5
+ #include "stats.h"
6
+ 
7
++
8
++/* uclibc and dietlibc do not have this junk -ReneR */
9
++#if defined (__UCLIBC__) || defined (__dietlibc__)
10
++static int getloadavg (double loadavg[], int nelem)
11
++{
12
++  int fd;
13
++
14
++  fd = open ("/proc/loadavg", O_RDONLY);
15
++  if (fd < 0)
16
++    return -1;
17
++  else
18
++    {
19
++      char buf[65], *p;
20
++      ssize_t nread;
21
++      int i;
22
++
23
++      nread = read (fd, buf, sizeof buf - 1);
24
++      close (fd);
25
++      if (nread <= 0)
26
++	return -1;
27
++      buf[nread - 1] = '\0';
28
++
29
++      if (nelem > 3)
30
++	nelem = 3;
31
++      p = buf;
32
++      for (i = 0; i < nelem; ++i)
33
++	{
34
++	  char *endp;
35
++	  loadavg[i] = strtod (p, &endp);
36
++	  if (endp == p)
37
++	    return -1;
38
++	  p = endp;
39
++	}
40
++
41
++      return i;
42
++    }
43
++}
44
++#endif
45
++
46
+ int	SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
47
+ {
48
+ 	char	*type;

+ 61
- 0
admin/zabbix/patches/010-change-agentd-config.patch Zobrazit soubor

@@ -0,0 +1,61 @@
1
+--- a/conf/zabbix_agentd.conf
2
++++ b/conf/zabbix_agentd.conf
3
+@@ -3,12 +3,8 @@
4
+ 
5
+ ############ GENERAL PARAMETERS #################
6
+ 
7
+-### Option: PidFile
8
+-#	Name of PID file.
9
+-#
10
+-# Mandatory: no
11
+-# Default:
12
+-# PidFile=/tmp/zabbix_agentd.pid
13
++# Only /var/run/zabbix_agentd.pid supported
14
++PidFile=/var/run/zabbix_agentd.pid
15
+ 
16
+ ### Option: LogFile
17
+ #	Name of log file.
18
+@@ -18,8 +14,6 @@
19
+ # Default:
20
+ # LogFile=
21
+ 
22
+-LogFile=/tmp/zabbix_agentd.log
23
+-
24
+ ### Option: LogFileSize
25
+ #	Maximum size of log file in MB.
26
+ #	0 - disable automatic log rotation.
27
+@@ -104,6 +98,7 @@ Server=127.0.0.1
28
+ # Range: 0-100
29
+ # Default:
30
+ # StartAgents=3
31
++StartAgents=1
32
+ 
33
+ ##### Active checks related
34
+ 
35
+@@ -119,8 +114,6 @@ Server=127.0.0.1
36
+ # Default:
37
+ # ServerActive=
38
+ 
39
+-ServerActive=127.0.0.1
40
+-
41
+ ### Option: Hostname
42
+ #	Unique, case sensitive hostname.
43
+ #	Required for active checks and must match hostname as configured on the server.
44
+@@ -130,8 +123,6 @@ ServerActive=127.0.0.1
45
+ # Default:
46
+ # Hostname=
47
+ 
48
+-Hostname=Zabbix server
49
+-
50
+ ### Option: HostnameItem
51
+ #	Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
52
+ #	Does not support UserParameters or aliases.
53
+@@ -240,7 +231,7 @@ Hostname=Zabbix server
54
+ # Include=
55
+ 
56
+ # Include=/usr/local/etc/zabbix_agentd.userparams.conf
57
+-# Include=/usr/local/etc/zabbix_agentd.conf.d/
58
++Include=/etc/zabbix_agentd.conf.d/
59
+ 
60
+ ####### USER-DEFINED MONITORED PARAMETERS #######
61
+