MogiePete / zabbix-systemd-service-monitoring

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

Problem Json #10

Closed Arnros closed 5 years ago

Arnros commented 5 years ago

Hello,

In zabbix I have this error for the discovery :

Value should be a JSON object.

when I run the script "zbx_service_discovery.sh" I have this :

./zbx_service_discovery.sh
{"data":[{"{#SERVICE}": "atd"},{"{#SERVICE}": "auditd"},{"{#SERVICE}": "crond"},{"{#SERVICE}": "irqbalance"},{"{#SERVICE}": "lvm2-monitor"},{"{#SERVICE}": "microcode"},{"{#SERVICE}": "nginx"},{"{#SERVICE}": "ntpd"},{"{#SERVICE}": "ofctl"},{"{#SERVICE}": "postfix"},{"{#SERVICE}": "rhel-autorelabel-mark"},{"{#SERVICE}": "rhel-autorelabel"},{"{#SERVICE}": "rhel-configure"},{"{#SERVICE}": "rhel-dmesg"},{"{#SERVICE}": "rhel-domainname"},{"{#SERVICE}": "rhel-import-state"},{"{#SERVICE}": "rhel-loadmodules"},{"{#SERVICE}": "rhel-readonly"},{"{#SERVICE}": "rsyslog"},{"{#SERVICE}": "sshd"},{"{#SERVICE}": "systemd-readahead-collect"},{"{#SERVICE}": "systemd-readahead-drop"},{"{#SERVICE}": "systemd-readahead-replay"},{"{#SERVICE}": "tuned"},{"{#SERVICE}": "vmtoolsd"},{"{#SERVICE}": "vsftpd"},{"{#SERVICE}": "xinetd"},{"{#SERVICE}": "zabbix-agent"}]}

OS version : CentOS Linux release 7.6.1810 (Core) Zabbix Version : 4.0.2

Do you have same problem ?

Arnros commented 5 years ago

I have solve problem with this change in zabbix conf :

UserParameter=systemd.service.discovery,/bin/bash /usr/local/bin/zbx_service_discovery.sh
MogiePete commented 5 years ago

Make sure that you set the permissions on the script to be executable. You should not need to have bash run the script.

Arnros commented 5 years ago

Yes the script is executable by Zabbix user.