Linux Network Monitoring

Monitoring services using Zabbix

zabbix

For critical production servers and services, monitoring is very critical. One is to get notified about issues immediately and the second is to resolve quickly hence not affecting SLA. Here, I will be showing you how to monitor systemctl services using Zabbix, basic Zabbix template, and very easy Linux commands. The traditional way of monitoring services is by monitoring the ports associated with the services, however in some cases/environments, critical services have to be monitored E.g. (squid), hence in this post, you will see how to monitor services using service names and not ports on Linux servers. Some other guides can be found in these links: Practical use of SELinux in production: How to locate directory file context and restore it ,how-to-create-a-static-pod-in-kubernetes-with-demos-that-can-help-you-become-a-better-kubernetes-administrator,how-to-create-and-deliver-a-report-on-system-utilization-on-a-Linux-based-os/, and how-to-use-container-insights-to-get-the-full-benefits-of-azure-monitor-for-azure-kubernetes-workload/

Note: To do this, you should already have Zabbix monitoring tool installed in your environment.

First, check the services running

systemctl | grep running 
image-1

Take a note of whatever service name you will want to monitor, Log in to your Zabbix console and create a new template and application.

Configuration -> Templates -> Create template
image-2

Create New application on Zabbix console  – > systemctl status

image-3

Create an item for whatever service name you want to monitor

image-4
image-5

Create individual Alert triggers

image-6

Trigger expression

{service monitoring using systemctl:system.run["systemctl status chronyd | grep -q running;echo $?"].last()}=1

Please change the service name in the expression to your configured service name. Once Items and triggers have been created on the services needed, test or simulate the new configurations by stopping services.

image-7

Now check Zabbix console

image-8
Subscribe
Notify of
guest
7 Comments
Inline Feedbacks
View all comments
Sidheswar Biswal
Sidheswar Biswal
5 months ago

image not showing clearly

mark burke
mark burke
4 months ago

Hello, I’ve configured this but it’s not triggering the alert. Do i need to open a port from the zabbix server to the host?

Andy
Andy
2 months ago

I added the item but got an Unsupported item key error.

antoine pacaud
antoine pacaud
14 days ago
Reply to  Andy

Did you add AllowKey=system.run[*] in the agent configuration file ?

antoine pacaud
antoine pacaud
14 days ago

Thanks it works for me with a zabbix version 5.4.9.
But I had to change the format of the trigger because of that version :

last(/Template_name/system.run[“systemctl status service_name | grep -q running; echo $?”])=1

And in requirements I had to add “AllowKey=system.run[*]” in the agent configuration file.

7
0
Would love your thoughts, please comment.x
()
x