vmstat - custom plugin [CASE CLOSED]
Neil
neil-on-nagios at restricted.dyndns.org
Tue Mar 23 08:23:45 CET 2004
I got it working guys.
1. I copied /root/.ssh/id_dsa to /usr/local/nagios/libexec
2. chown nagios:nagios /usr/local/nagios/libexec/id_dsa
3. I modified my ssh to include -i /usr/local/nagios/libexec/id_dsa
:)
Neil writes:
> hey guys,
>
> I wrote my own plugin for checking a solaris machine's user, system and
> idle cpu utilization.
>
> If I execute this line in console:
> VALUE=`/usr/bin/ssh -l $USER $HOSTADDR vmstat 3 2 | awk 'NR > 3'`
>
> then i echo $VALUE, I am able to see vmstat results. Of course $USER and
> $HOSTADDR is set with the user and ip address of the remote ssh server.
>
> But my script below doesn't work. I get an empty $VALUE.
>
> I have already done this inside my script:
> echo HOST=$1 TIME=$2 WARN=$3 CRIT=$4 USER=$5 HOSTADDR=$6 >> /tmp/debug.log
>
> then I do a tail -f /tmp/debug.log and YES, all the variables are
> populated properly.
>
> Any ideas?
>
> One more, there is no way I can install nagios-statd :(
>
> Thanks in advance.
>
>
> ---------------------code-starts-here--------------
> #!/bin/sh
>
> #Read arguments from the command-line
> HOST=$1
> TIME=$2
> WARN=$3
> CRIT=$4
> USER=$5
> HOSTADDR=$6
>
> RETVAL=0
> RETSTR=""
>
> ERR=0
>
> VALUE=`/usr/bin/ssh -l $USER $HOSTADDR vmstat 3 2 | awk 'NR >
> 3'`
> RESULT=$?
> RETSTR="vmstat 3sec interval results: $VALUE"
> echo $RETSTR >> /tmp/datalog
>
> toRRDdbuser=`echo $VALUE|awk '{print $20}'`
> toRRDdbsystem=`echo $VALUE|awk '{print $21}'`
> toRRDdbidle=`echo $VALUE|awk '{print $22}'`
> CPU_idle=`echo $VALUE|awk '{print $22}'`
>
> if [ $RESULT -gt 0 ]; then
> RETVAL=3
> RETSTR="Socket Error"
> ERR=1
> break
> fi
> if [ $CPU_idle -le $CRIT ]; then
> RETVAL=2
> elif [ $CPU_idle -le $WARN ] && [ $RETVAL != 2 ]; then
> RETVAL=1
> fi
>
> /usr/local/bin/rrdtool update
> /usr/local/nagios/rrd/unixsystem_on_$HOST.rrd
> $TIME:$toRRDdbuser:$toRRDdbsystem:$toRRDdbidle
>
> echo $RETSTR
> exit $RETVAL
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> 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
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
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