Browse Source

zabbix: update to zabbix 3.0.1

zabbix-agent doesn't exist anymore since 3.0

'-f' option (foreground) is now in zabbix-agentd

003-change-user-and-foreground.patch fixes pending
issue https://support.zabbix.com/browse/ZBX-10611

you might need to update your config file to add
LogType=system

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
lilik-openwrt-22.03
Etienne CHAMPETIER 9 years ago
parent
commit
fe88e0447a
8 changed files with 41 additions and 276 deletions
  1. +3
    -17
      admin/zabbix/Makefile
  2. +2
    -0
      admin/zabbix/files/zabbix_agentd.init
  3. +4
    -4
      admin/zabbix/patches/002-fix-res_send-on-uclibc.patch
  4. +3
    -3
      admin/zabbix/patches/002-uclibc_loadavg.patch
  5. +17
    -0
      admin/zabbix/patches/003-change-user-and-foreground.patch
  6. +11
    -8
      admin/zabbix/patches/010-change-agentd-config.patch
  7. +0
    -243
      admin/zabbix/patches/015-daemon-foreground.patch
  8. +1
    -1
      admin/zabbix/patches/100-musl-compat.patch

+ 3
- 17
admin/zabbix/Makefile View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=zabbix PKG_NAME:=zabbix
PKG_VERSION:=2.4.6
PKG_RELEASE:=3
PKG_VERSION:=3.0.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/zabbix PKG_SOURCE_URL:=@SF/zabbix
PKG_MD5SUM:=06ad8d5808a0eddf2b9f0a256b6a5fde
PKG_MD5SUM:=890d9eec69304ad552959fabe0a5d122
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING PKG_LICENSE_FILES:=COPYING
@ -36,11 +36,6 @@ define Package/zabbix/Default
DEPENDS += $(ICONV_DEPENDS) DEPENDS += $(ICONV_DEPENDS)
endef endef
define Package/zabbix-agent
$(call Package/zabbix/Default)
TITLE+= agent
endef
define Package/zabbix-agentd define Package/zabbix-agentd
$(call Package/zabbix/Default) $(call Package/zabbix/Default)
TITLE+= agentd TITLE+= agentd
@ -159,9 +154,6 @@ define Package/zabbix/install/zabbix.conf.d
$(1)/etc/zabbix_agentd.conf.d/$(2) $(1)/etc/zabbix_agentd.conf.d/$(2)
endef endef
define Package/zabbix-agent/conffiles
/etc/zabbix_agent.conf
endef
define Package/zabbix-agentd/conffiles define Package/zabbix-agentd/conffiles
/etc/zabbix_agentd.conf /etc/zabbix_agentd.conf
endef endef
@ -193,11 +185,6 @@ define Build/Compile
$(call Build/Compile/zabbix-extra-mac80211) $(call Build/Compile/zabbix-extra-mac80211)
endef 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 define Package/zabbix-agentd/install
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
$(call Package/zabbix/install/sbin,$(1),agentd) $(call Package/zabbix/install/sbin,$(1),agentd)
@ -238,7 +225,6 @@ define Package/zabbix-proxy/install
$(call Package/zabbix/install/etc,$(1),proxy) $(call Package/zabbix/install/etc,$(1),proxy)
endef endef
$(eval $(call BuildPackage,zabbix-agent))
$(eval $(call BuildPackage,zabbix-agentd)) $(eval $(call BuildPackage,zabbix-agentd))
$(eval $(call BuildPackage,zabbix-extra-mac80211)) $(eval $(call BuildPackage,zabbix-extra-mac80211))
$(eval $(call BuildPackage,zabbix-extra-network)) $(eval $(call BuildPackage,zabbix-extra-network))


+ 2
- 0
admin/zabbix/files/zabbix_agentd.init View File

@ -16,6 +16,8 @@ start_service() {
procd_open_instance procd_open_instance
procd_set_param command ${PROG} -c ${CONFIG} -f procd_set_param command ${PROG} -c ${CONFIG} -f
procd_set_param respawn procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance procd_close_instance
} }

+ 4
- 4
admin/zabbix/patches/002-fix-res_send-on-uclibc.patch View File

@ -1,6 +1,6 @@
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -152,6 +152,10 @@ if test "x$found_resolv" != "xyes"; then
@@ -161,6 +161,10 @@ if test "x$found_resolv" != "xyes"; then
AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)]) AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
fi fi
LIBS="${LIBS} ${RESOLV_LIBS}" LIBS="${LIBS} ${RESOLV_LIBS}"
@ -13,7 +13,7 @@
dnl * * dnl * *
--- a/src/libs/zbxsysinfo/common/net.c --- a/src/libs/zbxsysinfo/common/net.c
+++ b/src/libs/zbxsysinfo/common/net.c +++ b/src/libs/zbxsysinfo/common/net.c
@@ -450,6 +450,7 @@ static int dns_query(AGENT_REQUEST *requ
@@ -471,6 +471,7 @@ static int dns_query(AGENT_REQUEST *requ
return SYSINFO_RET_FAIL; return SYSINFO_RET_FAIL;
} }
@ -21,7 +21,7 @@
if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf)))) if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
{ {
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno))); SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno)));
@@ -480,6 +481,11 @@ static int dns_query(AGENT_REQUEST *requ
@@ -505,6 +506,11 @@ static int dns_query(AGENT_REQUEST *requ
_res.retry = retry; _res.retry = retry;
res = res_send(buf, res, answer.buffer, sizeof(answer.buffer)); res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
@ -31,5 +31,5 @@
+ return SYSINFO_RET_FAIL; + return SYSINFO_RET_FAIL;
+#endif +#endif
_res.options = saved_options;
_res.retrans = saved_retrans; _res.retrans = saved_retrans;
_res.retry = saved_retry;

+ 3
- 3
admin/zabbix/patches/002-uclibc_loadavg.patch View File

@ -1,8 +1,8 @@
--- a/src/libs/zbxsysinfo/linux/cpu.c --- a/src/libs/zbxsysinfo/linux/cpu.c
+++ b/src/libs/zbxsysinfo/linux/cpu.c +++ b/src/libs/zbxsysinfo/linux/cpu.c
@@ -62,6 +62,45 @@ int SYSTEM_CPU_DISCOVERY(AGENT_REQUEST *
return SYSINFO_RET_OK;
}
@@ -22,6 +22,45 @@
#include "stats.h"
#include "log.h"
+ +
+/* uclibc and dietlibc do not have this junk -ReneR */ +/* uclibc and dietlibc do not have this junk -ReneR */


+ 17
- 0
admin/zabbix/patches/003-change-user-and-foreground.patch View File

@ -0,0 +1,17 @@
--- a/src/libs/zbxnix/daemon.c
+++ b/src/libs/zbxnix/daemon.c
@@ -300,11 +300,14 @@ int daemon_start(int allow_root, const c
if (0 == allow_root && 0 == getuid()) /* running as root? */
{
+#if 0
+/* allow changing user and foreground */
if (0 != (flags & ZBX_TASK_FLAG_FOREGROUND))
{
zbx_error("cannot run as root!");
exit(EXIT_FAILURE);
}
+#endif
if (NULL == user)
user = "zabbix";

+ 11
- 8
admin/zabbix/patches/010-change-agentd-config.patch View File

@ -1,6 +1,6 @@
--- a/conf/zabbix_agentd.conf --- a/conf/zabbix_agentd.conf
+++ b/conf/zabbix_agentd.conf +++ b/conf/zabbix_agentd.conf
@@ -3,12 +3,8 @@
@@ -3,12 +3,11 @@
############ GENERAL PARAMETERS ################# ############ GENERAL PARAMETERS #################
@ -12,10 +12,13 @@
-# PidFile=/tmp/zabbix_agentd.pid -# PidFile=/tmp/zabbix_agentd.pid
+# We do not need PidFile with procd +# We do not need PidFile with procd
+# PidFile=/var/run/zabbix_agentd.pid +# PidFile=/var/run/zabbix_agentd.pid
+
+# use syslog
+LogType=system
### Option: LogFile
# Name of log file.
@@ -18,8 +14,6 @@
### Option: LogType
# Specifies where log messages are written to:
@@ -27,8 +26,6 @@
# Default: # Default:
# LogFile= # LogFile=
@ -24,7 +27,7 @@
### Option: LogFileSize ### Option: LogFileSize
# Maximum size of log file in MB. # Maximum size of log file in MB.
# 0 - disable automatic log rotation. # 0 - disable automatic log rotation.
@@ -104,6 +98,7 @@ Server=127.0.0.1
@@ -114,6 +111,7 @@ Server=127.0.0.1
# Range: 0-100 # Range: 0-100
# Default: # Default:
# StartAgents=3 # StartAgents=3
@ -32,7 +35,7 @@
##### Active checks related ##### Active checks related
@@ -119,8 +114,6 @@ Server=127.0.0.1
@@ -129,8 +127,6 @@ Server=127.0.0.1
# Default: # Default:
# ServerActive= # ServerActive=
@ -41,7 +44,7 @@
### Option: Hostname ### Option: Hostname
# Unique, case sensitive hostname. # Unique, case sensitive hostname.
# Required for active checks and must match hostname as configured on the server. # Required for active checks and must match hostname as configured on the server.
@@ -130,8 +123,6 @@ ServerActive=127.0.0.1
@@ -140,8 +136,6 @@ ServerActive=127.0.0.1
# Default: # Default:
# Hostname= # Hostname=
@ -50,7 +53,7 @@
### Option: HostnameItem ### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
# Does not support UserParameters or aliases. # Does not support UserParameters or aliases.
@@ -249,8 +240,8 @@ Hostname=Zabbix server
@@ -259,8 +253,8 @@ Hostname=Zabbix server
# Include= # Include=
# Include=/usr/local/etc/zabbix_agentd.userparams.conf # Include=/usr/local/etc/zabbix_agentd.userparams.conf


+ 0
- 243
admin/zabbix/patches/015-daemon-foreground.patch View File

@ -1,243 +0,0 @@
--- a/include/common.h
+++ b/include/common.h
@@ -1083,4 +1083,7 @@ int parse_serveractive_element(char *str
char *zbx_dyn_escape_shell_single_quote(const char *text);
+#define ZBX_RUN_BACKGROUND 0
+#define ZBX_RUN_FOREGROUND 1
+
#endif
--- a/include/daemon.h
+++ b/include/daemon.h
@@ -28,7 +28,7 @@ extern char *CONFIG_PID_FILE;
#include "threads.h"
-int daemon_start(int allow_root, const char *user);
+int daemon_start(int allow_root, const char *user, int run_foreground);
void daemon_stop();
int zbx_sigusr_send(int flags);
@@ -36,6 +36,6 @@ int zbx_sigusr_send(int flags);
#define ZBX_IS_RUNNING() 1
#define ZBX_DO_EXIT()
-#define START_MAIN_ZABBIX_ENTRY(a, u) daemon_start(a, u)
+#define START_MAIN_ZABBIX_ENTRY(a, u, f) daemon_start(a, u, f)
#endif /* ZABBIX_DAEMON_H */
--- a/src/libs/zbxnix/daemon.c
+++ b/src/libs/zbxnix/daemon.c
@@ -272,16 +272,17 @@ static void set_daemon_signal_handlers()
* *
* Purpose: init process as daemon *
* *
- * Parameters: allow_root - allow root permission for application *
- * user - user on the system to which to drop the *
- * privileges *
+ * Parameters: allow_root - allow root permission for application *
+ * user - user on the system to which to drop the *
+ * privileges *
+ * run_foreground - should it close its controlling tty *
* *
* Author: Alexei Vladishev *
* *
* Comments: it doesn't allow running under 'root' if allow_root is zero *
* *
******************************************************************************/
-int daemon_start(int allow_root, const char *user)
+int daemon_start(int allow_root, const char *user, int run_foreground)
{
pid_t pid;
struct passwd *pwd;
@@ -336,15 +337,22 @@ int daemon_start(int allow_root, const c
#endif
}
- if (0 != (pid = zbx_fork()))
- exit(EXIT_SUCCESS);
+ if ( ZBX_RUN_FOREGROUND != run_foreground)
+ if (0 != (pid = zbx_fork()))
+ exit(EXIT_SUCCESS);
setsid();
signal(SIGHUP, SIG_IGN);
- if (0 != (pid = zbx_fork()))
- exit(EXIT_SUCCESS);
+ if ( ZBX_RUN_FOREGROUND == run_foreground) {
+ zabbix_log(LOG_LEVEL_INFORMATION, "Running in foreground...");
+ } else {
+ if (0 != (pid = zbx_fork()))
+ exit(EXIT_SUCCESS);
+ }
+
+
if (-1 == chdir("/")) /* this is to eliminate warning: ignoring return value of chdir */
assert(0);
--- a/src/zabbix_agent/zabbix_agentd.c
+++ b/src/zabbix_agent/zabbix_agentd.c
@@ -62,6 +62,8 @@ const char *progname = NULL;
static char DEFAULT_CONFIG_FILE[] = SYSCONFDIR "/zabbix_agentd.conf";
#endif
+int CONFIG_FOREGROUND = ZBX_RUN_BACKGROUND;
+
/* application TITLE */
const char title_message[] = APPLICATION_NAME
#if defined(_WIN64)
@@ -93,6 +95,7 @@ const char usage_message[] =
const char *help_message[] = {
"Options:",
" -c --config <config-file> Absolute path to the configuration file",
+ " -f --foreground Run in foreground don't fork",
" -p --print Print known items and exit",
" -t --test <item key> Test specified item and exit",
" -h --help Display help information",
@@ -127,6 +130,7 @@ const char *help_message[] = {
/* COMMAND LINE OPTIONS */
static struct zbx_option longopts[] =
{
+ {"foreground", 0, NULL, 'f'},
{"config", 1, NULL, 'c'},
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'V'},
@@ -147,7 +151,7 @@ static struct zbx_option longopts[] =
};
static char shortopts[] =
- "c:hVpt:"
+ "c:hfVpt:"
#ifndef _WINDOWS
"R:"
#else
@@ -241,6 +245,9 @@ static void parse_commandline(int argc,
{
switch (ch)
{
+ case 'f':
+ CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
+ break;
case 'c':
CONFIG_FILE = strdup(zbx_optarg);
break;
@@ -944,7 +951,7 @@ int main(int argc, char **argv)
break;
}
- START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER);
+ START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
exit(EXIT_SUCCESS);
}
--- a/src/zabbix_proxy/proxy.c
+++ b/src/zabbix_proxy/proxy.c
@@ -60,6 +60,7 @@ const char usage_message[] = "[-hV] [-c
const char *help_message[] = {
"Options:",
+ " -f --foreground Run in foreground don't fork",
" -c --config <file> Absolute path to the configuration file",
" -R --runtime-control <option> Perform administrative functions",
"",
@@ -84,6 +85,7 @@ const char *help_message[] = {
/* long options */
static struct zbx_option longopts[] =
{
+ {"foreground", 0, NULL, 'f'},
{"config", 1, NULL, 'c'},
{"runtime-control", 1, NULL, 'R'},
{"help", 0, NULL, 'h'},
@@ -92,7 +94,7 @@ static struct zbx_option longopts[] =
};
/* short options */
-static char shortopts[] = "c:n:hVR:";
+static char shortopts[] = "c:n:fhVR:";
/* end of COMMAND LINE OPTIONS */
@@ -202,6 +204,7 @@ char *CONFIG_LOAD_MODULE_PATH = NULL;
char **CONFIG_LOAD_MODULE = NULL;
char *CONFIG_USER = NULL;
+int CONFIG_FOREGROUND = ZBX_RUN_BACKGROUND;
/* web monitoring */
#ifdef HAVE_LIBCURL
@@ -666,6 +669,9 @@ int main(int argc, char **argv)
{
switch (ch)
{
+ case 'f':
+ CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
+ break;
case 'c':
CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
break;
@@ -705,7 +711,7 @@ int main(int argc, char **argv)
init_ipmi_handler();
#endif
- return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
+ return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
}
int MAIN_ZABBIX_ENTRY()
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -64,6 +64,7 @@ const char usage_message[] = "[-hV] [-c
const char *help_message[] = {
"Options:",
+ " -f --foreground Run in foreground don't fork",
" -c --config <file> Absolute path to the configuration file",
" -R --runtime-control <option> Perform administrative functions",
"",
@@ -88,6 +89,7 @@ const char *help_message[] = {
/* long options */
static struct zbx_option longopts[] =
{
+ {"foreground", 0, NULL, 'f'},
{"config", 1, NULL, 'c'},
{"runtime-control", 1, NULL, 'R'},
{"help", 0, NULL, 'h'},
@@ -96,7 +98,7 @@ static struct zbx_option longopts[] =
};
/* short options */
-static char shortopts[] = "c:n:hVR:";
+static char shortopts[] = "c:n:fhVR:";
/* end of COMMAND LINE OPTIONS */
@@ -197,6 +199,7 @@ char *CONFIG_LOAD_MODULE_PATH = NULL;
char **CONFIG_LOAD_MODULE = NULL;
char *CONFIG_USER = NULL;
+int CONFIG_FOREGROUND = ZBX_RUN_BACKGROUND;
/* web monitoring */
#ifdef HAVE_LIBCURL
@@ -631,6 +634,9 @@ int main(int argc, char **argv)
{
switch (ch)
{
+ case 'f':
+ CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
+ break;
case 'c':
CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
break;
@@ -670,7 +676,7 @@ int main(int argc, char **argv)
init_ipmi_handler();
#endif
- return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
+ return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
}
int MAIN_ZABBIX_ENTRY()

+ 1
- 1
admin/zabbix/patches/100-musl-compat.patch View File

@ -10,7 +10,7 @@
sys/vmmeter.h strings.h vm/vm_param.h \ sys/vmmeter.h strings.h vm/vm_param.h \
sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \ sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \
@@ -63,6 +63,11 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string @@ -63,6 +63,11 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string
sys/timeb.h Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \
Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \
execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \ execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \
dlfcn.h sys/utsname.h) dlfcn.h sys/utsname.h)
+AC_CHECK_HEADERS(sys/sysinfo.h, [], [], [ +AC_CHECK_HEADERS(sys/sysinfo.h, [], [], [


Loading…
Cancel
Save