Testing Apache - mysql connectivity using php

Jon Angliss jon at netdork.net
Thu Jul 16 07:21:07 CEST 2009


On Wed, 15 Jul 2009 15:00:59 -0700, Swati Tiwari <its.svati at gmail.com>
wrote:

>Hello Friends,
>
>I am trying to write a plugin for testing the apache-mysql connectivity
>using php. Has anyone done this so far and has any ideas as to how to go
>about it. Any ideas would be appreciated. Thank you very much!

A simple php script would work, and the check_http with string
matching.

<?php

$conn = @mysql_connect($server,$user,$pass);

if (!$conn) {
	echo 'ERROR';
} else {
	echo 'SUCCESS';
	@mysql_close($conn);
}

?>


Then nagios would execute this...

./check_http -H hostname -u /testdb.php -s SUCCESS

-- 
Jonathan Angliss
<jon at netdork.net>


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list