Jump to content

aerris

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aerris's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>";
  2. Hello, I use loads of different servers at work and they all run seperate services that I need to keep my stuff running. I want to build a simple webpage that will poll the services and display the current state by colour. EG have table that lists the services in green and have them turn red if the service stops unexpectedly. I can build the tables and stuff, I just don't know how to retrieve the state of a service. I've been messing about with some ideas but nothing is working. eg lets say I have two servers each with one service: service one |IP Address of server |RUNNING service two |IP Address of server |STOPPED Has anyone got any ideas? Thanks!!
  3. Hello! Just saying hello before I ask my question. I'm aerris... been coding PHP for fun for a few years, building mostly php website with mysql intergration.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.