Check a server status.

(Updated with correct code. copied wrong code!)

Ever wanted to quickly whether a web server is up without going to the web page. Here is a quickie static cgi-bin script to do that. You can even check not only on local servers but most any web server on the net. The lines that do not have an ip address are virtual hosts from the last mentioned IP address. You will need to refresh the page to get the latest status.


The code is written in PHP, so PHP will need to be installed as well as the cgi-bin directory enabled. Most lamp servers have this already setup. There are probably better scripts but this one was quick and dirty.

)corrected)
[code]
 <html>
<body>

<hr>
<center>
<h2>
Web Server status
</h2>
</center>
<hr>
<br />
<table border="1" cellpadding="10">
<tr>
<td>
Ipaddress
</td>
<td>
Site (and link)
</td>
<td>
Description
</td>
<td>
Server status
</td>
</tr>
<tr>
<tr>
<td>
192.168.1.31
</td>
<td>
<a href="http://oesrvr1">Offshore Educators</a>
</td>
<td>
Old school site
</td>
<td>
<?php
if (fsockopen('oesrvr1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>
192.168.1.32
</td>
<td>
<a href="http://oeorgan1">Offshore Educators</a>
</td>
<td>
New school site
</td>
<td>
<?php
if (fsockopen('oeorgan1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>

<tr>
<td>

</td>
<td>
<a href="http://www.myposgarage.com">Myposgarage</a>
</td>
<td>
The store
</td>
<td>
<?php
if (fsockopen('www.myposgarage.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>

</td>
<td>
<a href="http://www.softserv.com">Softserv</a>
</td>
<td>
Software development
</td>
<td>
<?php
if (fsockopen('www.softserv.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<!--
<td>
<a href="http://www.myposgarage.com">Myposgarage</a>
</td>
<td>
The store
</td>

<td>
<?php
if (fsockopen('www.myposgarage.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
-->
</tr>
<tr>
<td>

</td>
<td>
<a href="http://www.www.thefoodhistory.com">The food history.com</a>
</td>
<td>
Food history
</td>
<td>
<?php
if (fsockopen('www.thefoodhistory.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>

</td>
<td>
<a href="http://www.misslizziesworld.com">Miss Lizzies world</a>
</td>
<td>
Womans world
</td>
<td>
<?php
if (fsockopen('www.misslizziesworld.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>

</td>
<td>
<a href="http://www.yourdrsmedicalrecords.com">Dr's office</a>
</td>
<td>
Medical office
</td>
<td>
<?php
if (fsockopen('www.yourdrsmedicalrecords.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>
192.168.1.33
</td>
<td>
<a href="http://oesrvr3">Offshore Educators</a>
</td>
<td>
Nslu2
</td>
<td>
<?php
if (fsockopen('oesrvr3', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>
<tr>
<td>
192.168.1.34
</td>
<td>
<a href="http://archie">Alarm</a>
</td>
<td>
Arch pogoplug
</td>
<td>
<?php
if (fsockopen('alarm', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>

<tr>
<td>
192.168.1.120
</td>
<td>
<a href="http://typo1">Typo1</a>
</td>
<td>
Pxe server
</td>
<td>
<?php
if (fsockopen('typo1', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>
</td>
</tr>

<tr>
<td>
Secret
</td>
<td>
<a href="http://www.google.com">Google</a>
</td>
<td>
Search engine
</td>
<td>
<?php
if (fsockopen('www.google.com', 80)){
echo('Online');
} else{
echo('The server is offline');
}
?>

</table>
</body>
</html>
[/code]

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice