Skip to content

Creating Custom Low Level Discovery Rules - Part 2

Video Lecture

Creating Custom Low Level Discovery Rules - Part 2 Creating Custom Low Level Discovery Rules - Part 2

Create A New Template

It is now time to create a template that uses the new service.discovery UserParameter as the key.

Configuration ⇾ Templates ⇾ Create Template

Key Value
Name Linux Services by Sean
groups Linux Servers

Press ADD

Create A New Discovery Rule

Go into it's Discovery Rules tab and press the 'Create Discovery Rule' button.

Key Value
Name Service Discovery
Type Zabbix Agent (active)
key service.discovery
Update Interval 1h

Press ADD

Create Prototypes

Using the other 2 user parameters from the last lesson, we can create prototypes that will use them.

Test that the two extra user parameters work.

zabbix_agentd -t service.isactive[zabbix-agent]

1 = Yes and 0 = No

zabbix_agentd -t service.activatedtime[zabbix-agent]

Each time the service is restarted, the activatedtime is reset to now.

Item Prototypes

Now to create some item prototypes.

Go to the 'Item Prototypes' tab and press the 'Create Item Prototype' button.

Is Service Active

This item will be used to check if a service status is active or not.

Key Value
Name Service Active : {#SERVICE}
Type Zabbix Agent (active)
Key service.isactive["{#SERVICE}"]
Type of info Numeric (unsigned)
Update Interval 1m
Create Enabled Un-ticked (optional)

Press ADD

Service Activated Time

This item will be used to detect when a service is restarted since the ActiveEnterTimestampMonotonic property returned by the systemctl command will have changed.

Key Value
Name Service Activated Time : {#SERVICE}
Type Zabbix Agent (active)
Key service.activatedtime["{#SERVICE}"]
Type of info Numeric (unsigned)
Update Interval 1m
Create Enabled Un-ticked (optional)

Press ADD

Trigger Prototypes

Now to create a trigger prototype that monitors the new items that will be created.

Go to the 'Trigger Prototypes' tab and press the 'Create Item Prototype' button.

Trigger Service Not Active

This trigger will fire when the service is not active.

Key Value
Name Service Not Active : {#SERVICE}
Severity Disaster (Optional)
Expression last(/Linux Services by Sean/service.isactive["{#SERVICE}"])=0
OK event generation Expression
Create Enabled Un-ticked (optional)

Trigger Service Restarted

This trigger will fire when the service.activatedtime for a service changes.

Key Value
Name Service Restarted : {#SERVICE}
Severity Warning (Optional)
Expression change(/Linux Services by Sean/service.activatedtime["{#SERVICE}"])<>0
OK event generation Expression
Create Enabled Un-ticked (optional)

Add The Template To A Host

Go into Configuration ⇾ Hosts, select your host, and add the Service Discovery template.

After some time, you can inspect the new data using the Monitoring ⇾ Latest Data tab and also see the Host items.

Comments