N1CK3RS0N Posted February 5, 2009 Share Posted February 5, 2009 Hello, I was interested in hearing peoples ideas and getting a little help on something I plan to develop for WHMCS. WHMCS (Web Host Manager Complete Solutions) is basically a portal for web hosting businesses. It lets clients order hosting packages and it automatically sets up the account in the servers control panel (cPanel, Plesk, Direct Admin, etc.) One of the features for the users to view is the Server Status page. It shows if the servers FTP, HTTP, POP3 are up and running, as well as displaying the servers current CPU load and current uptime. One thing it does not do though is display a % (such as 99.8% or whatever). A lot of people on their site say they would love this feature. And since I want it for my site I would like to develop it. My ideas for it would to run a cronjob every minute or so, to execute a script. The script would check to see if a page can load (not sure exactly how this will work). If it loads then it adds +1 to uptime for that server in the SQL database. If it doesn't load it will add +1 to downtime. The equation to find the uptime % would be as followed: downtime / uptime * 100 = uptime percentage. Any ideas on how I should do this? Anyone care to help me with this? Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/ Share on other sites More sharing options...
corbin Posted February 5, 2009 Share Posted February 5, 2009 You just told us how it would work.... Do you need help with the specifics or what? Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755005 Share on other sites More sharing options...
N1CK3RS0N Posted February 5, 2009 Author Share Posted February 5, 2009 You just told us how it would work.... Do you need help with the specifics or what? Yeah, I'm still new to PHP. Didn't know if there's any other easier ways or what. 1. I don't know how to write a cron job. Can someone help me with this? ^^ 2. How would the PHP file the cron job works? Would it try to include a file, if the file isn't found then +1 to downtime? I'm still not sure how to go about this part. :"( Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755008 Share on other sites More sharing options...
killah Posted February 5, 2009 Share Posted February 5, 2009 Your way of working thing's i think will not work. Let's say: Down time = 5 Up Time = 250 Down time / uptime = 0.2 0.2 * 100 = 2 Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755017 Share on other sites More sharing options...
N1CK3RS0N Posted February 5, 2009 Author Share Posted February 5, 2009 Your way of working thing's i think will not work. Let's say: Down time = 5 Up Time = 250 Down time / uptime = 0.2 0.2 * 100 = 2 2% downtime. We do want it for uptime though so downtime / uptime * 100 = downtime % 100 - downtime % = uptime % Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755021 Share on other sites More sharing options...
killah Posted February 5, 2009 Share Posted February 5, 2009 The equation to find the uptime % would be as followed: downtime / uptime * 100 = uptime percentage. Just worked out as you said. And if a client see's 2% uptime and 98% downtime.. good luck getting customer's. Plus. Having 98% downtime is very bad rep for a webhosting company. Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755027 Share on other sites More sharing options...
N1CK3RS0N Posted February 5, 2009 Author Share Posted February 5, 2009 The equation to find the uptime % would be as followed: downtime / uptime * 100 = uptime percentage. Just worked out as you said. And if a client see's 2% uptime and 98% downtime.. good luck getting customer's. Plus. Having 98% downtime is very bad rep for a webhosting company. Haha yeah. xD The server would have to be like a 1984 mac running on AOL. xD 2% uptime lol. But the new formula works I believe? Now just to figure out how to check if the server is up or down. Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755028 Share on other sites More sharing options...
killah Posted February 5, 2009 Share Posted February 5, 2009 10 minute cron sending a request to a page. then that page requesting another page. But by using fopen. if what ever text you put in the page then update if not downdate. lol Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755031 Share on other sites More sharing options...
N1CK3RS0N Posted February 5, 2009 Author Share Posted February 5, 2009 10 minute cron sending a request to a page. then that page requesting another page. But by using fopen. if what ever text you put in the page then update if not downdate. lol Even if the servers down would fopen still work? The cronjobs still execute right? Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755041 Share on other sites More sharing options...
killah Posted February 5, 2009 Share Posted February 5, 2009 Im not a genius when it come's to server's being down. So maybe some one else can help you on that. Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755042 Share on other sites More sharing options...
trq Posted February 5, 2009 Share Posted February 5, 2009 One of the features for the users to view is the Server Status page. It shows if the servers FTP, HTTP, POP3 are up and running, as well as displaying the servers current CPU load and current uptime. I would suggest you find out how it finds out if the server is up and running and go from there. Trying to request a page to see if the server is running is not at all reliable. There are many ways to do this depending on what kinds of permissions you have. apache2ctl for example has a status option built in which will tell you if apache is running or not. Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755052 Share on other sites More sharing options...
N1CK3RS0N Posted February 5, 2009 Author Share Posted February 5, 2009 One of the features for the users to view is the Server Status page. It shows if the servers FTP, HTTP, POP3 are up and running, as well as displaying the servers current CPU load and current uptime. I would suggest you find out how it finds out if the server is up and running and go from there. Trying to request a page to see if the server is running is not at all reliable. There are many ways to do this depending on what kinds of permissions you have. apache2ctl for example has a status option built in which will tell you if apache is running or not. Do cron jobs work even if server is down? Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755068 Share on other sites More sharing options...
trq Posted February 5, 2009 Share Posted February 5, 2009 Do cron jobs work even if server is down? Cron has nothing to do with apache. I assume when you say server your refering to apache, not the machine itself. Yes, cron will still operate regardless of wether or not apache is running, they are in no way related. Link to comment https://forums.phpfreaks.com/topic/143888-server-uptime-monitoring-for-whmcs/#findComment-755157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.