Ah good - I lost the thread a bit there.
A wee while ago I said:
Quote:
So the question is: "Why dosn't xcr's machine log a change to runlevel 0 before a shutdown (Or runlevel 6 prior to a restart.)?"
|
I must have been a tad dopey that night. The most likely reason (a priori) that you have restart events, in the "last -x" output, with no corresponding shutdown or crash events, is that your system did not shut down cleanly enough to even log the event.(Imagine what would happen if you just yanked the power cord?)
As far as measuring downtime is concerned:
I've been checking with some IT-business folk I know, guys who run large corporate servers, and they tell me that less -x is a pretty bad way to do things because of this.
Your best bet is to keep track of uptime, then downtime is the reciprocal. Since you are interested, I guess, in system useability as opposed to just "is the system powered up", you want to do aaplication layer health checks...
From the
NZLUG mailing list...
[quote=Jim Cheetham]Look at the existing stable solutions to some of these things -
http://munin.sf.net will reveal all sorts of interesting data about his
platform from within itself, and
http://www.nagios.org will help you set
up monitoring of basic IP availabiity all the way to internal
app<->database connectivity.
If you don't want to go that far ...
uprecords, gives you a nice
display like:
Code:
# Uptime | System Boot up
----------------------------+-------------------------------------------------
1 316 days, 13:25:49 | Linux 2.6.6-1-386 Fri Feb 4 01:08:41 2005
-> 2 97 days, 01:46:42 | Linux 2.6.8-2-686 Sat Dec 17 14:36:21 2005
----------------------------+-------------------------------------------------
no1 in 219 days, 11:39:08 | at Mon Oct 30 04:02:12 2006
... this couresy of Robin Shaet, same list.
This last one looks like what you want.
You needent run the script from init ... just write a script to extract and so on the data from the general log, and run it whever you need to access this information.
You're system is crashing an aweful lot - anything you want to tell us?