Service Timed out - but working in th shell

(Oliver Tatzmann) #1

when I run the plugin on the CLI it works fine an exits with the correct return code.
When I run it in OMD (3.10,3.20 with Naemon Core) it seems to wait for something. I tried different sets of " and ’ but that didn’t help.

It’s a plugin I’m developing in bash basically using curl,cut & grep.

Any idea where I can find hints what it’s waiting for when triggered from naemon?

Thx & BR


Just the usual things:

  • the monitoring process has another environment than a user shell (PATH, LD_LIBRARY_PATH, and several other variables), independent from the monitoring core used
  • the complete path to programs (like curl, cut, grep, etc.) should be specified
  • enabling debugging (set -x) and redirecting STDOUT and STDERR to a file might help
(Oliver Tatzmann) #3

thanks Wolfgang -

it seem that it dies/hangs in this function to generate a random value:

    /bin/cat /dev/urandom | /bin/tr -dc 'a-zA-Z0-9' | /bin/fold -w ${1:-32} | /bin/head -n 1
(Sven Nierlein) #4

i can reproduce that, i created a test plugin:

    cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
echo "OK - $(random-string)"
exit 0

Works as expected with Mod-Gearman, but plain Naemon runs into a timeout.
Could you please raise an issue on github for this?

(Sven Nierlein) #5

I guess some SIGCHLD or SIGPIPE handling got broken. As a quick workaround, replacing the cat with head -n 20 solves the issue so far:

    head -n 50 /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1

The reason is, the head exits by itself, the cat runs until it gets a SIGPIPE which somehow doesn’t work in this case.

(Oliver Tatzmann) #6

thank you - I’ll try that