Skip to content

Commit

Permalink
zabbix-agent: update installation wizard
Browse files Browse the repository at this point in the history
- add options to configure ServerActive and Hostname
- do not accept empty Hostname when ServerActive is configured
  • Loading branch information
hgy59 committed Jan 27, 2025
1 parent e631711 commit e763c19
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 30 deletions.
4 changes: 2 additions & 2 deletions spk/zabbix-agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPK_ICON = src/zabbix.png
DEPENDS = cross/zabbix-agent

MAINTAINER = SynoCommunity
DESCRIPTION = Monitor anything - networks, cloud, websites, IoT, and more.
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."
Expand All @@ -32,5 +32,5 @@ 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
@install -d -m 755 $(STAGING_DIR)/var/zabbix_agentd.conf.d
@install -m 644 src/zabbix_agentd.conf $(STAGING_DIR)/var/zabbix_agentd.conf
17 changes: 13 additions & 4 deletions spk/zabbix-agent/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ 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}

## not yet defined, must currently be empty

# ServerActive=
sed -e "s|@@wizard_ServerActive@@|${wizard_ServerActive}|g" -i ${CONFIG_FILE}

# Hostname=
sed -e "s|@@wizard_Hostname@@|${wizard_Hostname}|g" -i ${CONFIG_FILE}
}

84 changes: 61 additions & 23 deletions spk/zabbix-agent/src/wizard/install_uifile
Original file line number Diff line number Diff line change
@@ -1,25 +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."
},
{
"desc": "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": "Example: 127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com",
"subitems": [{
"key": "wizard_Server",
"desc": "Zabbix Server",
"defaultValue": "",
"validator": {
"allowBlank": false
}
}]
}]
}]
{
"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
}
}
]
}
]
}
]
2 changes: 1 addition & 1 deletion spk/zabbix-agent/src/zabbix_agentd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ServerActive=@@wizard_ServerActive@@
# Default:
# Hostname=

#Hostname=Zabbix server
Hostname=@@wizard_Hostname@@

### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
Expand Down

0 comments on commit e763c19

Please sign in to comment.