Search code examples
linuxzabbix

zabbix monitor custom service on centos7


I created a service on centos 7 and I tried to configure zabbix to monitor the service, I would like to check if the service is running or not, if not trigger alert.

{my_host:net.tcp.service[my_service,127.0.0.1,11990].last()}=0

When I check the service from configuration -> hosts -> my_host -> items, I can see the status is Enabled.

the log on the machine shows:

7720.364 active check "net.tcp.service[myservice,127.0.0.1,11990]" is not supported

Please help,

Thanks.


Solution

  • The service_state item is a Windows-only agent item (and in Zabbix 3.0 it is deprecated in favour of the service.info item).

    For Linux, you'd probably create a custom item using the user parameter feature. Note that the resulting item must be of the Zabbix agent or Zabbix agent (active) type. What exactly should your custom item do? That depends on how you would determine that the service is up. You could check connectivity to your service, check output from an initscript or service management daemon and so on.

    If you would like to avoid using userparameters, two simple solutions come to mind:

    For example, to check that something is responding on TCP port 11990 you would use net.tcp.service[tcp,,11990] and set the item type to either one of the agent type, or simple check.