Skip to content
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
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,27 @@ The installer adds the official Zabbix apt repository, so minor/patch updates **
```bash
sudo apt-get update
sudo apt-get install --only-upgrade 'zabbix-proxy*' 'zabbix-sql-scripts'
sudo systemctl restart zabbix-proxy-sqlite3 # or zabbix-proxy-mysql / -pgsql to match your DB
sudo systemctl restart zabbix-proxy
```

To move to a **new major version** (e.g. 7.0 → 7.4), the repository definition itself must change. Re-run the installer and enter the new version when prompted — it adds the new repo and upgrades in place.

> The systemd unit is **`zabbix-proxy`** whichever database backend you chose — all three packages (`zabbix-proxy-sqlite3`, `-mysql`, `-pgsql`) ship the same `zabbix-proxy.service`. There is no `zabbix-proxy-sqlite3.service`.

##### ICMP checks need fping

The proxy uses `fping` for all `icmpping*` items, and Zabbix looks for it at `/usr/sbin/fping` by default — but Debian and Ubuntu install it to `/usr/bin/fping`. The installer now adds the package and writes the detected path into the config.

Proxies built before that change have neither, so **every ping check behind them fails silently** while the log fills with `At least one of '/usr/sbin/fping', '/usr/sbin/fping6' must exist`. To check and fix an existing proxy:

```bash
command -v fping; grep -E '^Fping' /etc/zabbix/zabbix_proxy.conf # both empty = affected

sudo apt-get install -y fping
printf '\nFpingLocation=/usr/bin/fping\nFping6Location=/usr/bin/fping6\n' | sudo tee -a /etc/zabbix/zabbix_proxy.conf
sudo systemctl restart zabbix-proxy
```

### Zabbix Agent

Installs Zabbix Agent 2 on systems to be monitored. Configures it to connect to a local proxy.
Expand Down
32 changes: 31 additions & 1 deletion install-zabbix-proxy-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,33 @@ log_ok "Repository added"
# --- Install packages --------------------------------------------------------
print_section "Installing Packages"

PACKAGES=("$PROXY_PACKAGE" "zabbix-sql-scripts")
# fping is required for ICMP checks (icmpping / icmppingsec / icmppingloss).
# Without it every ping item on every host behind this proxy fails as
# "unsupported", and the proxy logs the missing-binary error once a second.
PACKAGES=("$PROXY_PACKAGE" "zabbix-sql-scripts" "fping")
[[ "$DB_TYPE" == "MySQL" ]] && PACKAGES+=("default-mysql-client")
[[ "$DB_TYPE" == "PostgreSQL" ]] && PACKAGES+=("postgresql-client")

log_info "Installing: ${PACKAGES[*]}"
DEBIAN_FRONTEND=noninteractive apt-get install -y -q "${PACKAGES[@]}"
log_ok "Packages installed"

# Locate fping rather than assuming a path: Debian/Ubuntu ship it in /usr/bin,
# while Zabbix defaults to /usr/sbin/fping. Guessing wrong is exactly what makes
# ICMP checks fail silently.
FPING_BIN=$(command -v fping 2>/dev/null || true)
FPING6_BIN=$(command -v fping6 2>/dev/null || true)
FPING_BLOCK=""
if [[ -n "$FPING_BIN" ]]; then
FPING_BLOCK="FpingLocation=${FPING_BIN}"
log_ok "fping found at $FPING_BIN"
else
log_warn "fping not found — ICMP (ping) checks will not work on this proxy"
fi
if [[ -n "$FPING6_BIN" ]]; then
FPING_BLOCK="${FPING_BLOCK}${FPING_BLOCK:+$'\n'}Fping6Location=${FPING6_BIN}"
fi

# --- Database setup ----------------------------------------------------------
if [[ "$DB_SETUP_NEEDED" == "true" ]]; then
print_section "Database Setup"
Expand Down Expand Up @@ -451,6 +470,8 @@ ProxyBufferMode=hybrid
ProxyMemoryBufferSize=64M

Timeout=10

${FPING_BLOCK}
EOF

chown root:zabbix "$PROXY_CONF"
Expand All @@ -459,6 +480,15 @@ log_ok "Configuration written to $PROXY_CONF"

# --- Enable and start --------------------------------------------------------
print_section "Starting Service"

# Validate before starting so a config error reports the proxy's own message
# rather than a bare systemd exit code.
log_info "Validating configuration..."
if ! CONFIG_TEST=$(zabbix_proxy -T -c "$PROXY_CONF" 2>&1); then
echo "$CONFIG_TEST" | sed 's/^/ /'
die "Configuration test failed — not starting the proxy"
fi
log_ok "Configuration valid"
systemctl daemon-reload
systemctl enable zabbix-proxy --quiet
systemctl restart zabbix-proxy
Expand Down
37 changes: 34 additions & 3 deletions install-zabbix-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,28 @@ log_ok "Repository added"

# --- Install packages --------------------------------------------------------
print_section "Installing Packages"
log_info "Installing $PROXY_PACKAGE..."
DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$PROXY_PACKAGE"
log_ok "Package installed"
# fping is required for ICMP checks (icmpping / icmppingsec / icmppingloss).
# Without it every ping item on every host behind this proxy fails as
# "unsupported", and the proxy logs the missing-binary error once a second.
log_info "Installing $PROXY_PACKAGE and fping..."
DEBIAN_FRONTEND=noninteractive apt-get install -y -q "$PROXY_PACKAGE" fping
log_ok "Packages installed"

# Locate fping rather than assuming a path: Debian/Ubuntu ship it in /usr/bin,
# while Zabbix defaults to /usr/sbin/fping. Guessing wrong is exactly what makes
# ICMP checks fail silently.
FPING_BIN=$(command -v fping 2>/dev/null || true)
FPING6_BIN=$(command -v fping6 2>/dev/null || true)
FPING_BLOCK=""
if [[ -n "$FPING_BIN" ]]; then
FPING_BLOCK="FpingLocation=${FPING_BIN}"
log_ok "fping found at $FPING_BIN"
else
log_warn "fping not found — ICMP (ping) checks will not work on this proxy"
fi
if [[ -n "$FPING6_BIN" ]]; then
FPING_BLOCK="${FPING_BLOCK}${FPING_BLOCK:+$'\n'}Fping6Location=${FPING6_BIN}"
fi

# --- Prepare SQLite directory ------------------------------------------------
print_section "Preparing Database"
Expand Down Expand Up @@ -327,6 +346,8 @@ ProxyBufferMode=hybrid
ProxyMemoryBufferSize=64M

Timeout=10

${FPING_BLOCK}
EOF

chown root:zabbix "$PROXY_CONF"
Expand All @@ -335,6 +356,16 @@ log_ok "Configuration written to $PROXY_CONF"

# --- Enable and start --------------------------------------------------------
print_section "Starting Service"

# Validate before starting so a config error reports the proxy's own message
# rather than a bare systemd exit code.
log_info "Validating configuration..."
if ! CONFIG_TEST=$(zabbix_proxy -T -c "$PROXY_CONF" 2>&1); then
echo "$CONFIG_TEST" | sed 's/^/ /'
die "Configuration test failed — not starting the proxy"
fi
log_ok "Configuration valid"

systemctl daemon-reload
systemctl enable zabbix-proxy --quiet
systemctl restart zabbix-proxy
Expand Down