I have written a PHP script which shows the file system usages of some unix servers in a dashboard. I want to get a sound to be generated when the usage in any file system goes beyond 80%.
I am providing my script and a sample of my output as it shows in the dashboard.
Please help.
Thank You
I am providing my script and a sample of my output as it shows in the dashboard.
Please help.
Code:
<?php
//Get the parameter type
$Mountpointtype=$_POST["mountpointtype"];
/*Call scripts to generate filter data8*/
system("/shLog/scripts/preProd/viewmountpointdata.sh $Mountpointtype");
/* Handle exception If File exist then proceed to display data*/
$InputFileName="/shLog/scripts/output/Dashboard/resources/storageData/displayData.log";
if(!file_exists("$InputFileName"))
{
/* Show Error Message ...*/
echo "
<div id=bv_Text1 style=position:absolute;left:97px;top:70px;width:637px;height:28px;z-index:0 align=top><img src=images/img_error1.jpg id=Image1 alt= align=top border=0 style=width:14px;height:14px;><font style=font-size:14px color=#0000FF face=Arial align=top><b>**<i>Input Data file not available. Please verify and try again.</i></b></font></div>
";
die("");
}
else
{
/* Input data from csv file*/
$file_handle = fopen("$InputFileName", "r");
}
echo "<html>";
echo "
<head> <style type='text/css'>
body { font-family:Arial, Helvetica, Sans-Serif; font-size:0.7em;}
#report { border-collapse:collapse;}
#report h4 { margin:0px; padding:0px;}
#report img { float:right;}
#report ul { margin:10px 0 10px 40px; padding:0px;}
#report th { background:#7CB8E2 url(images/img_header_bkg.png) repeat-x scroll center left; color:#fff; padding:5px 20px; text-align:left;}
#report td { background:#C7DDEE none repeat-x scroll center left; color:#000; padding:2px 20px; }
#report tr.odd td { background:#fff url(images/img_row_bkg.png) repeat-x scroll center left; cursor:pointer; }
#report div.arrow { background:transparent url(images/img_arrows.png) no-repeat scroll 0px -16px; width:16px; height:16px; display:block;}
#report div.up { background-position:0px 0px;}
</style> <script src=jquery.min.js type='text/javascript'></script> <script type='text/javascript'>
$(document).ready(function(){
$('#report tr:odd').addClass('odd');
$('#report tr:not(.odd)').hide();
$('#report tr:first-child').show();
$('#report tr.odd').click(function(){
$(this).next('tr').toggle();
$(this).find('.arrow').toggleClass('up');
});
//$('#report').jExpand();
});
</script> </head>
";
echo "<body> <font style=font-size:15px;background-color:#FFFFFF color=#00008B face=Tahoma text-align:center><b>******FileSystem mount Point Usage</b></font> <br><br> <table id=report style=font-size:11px ; face=Georgia ; font-family:Arial, Helvetica, Sans-Serif ; align=left> <tr> <th>Hostname</th> <th>Time</th> <th>%Usage</th> <th>MountpointName</th> <th>Status</th> <th>Type</th> </tr>
";
//Output a line of the file until the end is reached
while (!feof($file_handle) ) {
$line_of_text = fgetcsv($file_handle, 1024);
echo "
<tr> <td>$line_of_text[0]</td> <td>$line_of_text[2]</td> <td>$line_of_text[4]</td> <td>$line_of_text[5]</td> <td>$line_of_text[6]</td> <td>$line_of_text[7]</td> </tr> <tr>
echo "
</ul> </td> </tr>
";
}
echo "</table>";
echo "</body>";
echo "</html>";
fclose($file_handle);
?>
My Output
-------------
FileSystem mount Point Usage
Hostname Time %Usage MountpointName Status Type
PRMSWB02 11:00 83 / critical Local
PFMWDB02 11:00 83 /nim critical Local
PRMSCM01 11:00 80 / critical Local
PORAID02 11:00 79 /home critical Local
PRMSCM01 11:00 76 /home critical Local
POUBDB01 11:00 76 /dataou critical San
PFMWDB02 11:00 76 /datafm critical San
POUBDB01 11:00 72 /opt critical Local
PFMWDB01 11:00 69 /opt warning Local
PRMSAP02 11:00 68 /tmp warning Local
POUBDB01 11:00 67 /home warning Local
PRMSCM02 11:00 65 /app warning San
PRMSCM01 11:00 65 /app warning San
POUBDB01 11:00 65 /dataou5 warning San
POUBDB01 11:00 65 /dataou10 warning San
POUBDB01 11:00 64 /dataou6 warning San
PMSGMS01 11:00 64 / warning Local
PRMSPO01 11:00 62 / warning Local
PRMSPO01 11:00 61 /u01 warning Local
POUBDB01 11:00 61 /dataou9 warning San
POUBDB01 11:00 60 /dataou3 warning San
PFMWDB02 11:00 57 /djb warning Local
PORAID01 11:00 55 /home warning Local
PORAID01 11:00 55 /u01 warning Local
PFMWDB02 11:00 54 /usr warning Local
PFMWDB01 11:00 54 /usr warning Local
POUBDB01 11:00 53 /usr warning Local
PFMWDB01 11:00 53 / warning Local
PRMSDB02 11:00 52 /usr warning Local
PMSGMS02 11:00 50 / warning Local
PFMWDB01 11:00 50 /tmp warning Local
Thank You
Comment