Skip to content

Instantly share code, notes, and snippets.

@jelly
Last active January 19, 2021 14:00
Show Gist options
  • Save jelly/d6b5a71236ba1e07ffacc5ba64457f1b to your computer and use it in GitHub Desktop.
Save jelly/d6b5a71236ba1e07ffacc5ba64457f1b to your computer and use it in GitHub Desktop.
Zabbix adding a systemd service trigger
# Adding a new systemd service trigger in Zabbix
## Create a template
1. Go to the "configuration" tab at the top
2. Select "templates in the second navigation
3. Click "create template"
4. As template name enter "Template App $application"
5. Add the "Templates" to the "In groups"
6. Add a description describing the template
7. Click the "add" button
## Configure Template
1. Click on the template you just created
2. From the 3rd navigation bar click on the "items" link.
3. Click on "create item" in the top right
4. Enter a name
5. As key add "systemd.unit.is-active[$systemdservice]" for nginx $systemdservice would be "nginx"
6. Change "Data type" to "Boolean"
7. Update the "Update interval" to 60 seconds
8. Change the "History storage period" to 7 days
9. Change "Show value" to "Service state"
10. In the "New application" field, enter a new application and click "Update".
## Add the template to the host
1. Click on hosts in the 2nd navigation
2. Click on the host which needs to use the template and go to template in the 4th navigation
3. Search and select the newly created template and click "Add"
4. Then update the templates.
## Adding a trigger
1. Go to the "configuration" tab at the top
2. Select "templates in the second navigation
3. Select the newly created template
4. Click on "triggers"
5. Click on "create trigger"
6. For the name is something like "$application is not running"
7. Set a severity
8. As expression set "{Template App $AppName:systemd.unit.is-active[$systemdservice].last()}=0"
9. Click "Add"
# Testing commands on the host
zabbix_agentd -t "systemd.unit.is-failed[security-tracker-update]"
@prahalladagrg
Copy link

I tried exact steps no luck

@drewmace
Copy link

Wished this worked as well...when testing i get
systemd.unit.is-active[controller] [m|ZBX_NOTSUPPORTED] [Unsupported item key.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment