boot time in system check reported as 1 January 1970 in Linux (SLES11)

Issue #412 closed
Ulrich Windl created an issue

In the output of "monit status host.domain.org" the monit uptime is reported correctly, and the service is running, but the boot time is reported as Thu, 01 Jan 1970 01:00:00 "monit -Iv" reports a "System statistic error -- cannot get system boot time"

The system is running SLES11 SP4 (current kernel is 3.0.101-77-xen). I checked that /proc/stat has a "btime" entry, but the system has more than 200 interrupts defined, so the line before ("intr") has more than 5300 characters.

In init_process_info_sysdep() the local buffer is just 4kB. So I'd suggest to either increase the buffer size, or to switch to a line-wise processing of the file.

For debugging-ease I'm attaching a copy of /proc/stat.

Comments (3)

  1. Ulrich Windl reporter

    An alternate approach to get the boot time seems to subtract the first number from /proc/uptime from the current time. Proof of concept: date -d @$(($(date +%s) - $(awk '{ print int($1) }' /proc/uptime)))

  2. Log in to comment