I have configured multiple ISP links in a linux firewall. But it is very difficult for users to understand which like is up or down. I decided to create a simple webpage which gives the status of each link in a webpage. This will avoid the hassle of login to linux machine as a normal user and running commands with root privilage
You can use php and fping to check your ISP links status. Make sure that fping is installed in your firewall.
For a better appearance I am using images to show status of link
Image Courtesy: Open ClipArt
Image Courtesy: Open ClipArt
Image which I used to show when a link is Active. Image name is up.png
Image which I used to show when a link is down. Image name is down.gif
I have copied both images in to folder img. Below is the php script. For checking the ping response I am using OpenDNS IP address as my destination server
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Link Monitor</title></head><body>
<?
// This is the remote host used for fping. Do not change. I am using OpenDNS IP
$remote_host = "208.67.222.222";
// Add you links in to array. Chang these IP address according to IP addres configured in your firewall. You can one or more IP address in to array
$isps = array('111.222.333.444','555.666.777.888');
$status = array();
foreach ($isps as $isp)
{
$fping = `/usr/sbin/fping -u -S$isp $remote_host`;
if ($fping == "")
{
array_push ($status , "up.png");
}
else
{
array_push ($status , "down.gif");
}
}
?>
</br>
<table style="text-align: left; width: 1062px; height: 75px;" border="0" cellpadding="2" cellspacing="2">
<?
$count = 1;
foreach ($isps as $isp) {?>
<tr><td width=20%><FONT COLOR=black FACE="Geneva, Arial" SIZE=5>Link <?echo $count?></font></td><td width=30%><FONT COLOR=Blue FACE="Geneva, Arial" SIZE=5><?echo array_pop($isps);?></font></td><td width=30%><IMG SRC="img/<?echo array_pop($status);?>" height="60" width="61"></td></tr>
<?$count ++;}?>
</table>
</body></html>
How to input bulk ip from txt file to test ping
ReplyDelete