uptime script
Askar Ali
askarali at beaconet.net
Wed Jul 20 08:16:24 CEST 2005
Frederik Vanhee wrote:
> Askar Ali wrote:
>
>> hi,
>>
>> Recently someone on the list talking about creating a script
>> for host uptime using cut, sed. Would *you* like to share the script
>> with me ? :)
>>
>>
>> regards
>>
>> askar
>>
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>> from IBM. Find simple to follow Roadmaps, straightforward articles,
>> informative Webcasts and more! Get everything you need to get up to
>> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&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
>>
> Here you are ! Open with wordpad
> I'm not a programmer, so don't expect too much of it.
>
>------------------------------------------------------------------------
>
>UPTIME=`uptime`
>
>if [ "`echo $UPTIME | grep day`" != "" ]
> then
> UPDAYS=`echo $UPTIME | awk '{ print $2 " " $3 " " $4 " " $5 }'`
> if [ "`echo $UPTIME | grep min`" != "" ]
> then
> UPDAYS=`echo $UPTIME | awk '{ print $2 " " $3 " " $4 " 0:" $5 }'`
> fi
> PLUG_OUT="UPTIME OK : $UPDAYS machine not recently rebooted"
> echo $PLUG_OUT
> else
> if [ "$UPTIME" = "" ]
> then
> PLUG_OUT="UPTIME CRITICAL : error during test execution"
> echo $PLUG_OUT
> exit 2
> else
> UPHOURS=`echo $UPTIME | awk '{ print $2 " " $3 " " }'`
> if [ "`echo $UPTIME | grep min`" != "" ]
> then
> UPHOURS=`echo $UPTIME | awk '{ print $2 " 0:" $3 " " }'`
> fi
> PLUG_OUT="UPTIME WARNING : $UPHOURS machine rebooted during last 24 hours"
> echo $PLUG_OUT
> exit 1
> fi
>
>fi
>
>
hi Frederik Vanhee
Thanks mate, hope it will work, we only interested in machine uptime
thsi script look fine, I just test it on my work box, time to give a try
on remote hosts
regards
Askar
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&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