Page 1 of 1

Servicecheckoutput problem

Posted: Mon Nov 05, 2012 8:16 am
by krishna23
Can you help?

I've got a very simple script, something like

Code: Select all

#!/bin/bash
out=$( nmap google.com | grep / | sed '/Starting/d' | cut -f 1 -d '/' | sed ':a;N;$!ba;s/\n/,/g' )
printf "These ports are opened on google.com $out \n"

What is does is, that it shows opened ports on certain host. No warnings, no criticals, just info..

It's working perfectly on Nagios 3.2.3, centos 6.3 installed from old repository, look at "check_test"

Image

But it does not work on Nagios 3.4.1.:
Image


If I run the script as a root, it's working, if I run the script as a user nagios, it's also working, but if nagios runs this script itself, the "$out" variable is simply missing. The same situation is happening with my other easy bash scripts. What am I doing wrong?

Thanks a lot