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

service_discovery_*list dosen't work #18

Closed fmonge closed 4 years ago

fmonge commented 4 years ago

I'm using Debian 10 and for some reason echo "$service_list" | grep -E -f /etc/zabbix/service_discovery_whitelist didn't work for me, I used echo "$service_list" | grep -Ecat /etc/zabbix/service_discovery_whitelist

~$  cat /etc/zabbix/service_discovery_whitelist
mariadb|nginx
~$ echo "$service_list" | grep -E -f /etc/zabbix/service_discovery_whitelist
autovt@
console-getty
cron
dbus-org.fedoraproject.FirewallD1
dbus-org.freedesktop.timesync1
firewalld
getty@
mariadb
mysql
mysqld
networking
nginx
postfix
rsync
rsyslog
ssh
sshd
syslog
systemd-timesyncd
zabbix-agent
~$  cat /etc/zabbix/service_discovery_whitelist
mariadb|nginx
~$ echo "$service_list" | grep -E  `cat /etc/zabbix/service_discovery_whitelist`
mariadb
nginx
fmonge commented 4 years ago

or write a service in service_discovery_whitelist per line

MogiePete commented 4 years ago

@fmonge

This module is only supported on Ubuntu and Enterprise Linux variants. However I installed the version of grep shipped with Buster (3.3 compared to 3.1) and I had the same results.

The version I downloaded can be found here: http://ftp.br.debian.org/debian/pool/main/g/grep/grep_3.3-1_amd64.deb

root@zbxubnttest:/etc/zabbix# ls grep* 
grep_3.3-1_amd64.deb

root@zbxubnttest:/etc/zabbix# grep --version
grep (GNU grep) 3.3
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.

root@zbxubnttest:/etc/zabbix# uname -a
Linux zbxubnttest 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

root@zbxubnttest:/etc/zabbix# cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

root@zbxubnttest:/etc/zabbix# zabbix_agentd -t "systemd.service.discovery"
systemd.service.discovery                     [t|{"data":[{"{#SERVICE}": "sshd"},{"{#SERVICE}": "zabbix-agent"}]}]
MogiePete commented 4 years ago

@fmonge

What happens when you run /usr/local/bin/zbx_service_discovery.sh

MogiePete commented 4 years ago

@fmonge

I am unable to replicate this issue. If you continue to have problems please reopen this issue.