I am using KVM with virt-manager to migrate the virtual machines from one system to another. VM Migraiton is successfully done and migration time is measured correctly. Now, I am stuck for how to measure downtime.
It is not easy to see when a system is stopped but
dmesg -w will show something when you resume your system.
The best way might be having a logger running ind a console:
while : ; do sleep 1 ; date +%FT%T >> downtime.log ; done
and then look for missing logging.
You can also calculate downtime at the same time:
while : ; do sleep 1 ; NEW=$(date +%s) ; echo $(date +%FT%T) $((NEW-LST)) >> downtime.log ; LST=$NEW ; done
It is a bit longer so use a script:
#! /bin/bash LST=$(date +%s) while : ; do sleep 1 NEW=$(date +%s) echo $(date +%FT%T) $((NEW-LST)) >> downtime.log LST=$NEW done