Ad Widget

Collapse

One restart action for multiple events

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • burn1024
    Member
    • Jun 2012
    • 52

    #1

    One restart action for multiple events

    I'm using Zabbix to monitor a service (say, httpd). There are multiple check configured (process running, tcp port open, etc). I want Zabbix to restart the service should one of the checks fail. The action condition looks like this:
    Code:
    (A or B) and C
    (A) 	Trigger = "Apache is not responding on server Template_Linux_server"
    (B) 	Trigger = "Apache process is not running on server Template_Linux_server"
    (C) 	Trigger value = "PROBLEM"
    The problem is that when the process is down, every single check triggers a restart, so I end up with multiple restart actions, which I obviously don't want. One possible solution would be to script around it in the actions themselves, but it is not too elegant and with number of checks rising this would become really messy. I'd like to keep that logic in Zabbix. Any advice on how to work around that?
  • anpat89
    Junior Member
    • Jun 2012
    • 17

    #2
    What are your "Action operations" regarding this Action. I'm guessing Remote Command but what is the command?
    Regards,
    Andrew

    Comment

    • burn1024
      Member
      • Jun 2012
      • 52

      #3
      yes, remote command. "sudo service xxx restart"

      Comment

      • anpat89
        Junior Member
        • Jun 2012
        • 17

        #4
        As you have that 1 command to run on all triggers, it seems that if the service is not responding first of all, it restarts.

        In the middle of the restart, the service is off, so the 2nd trigger is true, hence another restart and it will loop like this.

        Perhaps a way around it is to create 2 actions.
        The first entails "Apache is not responding on server Template_Linux_server".
        The action is as you have it: "sudo service xxx restart".

        The 2nd action is for: "Apache process is not running on server Template_Linux_server"
        rather then restart, make it start: "sudo service xxx start".

        In both instances you can have the value = "PROBLEM".
        Hopefully this fixes the loop that this is causing.
        Kind Regards,
        Andrew.

        Comment

        • burn1024
          Member
          • Jun 2012
          • 52

          #5
          I don't have a loop. It works just fine, except that I have 2 restarts instead of one, which I don't want. What you suggest would make it happen in 50% of cases, depending on the trigger that has fired first.

          Comment

          • anpat89
            Junior Member
            • Jun 2012
            • 17

            #6
            It would make it restart if it is not responding.
            It would make it start if it is not on.

            This will not create the same issue and should replicate the problem. Did you test it out?
            Cheers,
            Andrew

            Comment

            • burn1024
              Member
              • Jun 2012
              • 52

              #7
              No, I didn't. The action is triggered twice now. That means both actions will be triggered with suggested change. So I will end up either with
              - start + restart
              or
              - restart + start(failed)
              neither of which I want. Anyway, even if it did work, like I said, the number of checks will grow. And most of them will require a start/restart. That just doesn't fit in here.

              Comment

              • anpat89
                Junior Member
                • Jun 2012
                • 17

                #8
                Perhaps it's best I leave you to sort out your own solution as none of my advice is being heard.

                If you just have the one action: not responding.
                would that fix the problem? if a service is off isn't it also not responding? My expertise on the issue is limited.
                I tried the best I could to help.
                Regards,
                Andrew.

                Comment

                • burn1024
                  Member
                  • Jun 2012
                  • 52

                  #9
                  Perhaps you should try to better understand the problem before offering an advice. The checks could be (and will be) anything - tcp connection failed, http response code is wrong, login failed, certain page(s) does not return expected output, etc. I cannot expect one check to cover all functionality, although if such check existed, it would indeed help in this case.

                  Comment

                  Working...