MogiePete / zabbix-systemd-service-monitoring

Simple Zabbix Template to discover, monitor, and alert on systemd services.
GNU General Public License v2.0
91 stars 41 forks source link

Bug in zbx_service_discovery.sh #28

Open leonanu opened 4 years ago

leonanu commented 4 years ago

If a service unit file named foo-service.service, the zbx_service_discovery.sh will not cut the filename crorrectly.

awk -F'.service' '{print $1}') Fix: awk -F'\\.service' '{print $1}')

netoayres commented 3 years ago
  1. If you have a service that has @ in its name, and it's not in the service_discovery_whitelist, zabbix creates the item. eg getty@.service

  2. If you have a service that the name matches with other service names, but are outside the service_discovery_whitelist, zabbix creates the item.

ex.: cat service_discovery_whitelist Result servicename|ssh|etc

But you have a service with the name = servicename_test.service Zabbix creates servicename_test item.

Edit zbx_service_discovery.sh

service_list=$(echo "$service_list" | grep -E -f /etc/zabbix/service_discovery_whitelist)

Fix:

service_list=$(echo "$service_list" | grep -Eiowf /etc/zabbix/service_discovery_whitelist)