The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
[PHP DEV.] Server Status Monitor
Discuss [PHP DEV.] Server Status Monitor in the PHP Development forum on Dev Shed. [PHP DEV.] Server Status Monitor PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 9th, 2012, 10:17 AM
|
|
Contributing User
|
|
Join Date: Dec 2012
Posts: 75

Time spent in forums: 16 h 33 m 19 sec
Reputation Power: 1
|
|
|
[PHP DEV.] Server Status Monitor
Hello! Thanks for checking in on my post.
I am wanting to make a service checker that checks to see if services are up periodically and then put the data into a database. I think it would be best to use some type of Cron Job. (Something like this is what I'm talking about: So here is something I am not sure about, https://teamexon [DOT] eu/stav-sluzieb.html).
So how would I have the script that displays the data get a date, tell if it is on or off, and then Get the most recent data?
Thanks,
TJ
|

December 9th, 2012, 10:34 AM
|
|
|
|
This sounds like a 2 part question. The first part is to write a shell or perl script (possible with PHP but I wouldn't do it) to do the checking and maintain the database. The 2nd part, in PHP, would read the data from the database and display it appropriately. Depending on how often you run the first script, I would not think checking the status in the PHP script would be necessary. The database will always be up to date if you run the first script frequently enough.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|

December 9th, 2012, 10:39 AM
|
|
Contributing User
|
|
Join Date: Dec 2012
Posts: 75

Time spent in forums: 16 h 33 m 19 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by gw1500se This sounds like a 2 part question. The first part is to write a shell or perl script (possible with PHP but I wouldn't do it) to do the checking and maintain the database. The 2nd part, in PHP, would read the data from the database and display it appropriately. Depending on how often you run the first script, I would not think checking the status in the PHP script would be necessary. The database will always be up to date if you run the first script frequently enough. |
Okay. Heres the deal, I am only some what good with PHP and dont know shell or perl.
How would I tell it to receive the last three days to display on the site? And also in the main script, how could I also tell it to put a date in the database.
Another question, how could when the status are okay, how could it put a "1" for okay in the database, and then when the script displays the data on the page "1" = an image?
|

December 9th, 2012, 10:51 AM
|
|
|
Quote: | Originally Posted by tjswebdev Okay. Heres the deal, I am only some what good with PHP and dont know shell or perl.
|
Sounds like a good opportunity to learn, especially if you are going to be using cron.
Quote: | Originally Posted by tjswebdev
How would I tell it to receive the last three days to display on the site?
|
Structure your query to do that. You need to design your database schema before you do any programming.
Quote: | Originally Posted by tjswebdev
And also in the main script, how could I also tell it to put a date in the database.
|
They same way you do any other field. All databases have date field definitions.
Quote: | Originally Posted by tjswebdev
Another question, how could when the status are okay, how could it put a "1" for okay in the database, and then when the script displays the data on the page "1" = an image? |
All databases also have boolean field definitions. How you display that on your page is a matter of personal preference. You could use an image or simply the words 'up' and 'down'. Perhaps in green and red respectively.
|

December 9th, 2012, 01:26 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Posts: 75

Time spent in forums: 16 h 33 m 19 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by gw1500se Sounds like a good opportunity to learn, especially if you are going to be using cron.
Structure your query to do that. You need to design your database schema before you do any programming.
They same way you do any other field. All databases have date field definitions.
All databases also have boolean field definitions. How you display that on your page is a matter of personal preference. You could use an image or simply the words 'up' and 'down'. Perhaps in green and red respectively. |
Okay, sorry for delay.
How often should I have the service checking? 1, 5, 10, 20 times a day?
|

December 9th, 2012, 02:34 PM
|
|
|
|
That is entirely up to you. I have no idea what your users are expecting or what the purpose is with respect to history.
|

December 9th, 2012, 03:02 PM
|
|
Contributing User
|
|
Join Date: Dec 2012
Posts: 75

Time spent in forums: 16 h 33 m 19 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by gw1500se That is entirely up to you. I have no idea what your users are expecting or what the purpose is with respect to history. |
True. Heres a question. If I have it update once every 30 minutes, can it delete the previous check from earlier in the day?
|

December 9th, 2012, 03:07 PM
|
|
|
|
Yes. You can pretty much delete/add/update anything you want, any time you want.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|