Jump to content

[SOLVED] Percent Of Uptime


zackcez

Recommended Posts

Here's what I came up with:

$percent         = ("total_uptime" / ("total_uptime" + "total_downtime")) * 100;

Where total total_uptime starts at 1 and total_downtime at 0...I've create a cron job to automatically add one to uptime if the server is up and if down add one to down. But I'm getting this message:

Warning: Division by zero in [path]\modules\server_status\index.php on line 262

If anyone could either correct my math or help me find a different way to do this I'd very much appreciate it.

PS: The total_uptime and total_downtime are rows in my mysql database.

Link to comment
https://forums.phpfreaks.com/topic/118185-solved-percent-of-uptime/
Share on other sites

I don't think your seeing the problem. total_uptime and total_downtime are not numbers! Maybe if you where using the variables $total_uptime and $total_downtime that you defined somewhere previously but at the moment there just strings when within quotes or undefined constants when outside of them.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.