Hi,
I got a problem with a query.
I have built a script that checks if another server is up or down. If the server is down it stores the timestamp in a MySQL database – but if the server is running nothing is stored. The reason why I don’t store the uptime is because the scripts runs every minute, so the database would fill up really fast – so I’m trying to avoid string the uptime.
The problem is when I want to select the last downtime I want to count how many minutes the server was down. The database looks something like this:
Id – Date
01 - 2005-11-17 12:00:00
02 - 2005-11-17 12:01:00
03 - 2005-11-17 12:02:00
04 - 2005-11-17 12:03:00
05 - 2005-11-17 15:00:00
06 - 2005-11-17 15:01:00
07 - 2005-11-17 15:02:00
08 - 2005-11-17 15:03:00
Okay, according to the table the last downtime was November 11 @ 15:03 and then the server was down for 4 minutes.
Does anyone have any ideas how to solve this?