Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zabbix-agent #6417

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions cross/zabbix-agent/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
PKG_NAME = zabbix-agent
REAL_PKG_NAME = zabbix
PKG_VERS = 7.2.2
PKG_EXT = tar.gz
PKG_DIST_NAME = $(REAL_PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
SHORT_VERSION = $(word 1,$(subst ., ,$(PKG_VERS))).$(word 2,$(subst ., ,$(PKG_VERS)))
PKG_DIST_SITE = https://cdn.zabbix.com/zabbix/sources/stable/$(SHORT_VERSION)
PKG_DIR = $(REAL_PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/zlib
DEPENDS += cross/openssl3
DEPENDS += cross/curl
DEPENDS += cross/pcre2

# build instructions:
# https://www.zabbix.com/documentation/current/en/manual/installation/install

# Notes on compilation options:
#
# o Command-line utilities zabbix_get and zabbix_sender are compiled if --enable-agent option is used.
# o --with-libcurl and --with-libxml2 configuration options are required for virtual machine monitoring;
# --with-libcurl is also required for SMTP authentication and web.page.* Zabbix agent items.
# Note that cURL 7.20.0 or higher is required with the --with-libcurl configuration option.
# o Zabbix always compiles with the PCRE library; installing it is not optional. --with-libpcre=[DIR] only
# allows pointing to a specific base install directory, instead of searching through a number of common
# places for the libpcre files.
# o You may use the --enable-static flag to statically link libraries. If you plan to distribute compiled
# binaries among different servers, you must use this flag to make these binaries work without required
# libraries. Note that --enable-static does not work in Solaris.
# o Using --enable-static option is not recommended when building server. In order to build the server
# statically, you must have a static version of every external library needed. There is no strict check
# for that in configure script.
# o Add optional path to the MySQL configuration file --with-mysql=/<path_to_the_file>/mysql_config to select
# the desired MySQL client library when there is a need to use one that is not located in the default location.
# It is useful when there are several versions of MySQL installed or MariaDB installed alongside MySQL on the
# same system.


HOMEPAGE = https://www.zabbix.com
COMMENT = Monitor anything - networks, cloud, websites, IoT, and more.
LICENSE = AGPLv3

GNU_CONFIGURE = 1

CONFIGURE_ARGS = --enable-agent
CONFIGURE_ARGS += --disable-static
CONFIGURE_ARGS += --enable-ipv6
CONFIGURE_ARGS += --with-zlib=$(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --with-libpthread=$(STAGING_INSTALL_PREFIX)
CONFIGURE_ARGS += --with-openssl=$(STAGING_INSTALL_PREFIX)
# --with-libcurl must define curl-config and not the directory (ERROR: checking for the version of libcurl... ./configure: line 18672: .../install/usr/local/zabbix-agent: Is a directory)
CONFIGURE_ARGS += --with-libcurl=$(STAGING_INSTALL_PREFIX)/bin/curl-config
CONFIGURE_ARGS += --with-libpcre2=$(STAGING_INSTALL_PREFIX)

include ../../mk/spksrc.cross-cc.mk
3 changes: 3 additions & 0 deletions cross/zabbix-agent/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin:bin/zabbix_get
bin:bin/zabbix_sender
bin:sbin/zabbix_agentd
3 changes: 3 additions & 0 deletions cross/zabbix-agent/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zabbix-7.2.2.tar.gz SHA1 6a2586414bf745acd147ffa4ac72c43f1aafa21d
zabbix-7.2.2.tar.gz SHA256 4d7c7a8dc6a7d333466e7dcc0440e009ab5b7b394cacb4b3291bf693575bd673
zabbix-7.2.2.tar.gz MD5 cf92b68831b17057fe167c4e90d309d8
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# replace '$(ARCH)' with target system 'linux' to avoid erros due to ARCH variable by spksrc framework
#
--- src/libs/zbxsysinfo/Makefile.in.orig 2025-01-06 10:52:19.122601600 +0000
+++ src/libs/zbxsysinfo/Makefile.in 2025-01-22 20:02:28.540182149 +0000
@@ -485,7 +485,7 @@
alias \
common \
simple \
- $(ARCH)
+ linux

EXTRA_DIST = \
win32

--- src/zabbix_agent/Makefile.in.orig 2025-01-06 10:52:21.098619600 +0000
+++ src/zabbix_agent/Makefile.in 2025-01-22 20:11:16.861878942 +0000
@@ -121,12 +121,12 @@
listener/libzbxlistener.a agent_conf/libagent_conf.a \
logfiles/libzbxlogfiles.a metrics/libzbxmetrics.a \
$(top_builddir)/src/libs/zbxsysinfo/libzbxagentsysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libfunclistsysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libfunclistsysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspechostnamesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/agent/libagentsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspecsysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspecsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \
$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/alias/libalias.a \
@@ -496,12 +496,12 @@
logfiles/libzbxlogfiles.a \
metrics/libzbxmetrics.a \
$(top_builddir)/src/libs/zbxsysinfo/libzbxagentsysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libfunclistsysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libfunclistsysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspechostnamesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/agent/libagentsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspecsysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspecsysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \
$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/alias/libalias.a \

--- src/zabbix_proxy/Makefile.in.orig 2025-01-06 10:52:21.626624500 +0000
+++ src/zabbix_proxy/Makefile.in 2025-01-22 20:10:52.039262407 +0000
@@ -149,7 +149,7 @@
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \
$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspechostnamesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/alias/libalias.a \
$(top_builddir)/src/libs/zbxscripts/libzbxscripts.a \
$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
@@ -597,7 +597,7 @@
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \
$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \
$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
- $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+ $(top_builddir)/src/libs/zbxsysinfo/linux/libspechostnamesysinfo.a \
$(top_builddir)/src/libs/zbxsysinfo/alias/libalias.a \
$(top_builddir)/src/libs/zbxscripts/libzbxscripts.a \
$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
36 changes: 36 additions & 0 deletions spk/zabbix-agent/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
SPK_NAME = zabbix-agent
SPK_VERS = 7.2.2
SPK_REV = 1
SPK_ICON = src/zabbix.png

DEPENDS = cross/zabbix-agent

MAINTAINER = SynoCommunity
DESCRIPTION = Monitor anything - networks, cloud, websites, IoT, and more. Zabbix Agnet is a Zabbix daemon for monitoring of various server parameters.
DISPLAY_NAME = Zabbix Agent

CHANGELOG = "Initial package release."

HOMEPAGE = https://www.zabbix.com
LICENSE = AGPLv3

SERVICE_USER = auto
STARTABLE = yes
SERVICE_SETUP = src/service-setup.sh
WIZARDS_DIR = src/wizard/

# agent does not have an UI
NO_SERVICE_SHORTCUT = yes
SERVICE_PORT = 10050

POST_STRIP_TARGET = zabbix-agent_extra_install

SPK_COMMANDS = bin/zabbix_get bin/zabbix_sender

include ../../mk/spksrc.spk.mk

.PHOHNY: zabbix-agent_extra_install
zabbix-agent_extra_install:
@$(MSG) "Add configuration file"
@install -d -m 755 $(STAGING_DIR)/var/zabbix_agentd.conf.d
@install -m 644 src/zabbix_agentd.conf $(STAGING_DIR)/var/zabbix_agentd.conf
28 changes: 28 additions & 0 deletions spk/zabbix-agent/src/service-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Package Configuration
CONFIG_FILE="${SYNOPKG_PKGVAR}/zabbix_agentd.conf"

SERVICE_COMMAND="${SYNOPKG_PKGDEST}/sbin/zabbix_agentd -c ${CONFIG_FILE}"


validate_preinst ()
{
if [ -z "${wizard_Hostname}" -a -n "${wizard_ServerActive}" ]; then
echo "Invalid Configuration. Empty Hostname is not allowed when ServerActiv is configured."
exit 1
fi
}


service_postinst ()
{
# apply wizard variables in config file

# Server=
sed -e "s|@@wizard_Server@@|${wizard_Server}|g" -i ${CONFIG_FILE}

# ServerActive=
sed -e "s|@@wizard_ServerActive@@|${wizard_ServerActive}|g" -i ${CONFIG_FILE}
# Hostname=
sed -e "s|@@wizard_Hostname@@|${wizard_Hostname}|g" -i ${CONFIG_FILE}
}
63 changes: 63 additions & 0 deletions spk/zabbix-agent/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[
{
"step_title": "Zabbix Server Configuration",
"items": [
{
"desc": "Please configure at least one Zabbix Server or Proxy for this Agent."
},
{
"desc": "Enter a list of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies. <br/>Incoming connections will be accepted only from the hosts listed here.<br/>This Agent provides IPv6 support, so <code>127.0.0.1</code>, <code>::127.0.0.1</code>, <code>::ffff:127.0.0.1</code> are treated equally and <code>::/0</code> will allow any IPv4 or IPv6 address. <code>0.0.0.0/0</code> can be used to allow any IPv4 address."
},
{
"type": "textfield",
"desc": "<b>Option: Server</b><br/>IP address or DNS name (address:port) or cluster (address:port;address2:port) of Zabbix server to get configuration data from and send data to.<br/>Cluster nodes need to be separated by semicolon.<br/>Example: 127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com",
"subitems": [
{
"key": "wizard_Server",
"desc": "Server",
"defaultValue": "",
"validator": {
"allowBlank": false
}
}
]
}
]
},
{
"step_title": "Zabbix Active Checks Configuration",
"items": [
{
"desc": "Optionally configure active checks and Hostname."
},
{
"type": "textfield",
"desc": "<b>Option: ServerActive</b><br/>Zabbix server/proxy address or cluster configuration to get active checks from.<br/>Server/proxy address is IP address or DNS name and optional port separated by colon.<br/>Example: 127.0.0.1:10051",
"subitems": [
{
"key": "wizard_ServerActive",
"desc": "ServerActive",
"defaultValue": "",
"validator": {
"allowBlank": true
}
}
]
},
{
"type": "textfield",
"desc": "<b>Option: Hostname</b><br/>List of comma delimited unique, case sensitive hostnames.<br/>Required for active checks and must match hostnames as configured on the server.<br/>Example: Zabbix server",
"subitems": [
{
"key": "wizard_Hostname",
"desc": "Hostname",
"defaultValue": "",
"validator": {
"allowBlank": true
}
}
]
}
]
}
]
Binary file added spk/zabbix-agent/src/zabbix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading