Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

patch_for_uptime

Rating
0 votes
Favoured:
0
Hits
154920
Files:
FileDescription
check_uptime.shcheck_uptime.sh
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
just patch
Hello from Russia! ;) Thanks for your script! I have modified your script for correct work in FreeBSD.


--- /usr/local/nagios/libexec/check_uptime.sh Mon Nov 30 11:19:59 2009
+++ check_uptime.sh Thu Dec 10 16:12:00 2009
@@ -73,11 +73,16 @@
if echo $UPTIME_REPORT | grep -i day > /dev/null ; then
DAYS=`echo $UPTIME_REPORT | awk '{ print $3 }'`
HOURS=`echo $UPTIME_REPORT | awk '{ print $5}' | cut -f1 -d":"`
- MINUTES=`echo $UPTIME_REPORT | awk '{ print $5}' | cut -f2 -d":"`
+ if echo $UPTIME_REPORT | grep -v hrs ; then
+ MINUTES=`echo $UPTIME_REPORT | awk '{ print $5}' | cut -f2 -d":"`
+ else
+ MINUTES=0
+ fi

- elif #in AIX 5:00 will show up as 5 hours, and in Solaris 2.6 as 5 hr(s)
- echo $UPTIME_REPORT | egrep -e "hour|hr(s)" > /dev/null ; then
+ elif #in AIX 5:00 will show up as 5 hours, and in Solaris 2.6 as 5 hr(s), and in FreeBSD as 5 hrs
+ echo $UPTIME_REPORT | egrep -e "hour|hr(s)|hrs" > /dev/null ; then
HOURS=`echo $UPTIME_REPORT | awk '{ print $3}'`
+ MINUTES=0
else
echo $UPTIME_REPORT | awk '{ print $3}' | grep ":" > /dev/null &&
HOURS=`echo $UPTIME_REPORT | awk '{ print $3}' | cut -f1 -d":"`



for example, in FreeBSD uptime command output looks like
11:45AM up 31 mins, 1 user, load averages: 0.04, 0.22, 0.27
2:13PM up 2:59, 1 user, load averages: 0.01, 0.01, 0.00
2:13PM up 3 hrs, 1 user, load averages: 0.01, 0.00, 0.00
2:26PM up 205 days, 18:59, 3 users, load averages: 0.07, 0.13, 0.12
2:26PM up 205 days, 19 hrs, 3 users, load averages: 0.05, 0.12, 0.12