View Full Version : application to see if DB down
Yo all,
I want to create an application that can see if any MySQL offered by Powweb was down or not. Is this possible? Or do I need a login and password to test a mysql server?
I want to go and have the application test connection and echo either "Database is up" or "MySQL02 at powweb is down"
Possible?
Thanks
Ryan
You mean kind of like Internet Seer (http://www.internetseer.com) right? I know that it always gets back to me whenever my site goes down and back up, but I wonder if we can set it up to tell us about php databases.
Sort of,
I want a user to be able to pick his powweb MySQL such as MySQL02 and click test and the php application will see if it is currently down or not by trying to connect to it. However, is it possible to do a test of connection if you do not have a login for a MySQL?
Thanks
Ryan
HalfaBee
11-3-03, 10:33 PM
You can do a mysql_connect() with just the server name in.
It will return FALSE, but mysql_error() should show some useful response.
HalfaBee
Thanks bee,
Definately puts me in right direction, now it prints...
Access denied for user: 'root@www09.powweb.com' (Using password: NO) .
Which definately means it is up. Is there a variable or function that will allow my application to know this result means server is up and therefore print "Server is up" or something or other.
Thanks
Ryan
I put this into code based on last posting but will it work for all mysql servers? It works for two that i tested.
if ($result=="Access denied for user: 'root@www09.powweb.com' (Using password: NO)") {
echo "<strong>This server is up and running</strong>";
include 'test.htm';
} else {
echo "<strong>This server is currently down</strong>"; }
what you think?
Thanks
Ryan
HalfaBee
11-4-03, 03:52 PM
Use mysql_errorno() it should return the same value for that error.
HalfaBee
as in mysql_errno ()
:)
Thanks
Ryan
By way, do you know where I can find out a list of all mysql servers powweb offers?
HalfaBee
11-5-03, 06:16 AM
You got it.
I don't think there is a list.
But mysql01-04 is pretty current.
The celestial servers are still around, they don't create many errors due to the limited load.
HalfaBee
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.