Ad Widget

Collapse

Templates Triggers and (remote)actions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hans dmacron0
    Junior Member
    • Aug 2010
    • 10

    #1

    Templates Triggers and (remote)actions

    Hi,

    Sorry I always find it hard to write good titles.

    What I mean is.

    I want to monitor if httpd is running and if not it needs a restart.

    Reading the manual I need to make a remote action like this:

    host:/etc/init.d/httpd restart (and replace host with my servername)

    or I can do this:

    hostgroup#/etc/init.d/httpd restart

    But I created a seperate template that just checks if http is down and if so it should somehow restart httpd on the server where it is down.

    I created the item and the trigger and I have an action that can send a remote action.

    But I have no clue how my trigger will execute my action. I do not see how to connect them.

    The second problem,once I get actions working,is how can I tell the action script which host to use.

    I really like to have one action script for restarting apache on the same type of servers. So the host needs to be passed to the action script somehow.

    Does anyone have any suggestions how to do this or where to look?

    thank you

    Hans de Groot
  • Hans dmacron0
    Junior Member
    • Aug 2010
    • 10

    #2
    Sorry, I was blind again.

    I found the Action conditions.

    So now I can link triggers with actions.

    But that leaves the question of how to tell the remote action command which on host it should execute.

    Comment

    • Hans dmacron0
      Junior Member
      • Aug 2010
      • 10

      #3
      Hi back again.

      I managed to change

      host:/etc/init.d/httpd restart

      to

      {HOSTNAME}:/etc/init.d/httpd restart

      Now it is actually restarting and emailing action info to me.

      But now I have another question.

      The restart script works perfect.

      So just in case httpd crashes once a year I just need it to try a restart and only complain about it (ie send me a message) when the process is still down after say 15 minutes and I also want to know immediatly when it is back up.

      When I look at the edit actions screen there is a column "delay" and it states immediatly. Again I have been searching hi and low where I can change this value. If I disable "Enable escaltions" that column is hidden.

      Does any one have any suggestions how to do this?

      Thanks

      Hans

      Comment

      • Bill Wang
        Member
        • Jul 2010
        • 66

        #4
        The following are my zabbix settings:
        Agent side:
        comment "Defaults requiretty" in /etc/sudoers
        add line "zabbix ALL=(ALL) NOPASSWD: ALL" in /etc/sudoers

        Server side:
        remote command:
        {HOSTNAME}:sudo /etc/init.d/lighttpd restart
        action conditions:
        trigger=lighttpd
        trigger value=PROBLEM

        When lighttpd trigger status is PROBLEM, the remote command will be send to {HOSTNAME} to be excute.

        Comment

        • bashman
          Senior Member
          • Dec 2009
          • 432

          #5
          How can I "Run a remote command" on a recovery trigger?.

          Zabbix activates maintenance mode for Zabbix GUI when iowait is high with a remote command, this are the action conditions:

          (A) Trigger = "hostname:iowait"
          (B) Trigger value = "PROBLEM"

          And remote command works fine, but I want to deactivate maintenance mode when trigger recoveries.

          Just like recovery message, but with remote commands, is it possible?.
          978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

          Comment

          • bashman
            Senior Member
            • Dec 2009
            • 432

            #6
            Ok, just using condition Trigger value="OK" instead of Triger value="PROBLEM"
            978 Hosts / 16.901 Items / 8.703 Triggers / 44 usr / 90,59 nvps / v1.8.15

            Comment

            Working...