Operating System - HP-UX
1836928 Members
3233 Online
110111 Solutions
New Discussion

Re: script to measure downtime

 
Frank de Vries
Respected Contributor

script to measure downtime

What are the possibilities to measure downtime with a shell or perl script.

We need to report on a monthly basis the 'unplanned downtime' in a certain time-window. We have a combination of HPUX and Linux machines.

Uptime gives me the uptime, but not the downtime.
Look before you leap
9 REPLIES 9
Torsten.
Acclaimed Contributor

Re: script to measure downtime

Hi Frank,

IMHO it is a good solution to measure this not on the server directly, but from another (management) system.
For example the HP SIM has the possibility to measure such things, e.g. the Unreachable Device Notification (UDN) can do this.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: script to measure downtime

This is kind of hard to measure.
You can scan the output of last(1) and look for entries for "reboot system boot".

It seems these entries say how long the system was up. I'm not sure if it would be valid if it crashed. It seems for a regular reboot, the time seems to go to when it restarts. Which kind of indicates the system never goes down.

You might be able to look at /etc/shutdownlog to get the halt/reboot start.

Frank de Vries
Respected Contributor

Re: script to measure downtime

Hmmm, thanks for the tip:

The pseudo-user reboot logs each time the system reboots. Thus, last
reboot is a useful command for evaluating the relative time between
system reboots.

I just check a system that crashed a couple times in the last month or so and unfortunately 'reboot' is not shown in the list.

Also not after a clean boot.
So it looks that something needs investigating


Look before you leap
Fredrik.eriksson
Valued Contributor

Re: script to measure downtime

There actually is a daemon available (atleast for linux, and google says it works with hp-ux) named Uptimed that keeps uptime records.
http://freshmeat.net/projects/uptimed/

Best regards
Fredrik Eriksson
Fredrik.eriksson
Valued Contributor

Re: script to measure downtime

If you want to run it on another server there's easy ways of doing that. Either you use SNMP to check for heartbeats, or you can write something easy like a ping and a quick log file running with crontab.

#!/bin/bash
ping -c1 -W2 $host &>/dev/null
if [ $? -ne 0 ]; then
echo "[`date +%Y%m%d %H%M%S`] Stopped responding." >> $logfile
fi

Best regards
Fredrik Eriksson
likid0
Honored Contributor

Re: script to measure downtime

Hy,

We use cacti on a small linux box. You can get nice stats, one of them being downtime.

It's open source.

http://www.cacti.net/
Windows?, no thanks
Frank de Vries
Respected Contributor

Re: script to measure downtime

apparently it is also possible to use
Ehealth

http://www.ca.com/us/content/campaign.aspx?cid=132286

regards,
Look before you leap
Fredrik.eriksson
Valued Contributor

Re: script to measure downtime

If you're going for full feathered monitoring software both Cacti and Nagios will do the job. Cacti IMHO looks better ;).

I think there's something named OP5 also that does this. Thou this seens to be a pay-for-it software where as Cacti and Nagios is opensource.

Best regards
Fredrik Eriksson
Frank de Vries
Respected Contributor

Re: script to measure downtime

ok
Look before you leap