Question on setting up my own check

steve f a31modela at hotmail.com
Tue Oct 19 21:20:54 CEST 2010


Hello All,

  


I have the following script created to check free space on a remote legacy box via rsh. 

  

used=`sudo rsh $1 df -v |grep starlite6 | head -1 | awk '{print $4}'`

free=`sudo rsh $1 df -v |grep starlite6 | head -1 | awk '{print $5}'`

full=`echo $(($used+$free))`

percent=`echo $((( $free * 100 ) / $full))`

warn=`echo $((( $full * $2 ) / 100 ))`

crit=`echo $((( $full * $3 ) / 100 ))`

  

if [ "$warn" -gt "$crit" -o "$warn" -eq "$crit" ]; then

  echo "Unknown: [crit] must be larger than [warn]"

      exit 3

  

fi

  

if [ "$used" -lt "$warn" -o "$used" -eq "$warn" ]; then

  

      echo "OK. Free Space: `sudo rsh $1 df -v |grep starlite6 |head -1 | awk

'{print $5}'`B, $percent%"

exit 0

elif [ "$used" -gt "$warn" -a "$used" -lt "$crit" ]; then

      echo "Warning. Free Space: `sudo rsh $1 df -v |grep starlite6 | head -1 |

awk '{print $5}'`B, $percent%"

     exit 1

elif [ "$used" -gt "$crit" ]; then

      echo "Critical. Free Space: `sudo rsh $1 df -v |grep starlite6 | head -1 |

 awk '{print $5}'`B, $percent%"

     exit 2

 else

   echo "Unknown"

  exit 3

fi

  

 If I run this from the command line, I get the following response:

  

/usr/local/nagios/libexec # ./check_starlite_size LEGACYBOX 70 80

Critical. Free Space: 51090B, 2%

  

if nagios runs the script , I keep getting an unknown result on the central server ( distributed environment btw) 

from nagios.log on central server:

[1287511053] PASSIVE SERVICE CHECK: strXXXXsa;Starlite Size;3;Unknown

  

I assume that the issue is an incorrect format for the send_nsca file but cant figure out how to set it up correctly. I have the check added on the distributed server & the central server in command.cfg & services.cfg and the check does run so I assume its correct from that aspect, just not an expected format/info ..

  

Can anyone tell me what I am missing here ?
Thanks,
Steve
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20101019/265c2312/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list