Ping MySQL

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Sun Jun 19, 2005 2:29 pm    Post subject: Ping MySQL Reply with quote

Can someone give me the code to ping MySQL? I have searched google but didn't find anything that helped.

I am going to be using it as part of my Server Status Script when it is finally released.

Thanks in advance.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 11:28 am    Post subject: Reply with quote

It's OK, i found it!
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 12:19 pm    Post subject: Reply with quote

The Inquisitor wrote:
It's OK, i found it!


mysql_ping() or somehting like that, no?
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 2:50 pm    Post subject: Reply with quote

Yes thats correct, then you add in your host, username and password. Cant remember how off the top of my head.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 2:50 pm    Post subject: Reply with quote

The Inquisitor wrote:
Yes thats correct, then you add in your host, username and password. Cant remember how off the top of my head.


Thats why I left it blank =P
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 2:51 pm    Post subject: Reply with quote

Its in the server status script anyway. The post is in the Off Topic forum.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 2:52 pm    Post subject: Reply with quote

The Inquisitor wrote:
Its in the server status script anyway. The post is in the Off Topic forum.


Did you ever get it to find out which services are running?
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 3:00 pm    Post subject: Reply with quote

MySQL is currently automatic but I'm still working on the others. Just need to think about how I'm going to do it. Won't be long though :P
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 3:11 pm    Post subject: Reply with quote

The Inquisitor wrote:
MySQL is currently automatic but I'm still working on the others. Just need to think about how I'm going to do it. Won't be long though :P


Mabye a file_exists() on the inturpretter, and some stuff to check the MIME settings.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 3:18 pm    Post subject: Reply with quote

Well, I need a script to check the ports for FTP, SMTP and POP and just know how to echo in ASP and Perl for those.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 3:21 pm    Post subject: Reply with quote

The Inquisitor wrote:
Well, I need a script to check the ports for FTP, SMTP and POP and just know how to echo in ASP and Perl for those.


Code:

$fp = fsockopen("localhost", 21, $errno, $errstr, 5);
if (!$fp) {
   die("A connection could not be made.");
} else {
fclose($fp);
}


God knows where I got that example, it was in a robot I made for a game a while back.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 3:23 pm    Post subject: Reply with quote

Lol, i just found one similar to that so Ill use it.
Code:

<?PHP

$localhost = "127.0.0.1";

function check($target,$portNum){
if (! $sock = @fsockopen($target, $portNum, &$num, &$error, 5))
   echo $portNum."/off";
else{
   echo $portNum."/on";
   @fclose($sock);
   }
}

echo"<b>Process:</b><br>";
check($localhost, 80); echo "n<br>";
check($localhost, 6667); echo "n<br>";
check($localhost, 31338); echo "n<br>";
check($localhost, 3306); echo "n<br>";
check($localhost, 110); echo "n<br>";
check($localhost, 25); echo "n<br>";
check($localhost, 22); echo "n<br>";
check($localhost, 139); echo "n<br>";
check($localhost, 21); echo "n<br>";
check($localhost, 8000); echo "n<br>";


?>

_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 3:29 pm    Post subject: Reply with quote

The Inquisitor wrote:
Lol, i just found one similar to that so Ill use it.
Code:

<?PHP

$localhost = "127.0.0.1";

function check($target,$portNum){
if (! $sock = @fsockopen($target, $portNum, &$num, &$error, 5))
   echo $portNum."/off";
else{
   echo $portNum."/on";
   @fclose($sock);
   }
}

echo"<b>Process:</b><br>";
check($localhost, 80); echo "n<br>";
check($localhost, 6667); echo "n<br>";
check($localhost, 31338); echo "n<br>";
check($localhost, 3306); echo "n<br>";
check($localhost, 110); echo "n<br>";
check($localhost, 25); echo "n<br>";
check($localhost, 22); echo "n<br>";
check($localhost, 139); echo "n<br>";
check($localhost, 21); echo "n<br>";
check($localhost, 8000); echo "n<br>";


?>


Looks a little better than myne, there ya go =)
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 3:39 pm    Post subject: Reply with quote

OK, i should be able to complete the script now. I just need to download Perl, POP and and SMTP server and I'm done.

Now the other problem... My Server keeps giving me a blue screen after 15 mins.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Mon Jun 20, 2005 3:48 pm    Post subject: Reply with quote

The Inquisitor wrote:
OK, i should be able to complete the script now. I just need to download Perl, POP and and SMTP server and I'm done.

Now the other problem... My Server keeps giving me a blue screen after 15 mins.


As in Blue Screen of Death?
That isnt good =S
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Mon Jun 20, 2005 7:32 pm    Post subject: Reply with quote

lol, no its not. I think I have sorted it now. I ran a scandisk and it hasn't done it since.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Beta5
-


Joined: 08 Jun 2005
Posts: 13

PostPosted: Tue Jun 21, 2005 3:02 pm    Post subject: Reply with quote

The Inquisitor wrote:
Lol, i just found one similar to that so Ill use it.
Code:

<?PHP

$localhost = "127.0.0.1";

function check($target,$portNum){
if (! $sock = @fsockopen($target, $portNum, &$num, &$error, 5))
   echo $portNum."/off";
else{
   echo $portNum."/on";
   @fclose($sock);
   }
}

echo"<b>Process:</b><br>";
check($localhost, 80); echo "n<br>";
check($localhost, 6667); echo "n<br>";
check($localhost, 31338); echo "n<br>";
check($localhost, 3306); echo "n<br>";
check($localhost, 110); echo "n<br>";
check($localhost, 25); echo "n<br>";
check($localhost, 22); echo "n<br>";
check($localhost, 139); echo "n<br>";
check($localhost, 21); echo "n<br>";
check($localhost, 8000); echo "n<br>";


?>



Hey i tested your script, its works great but it kinda takes a while to load lol so ya heres a script that i hope that will help somewhat.... lol

Quote:
<?php
$l_ip = '127.0.0.1'; //WebServer IP
$l_port = '80'; //WebServer Port
$c_ip = '127.0.0.1'; //MySQL IP
$c_port = '3306'; //MySQL Port
$m_ip = '127.0.0.1'; //FTP IP
$m_port = '21'; //FTP Port
$checktime = '.3'; //How long to check each server for before determining that it's offline

//Check WebServer
if ( @fsockopen( $l_ip, $l_port, $errno, $errstr, $checktime) ) {
echo "WebServer: <font color=\"green\">Online</font><br>";
} else {
echo "WebServer: <font color=\"red\">Offline</font><br>";
}

//Check MySQL Server
if ( @fsockopen( $c_ip, $c_port, $errno, $errstr, $checktime) ) {
echo "MySQL: <font color=\"green\">Online</font><br>";
} else {
echo "MySQL: <font color=\"red\">Offline</font><br>";
}

//Check FTP Server
if ( @fsockopen( $m_ip, $m_port, $errno, $errstr, $checktime) ) {
echo "FTP: <font color=\"green\">Online</font><br>";
} else {
echo "FTP: <font color=\"red\">Offline</font><br>";
}

?>


All you have to do is change the IPs and add the some more ports and IPs that you wanna check
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue Jun 21, 2005 3:58 pm    Post subject: Reply with quote

I havent used the script above, I have edited it to suit my needs. The entire status script loads in less than 2 seconds.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group