# Method to calculate downtime percentage

I need a calculation to work out the downtime percentage of a server.

I am making a script that runs via cron every minute to check the uptime of a remote server.

The two values I have to play with are number of checks run and times the checks failed (outages).

Is this a plausible way of calculating it? I am thinking it must be but can't be too sure as my Maths skills are slipping away from me with age!

-

Here's a simple spreadsheet layout to calculate and keep for historical purposes. You can set goals and apply conditional formatting to your hearts content.

```  |   A   |         B        |       C      |      D       |     E
------------------------------------------------------------------------
1 | Month | Minutes in month | Minutes Down | Percent Down | Percent Up
2 | Jan   |            44640 |            1 | =(C2/B2)*100 | = 100-D2
```
-
Thanks very much. I could either use the spreadsheet method or what the spreadsheet is to calculate the total uptime -100-(failures/checks*100) – Chris Oct 24 '10 at 15:10
Only problem I have noticed is that could cause division by 0 providing there have been no failures. – Chris Oct 24 '10 at 15:11
@Chris - Zero divided by something is always zero. Something divided by zero will cause you problems. Because the divisor (minutes in month) is never zero, it shouldn't cause you a problem. – Ben Pilbrow Oct 24 '10 at 15:21
Very true, thanks very much Ben. – Chris Oct 24 '10 at 19:10

Errrm, `100*failures/(failures+successes)`, or even simpler `100*failures/total-checks` ?

-

Here's a modification of Ben's answer that doesn't need an ugly "Minutes in month" column.

``````  |   A   |       B      |      C                                               |     E
--+-------+--------------+------------------------------------------------------+------------
1 | Month | Minutes Down | Percent Down                                         | Percent Up
2 | Jan   |            1 | =(B2/(DAY(DATE(YEAR(A1),MONTH(A1)+1,1)-1)*1440))*100 | =100-C2
``````
-
Thanks everyone for all suggestions. I know it has gone down the excel table route but I am actually looking to make a PHP system. Thanks anyway though because it has helped get my formula :) – Chris Oct 24 '10 at 19:07

## protected by Community♦Nov 10 at 15:06

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.