Ad Widget

Collapse

"Timeout while executing a shell script" retries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • javierin
    Junior Member
    • Aug 2011
    • 3

    #1

    "Timeout while executing a shell script" retries

    Hi

    We are using a shell script to do a series of checks in a trigger. This script accesses remote network services and sometimes (a few each day) it stalls and the execution returns a timeout.

    Is there any way to set a defined number of times the script fails or times out before an email is sent? We can assume a couple of consecutive failures before sending out an alert.

    Current trigger expresion is as follows:
    ({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK)})=0

    I have unsucesfully tried to modify it so it checked the previous value like this:
    (({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK)})=0)&(({host:system.run[/etc/zabbix/scripts/shellscript.sh].prev(0)})#OK)

    The script returns "OK" if everything is OK and a variable output iin case it fails. Currently we are getting alert mails only because the script times out.

    Can someone give me a hint on how to check previous values and prevent the alert message to be sent when script times out?

    Thanks
    Javier
  • Gunsthall
    Junior Member
    Zabbix Certified Specialist
    • Jul 2011
    • 15

    #2
    Hi,

    Did you solve this problem?
    I have a probel with ""timeout while executing a shell script" for a script that usually runs between 0.8 and 3.9 seconds, depending on the network.
    I think I read somewhere that Zabbix doesn t "deal" ok with external scripts thatn takes mores than 1 seconf to run, but I m not sure.

    Any idea?

    Thanks!

    Comment

    • javierin
      Junior Member
      • Aug 2011
      • 3

      #3
      Hi Gunsthall,

      I still have no clue on how to avoid this. I have temporarily disabled the check replacing it with a bash script run locally until we get a tip on how to do this.

      Regards

      Comment

      • MTWiley
        Junior Member
        • Jul 2011
        • 16

        #4
        Originally posted by javierin

        Current trigger expresion is as follows:
        ({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK)})=0

        I have unsucesfully tried to modify it so it checked the previous value like this:
        (({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK)})=0)&(({host:system.run[/etc/zabbix/scripts/shellscript.sh].prev(0)})#OK)
        Have you tried

        Code:
        (({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK)})=0)&(({host:system.run[/etc/zabbix/scripts/shellscript.sh].prev(2)})#OK)
        I haven't tried it and am rather new to zabbix myself, but my understanding is that the trigger would then be evaluated using the last two values or the value from 2 checks before.

        Comment

        • javierin
          Junior Member
          • Aug 2011
          • 3

          #5
          Still can't get this to work. One of the scripts, for instance, reports "GOOD" for the raid status check. However when the script times out on its execution, it sends a false alarm.

          This is the used trigger:
          {host:raid.check.str(GOOD)}#1

          What i'm trying to set up is a trigger in such a way that if the script fails or returns a "BAD", will check for the previous returned value. If the previous value was also not "GOOD" (either "BAD" or "script execution timeout") then it is ok to send an alert. If it was "GOOD", then this trigger can wait for the next run to see if the problem persists and send the alarm.

          Comment

          • jvandenbroek
            Junior Member
            • Oct 2011
            • 15

            #6
            I figured out the following works for me:

            ({host:system.run[/etc/zabbix/scripts/shellscript.sh].str(OK,#2)})=0

            Comment

            • wikisb
              Member
              • May 2011
              • 64

              #7
              did you tried changing the value of "timeout" at zabbix_server.conf. default value is 3 seconds and max value is 30 seconds.
              i had an issue of timeouts because i had the default value but then i changed it for 30 seconds and all my triggers worked fine.

              Comment


              • BlackCrystal
                BlackCrystal commented
                Editing a comment
                i changed timeout value in zabbix conf but i still get this error. is there anything else i can do?
            • itninja96
              Junior Member
              • Aug 2018
              • 1

              #8
              Guys, I know this is like 7 years later haha, I did setup today email reporting for SELinux alerts and indeed, this is caused by SELinux blocking requests from zabbix user to execute certain operation. CHEERS

              Comment

              Working...