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

How to make it running? #20

Closed bkt1916 closed 4 years ago

bkt1916 commented 4 years ago

Hi, i am new to zabbix and trying to monitor services with your script. I do not exactly know what to do to make it working. I tried to use your manual but i can not see its wotking.

When i manually run your test (zabbix_agentd -t "systemd.service.discovery" zabbix_agentd -t "systemd.service.status[sshd]" zabbix_agentd -t "systemd.service.restart[sshd]") i got this: [login@host bin]$ zabbix_agentd -t "systemd.service.discovery" systemd.service.discovery [m|ZBX_NOTSUPPORTED] [Unsupported item key.] [login@host bin]$ zabbix_agentd -t "systemd.service.status[sshd]" systemd.service.status[sshd] [m|ZBX_NOTSUPPORTED] [Unsupported item key.]

Its Centos 8 on AWS free tier.

Should i do any other "clicks" on web gui of zabbix to get any items there? Or your script should find this services and it should be visible in zabbix? What exactly owners should be on this files? How can i see logs of your script?

OH its zabbix 4.0 LTS.

bkt1916 commented 4 years ago

OK, in agentd.conf i added with Include option your config and owner on zabbix user and now when i test it i got answers: [root@s1c zabbix_agentd.d]# zabbix_agentd -t "systemd.service.discovery" systemd.service.discovery [t|{"data":[{"{#SERVICE}": "atd"},{"{#SERVICE}": "auditd"},{"{#SERVICE}": "chronyd"},{"{#SERVICE}": "crond"},{"{#SERVICE}": "dbus-org.fedoraproject.FirewallD1"},{"{#SERVICE}": "firewalld"},{"{#SERVICE}": "httpd"},{"{#SERVICE}": "irqbalance"},{"{#SERVICE}": "kdump"},{"{#SERVICE}": "mariadb"},{"{#SERVICE}": "microcode"},{"{#SERVICE}": "postfix"},{"{#SERVICE}": "qemu-guest-agent"},{"{#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}": "sinusbot"},{"{#SERVICE}": "sshd"},{"{#SERVICE}": "systemd-readahead-collect"},{"{#SERVICE}": "systemd-readahead-drop"},{"{#SERVICE}": "systemd-readahead-replay"},{"{#SERVICE}": "teamspeak"},{"{#SERVICE}": "tuned"},{"{#SERVICE}": "zabbix-agent"}]}] [root@s1c zabbix_agentd.d]# zabbix_agentd -t "systemd.service.status[sshd]" systemd.service.status[sshd] [t|0] [root@s1c zabbix_agentd.d]# zabbix_agentd -t "systemd.service.restart[sshd]" systemd.service.restart[sshd] [t|0] [root@s1c zabbix_agentd.d]# zabbix_agentd -t "systemd.service.status[teamspeak]" systemd.service.status[teamspeak]

So as i understand its ok? But it only shows "0" for teamspeak when service is running. What should i do and where to see status of teamspeak deamon?

bkt1916 commented 4 years ago

Ok now its working and it showed up in zabbix. Last question. If i install new soft and its added to systemctl it will show up in zabbix on its own?

MogiePete commented 4 years ago

If you followed the directions correctly the system will run the service discovery every day to detect new services.