I have 2 servers, one is reporting uptime of 9 hours, the other 7 hours. I have no other monitoring system in place. My "hosting" provider says it was a single power spike event that rebooted both and that the uptime cannot be trusted to be accurate. Is there any way he is right? Can 2 servers rebooted the same time show uptime difference of 2 hours? Thanks.
No.
/proc/uptime
and/or theuptime
command only tell you how long a system has been running, i.e. it allows you to determine how long since the system recovered from an outage.Even if you don't have monitoring
last -F reboot
or a quick inspection of/var/log/messages
will usually show you the time gap between the last recorded messages and the system recovering, allowing you to (roughly) estimate the duration of an outage.Uptime is AFAIK a simple ever increasing kernel counter that is not influenced by date/time manipulations of the system clock. I.e. when you change timezones or change the system time/date with for instance NTP, the
date
command or manipulate an (incorrect) hardware clock withhwclock
, that won't change the uptime counter.If your systems have an uptime that differs by two hours and they suffered the same outage then the most obvious conclusion is recovery from that outage took an additional two hours for one of those systems...
There are numerous potentially perfectly valid reasons for that, by the way.
uptime
is only valid if you want to know the time that the system has been running since the last startup, no more than that.Instead,
tuptime
keep records of the system startup and shutdown events. It is helpful in showing anormal shutdowns, like those ones produced by power outages and hangs, because their report include if it was ok or bad under the End column: