大网数据广告活动
服务器运维问答

Can linux uptime value be trusted to pinpoint time of outage?

· 52CE 我爱测

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 tr…

问题原文

原帖链接 · evilpenguin · CC BY-SA 3.0

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.

已采纳解答

原帖链接 · HBruijn · CC BY-SA 3.0

Can linux uptime value be trusted to pinpoint time of outage?

No.

/proc/uptime and/or the uptime 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 with hwclock , 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。