I noticed a question on serverfault in which the user was interested to discover
periods of downtime on an Ubuntu 16.04 server instance. The server has been powered
off at various itervals, and presumably was configured to boot automatically.
I had a quick crack at an
answer, but I think its one of those questions which it would be worth having
a standard approach to.
I think there a whole load of solutions to this problem, depending on what tools
you already have installed, and what you can reasonably install. I mean, if you
are monitoring the server remotely with icynga or xabbix, you should have this
information already.
In addition you should be able to see outages in the timeline using splunk or
kibana. If you have those tools configured.
An ideal solution to this problem would not involve installing too many new packages
unless absolutely necessary.
The following script parses the journal entries, and produces a table into 1
hour blocks. Which should obviously identify if the server was down for that
period: