8 Discovery of systemd services
The item to use in the discovery rule is the
This key is only supported in Zabbix agent 2.
"{#UNIT.NAME}": "mysqld.service",
"{#UNIT.DESCRIPTION}": "MySQL Server",
"{#UNIT.LOADSTATE}": "loaded",
"{#UNIT.ACTIVESTATE}": "active",
"{#UNIT.SUBSTATE}": "running",
"{#UNIT.PATH}": "/org/freedesktop/systemd1/unit/mysqld_2eservice",
"{#UNIT.JOBID}": 0,
"{#UNIT.JOBTYPE}": "",
"{#UNIT.UNITFILESTATE}": "enabled"
}, {
"{#UNIT.NAME}": "systemd-journald.socket",
"{#UNIT.DESCRIPTION}": "Journal Socket",
"{#UNIT.LOADSTATE}": "loaded",
"{#UNIT.ACTIVESTATE}": "active",
"{#UNIT.SUBSTATE}": "running",
"{#UNIT.PATH}": "/org/freedesktop/systemd1/unit/systemd_2djournald_2esocket",
"{#UNIT.JOBTYPE}": "",
"{#UNIT.JOBPATH}": "/",
"{#UNIT.UNITFILESTATE}": "enabled"
}]
Discovery of disabled systemd units
Since Zabbix 6.0.1 it is also possible to discover disabled systemd units. In this case three macros are returned in the resulting JSON:
- {#UNIT.PATH}
- {#UNIT.ACTIVESTATE}
- {#UNIT.UNITFILESTATE}.
To have items and triggers created from prototypes for disabled systemd units, make sure to adjust (or remove) prohibiting LLD filters for {#UNIT.ACTIVESTATE} and {#UNIT.UNITFILESTATE}.
Item prototypes that can be created based on systemd service discovery include, for example:
- Item name:
{#UNIT.DESCRIPTION}
; item key:systemd.unit.info["{#UNIT.NAME}"]
- Item name:
{#UNIT.DESCRIPTION}
; item key:systemd.unit.info["{#UNIT.NAME}",LoadState]
systemd.unit.info
are supported since Zabbix 4.4.