8 Discovery of systemd services

The item to use in the discovery rule is the

This key is only supported in Zabbix agent 2.

  1. "{#UNIT.NAME}": "mysqld.service",
  2. "{#UNIT.DESCRIPTION}": "MySQL Server",
  3. "{#UNIT.LOADSTATE}": "loaded",
  4. "{#UNIT.ACTIVESTATE}": "active",
  5. "{#UNIT.SUBSTATE}": "running",
  6. "{#UNIT.PATH}": "/org/freedesktop/systemd1/unit/mysqld_2eservice",
  7. "{#UNIT.JOBID}": 0,
  8. "{#UNIT.JOBTYPE}": "",
  9. "{#UNIT.UNITFILESTATE}": "enabled"
  10. }, {
  11. "{#UNIT.NAME}": "systemd-journald.socket",
  12. "{#UNIT.DESCRIPTION}": "Journal Socket",
  13. "{#UNIT.LOADSTATE}": "loaded",
  14. "{#UNIT.ACTIVESTATE}": "active",
  15. "{#UNIT.SUBSTATE}": "running",
  16. "{#UNIT.PATH}": "/org/freedesktop/systemd1/unit/systemd_2djournald_2esocket",
  17. "{#UNIT.JOBTYPE}": "",
  18. "{#UNIT.JOBPATH}": "/",
  19. "{#UNIT.UNITFILESTATE}": "enabled"
  20. }]
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.