Skip to content

Zabbix Integration

Yoichi Takizawa edited this page Feb 15, 2026 · 2 revisions

Zabbix Integration

apcget supports sending all UPS status items to Zabbix via zabbix_sender (trapper items).

Prerequisites

Install zabbix_sender:

# RHEL / Amazon Linux
sudo dnf install zabbix-sender

# Ubuntu / Debian
sudo apt install zabbix-sender

# macOS (Homebrew)
brew install zabbix

Zabbix Host Setup

Create a host in Zabbix (e.g., ups-living) and add the following trapper items:

Key Type Description
apc.status Text Device status
apc.load Numeric (float) UPS load (%)
apc.runtime Numeric (unsigned) Runtime remaining (min)
apc.voltage Numeric (float) Input voltage (VAC)
apc.battery Numeric (float) Battery charge (%)
apc.batteryvoltage Numeric (float) Battery voltage (VDC)

Steps to create trapper items

  1. Go to Data collection > Hosts > select your host
  2. Click Items > Create item
  3. Set:
    • Name: e.g., UPS Load
    • Type: Zabbix trapper
    • Key: e.g., apc.load
    • Type of information: e.g., Numeric (float)
  4. Repeat for all 6 items

Sending Data

python3 apcget.py 192.168.1.100 your_username your_password \
  --zabbix-send 10.0.0.1 \
  --zabbix-host ups-living
Option Description Default
--zabbix-send Zabbix server address (none)
--zabbix-host Host name in Zabbix IP address
--zabbix-port Zabbix server port 10051

When --zabbix-send is specified, all 6 items are retrieved and sent at once. Normal stdout output is suppressed.

Automating with cron

* * * * * /usr/bin/python3 /path/to/apcget.py --config /path/to/.apcget.conf --zabbix-send 127.0.0.1 --zabbix-host ups-living >/dev/null 2>&1

Multiple UPS units

* * * * * /usr/bin/python3 /home/user/apcget.py --config /home/user/.apcget-ups1.conf --zabbix-send 127.0.0.1 --zabbix-host ups-1 >/dev/null 2>&1
* * * * * /usr/bin/python3 /home/user/apcget.py --config /home/user/.apcget-ups2.conf --zabbix-send 127.0.0.1 --zabbix-host ups-2 >/dev/null 2>&1

Installing cron on Amazon Linux

sudo dnf install cronie
sudo systemctl enable --now crond

Verifying Data in Zabbix

  1. Go to Monitoring > Latest data
  2. Filter by the host name (e.g., ups-living)
  3. Confirm that all 6 items have recent values

Clone this wiki locally