Ad Widget

Collapse

Monitoring service via Zabbix Agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • new2zabbix925
    Junior Member
    • Nov 2017
    • 2

    #1

    Monitoring service via Zabbix Agent

    Hello, I've installed and been using Zabbix 3.4 for the past 2 days. I am trying to create a simple trigger that alerts whenever a service is down on a server that has Zabbix Agent installed.

    I have configured the UserParameter in the Zabbix Agent configuration file:
    UserParameter=testing,systemctl is-active nginx

    On the Zabbix server side, I've configured the template, the item (with the key set to "testing" and Type of information set to "Text"), and a trigger of {template:testing.regexp(inactive)}=0

    I simulated the process by stopping the service and it triggers as expected (Dashboard showing the status 'PROBLEM') but when I start the service again, it should be showing the status 'RESOLVED'.

    Am I doing something wrong here? Please enlighten. Thank you and have a nice day.
  • Pitons
    Member
    • Oct 2017
    • 49

    #2
    Hi

    Open triger and find:
    OK event generation put it on "Recovery expression"
    {template:testing.regexp(inactive)}=[VALUE of OK state]

    should work then!

    Comment

    • kaspars.mednis
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Oct 2017
      • 349

      #3
      Your trigger expression is wrong, because your function
      {template:testing.regexp(inactive)}=0
      means to fire a trigger when *inactive is not found*, i wonder how you get it working...
      regexp returns:1 - found 0 - otherwise

      change it to
      Code:
      template:testing.regexp(inactive)}=1
      or
      Code:
      template:testing.str(inactive)}=1
      you dont need a recovery expression there

      tested on Centos 7.4, both triggers works like a charm

      P.S

      you can make your user parameter more universal, by changing it to
      Code:
      UserParameter=testing[*],systemctl is-active $1
      then you can check every systemctl supported service by using

      Code:
      testing[service_name]
      Regards,
      Kaspars

      Comment

      • new2zabbix925
        Junior Member
        • Nov 2017
        • 2

        #4
        @Pitons: Thank you!

        @Kaspars: Ah maybe I was doing too much changes that I get confused. Thank you!

        Cheers

        Comment

        Working...