Thanks!!
I did a search and have knocked this together after making a db of services to monitor. It's doing the job nicely!!
<?php
// Connect to the database server
include("../../protect/dbconnect.php");
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the service database
if (!@mysql_select_db('service_check')) {
exit('<p>Unable to locate the service' .
'database at this time.</p>');
}
$result = @mysql_query('SELECT * FROM service');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
echo'<table border="1"><tr align="center"><td>Host</td><td>Service</td><td>State</td></tr>';
// Display the results
while ($row = mysql_fetch_array($result)) {
echo '<tr align="center"><td>' . $row['host'] . '</td><td>' . $row['servicename'] . '</td>';
error_reporting(0);
$fp = fsockopen($row['host'],$row['port'],$errno,$errstr,10);
if(!$fp)
{
echo "<TD BGCOLOR=red>DOWN</td></tr>";
}else{
echo "<TD BGCOLOR=lightgreen>UP</td></tr>";
fclose($fp);
}
}
echo"</table>";