ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/alerts/alerts.php
(Generate patch)

Comparing projects/cms/source/reports/php/alerts/alerts.php (file contents):
Revision 1.20 by pjm2, Wed Mar 21 17:32:24 2001 UTC vs.
Revision 1.38 by tdb, Fri Mar 11 12:23:31 2005 UTC

# Line 1 | Line 1
1   <?php
2  
3 # Navigation for the i-scream alerts.
4 # pjm2@ukc.ac.uk
3   #
4 + # i-scream central monitoring system
5 + # http://www.i-scream.org
6 + # Copyright (C) 2000-2002 i-scream
7 + #
8 + # This program is free software; you can redistribute it and/or
9 + # modify it under the terms of the GNU General Public License
10 + # as published by the Free Software Foundation; either version 2
11 + # of the License, or (at your option) any later version.
12 + #
13 + # This program is distributed in the hope that it will be useful,
14 + # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 + # GNU General Public License for more details.
17 + #
18 + # You should have received a copy of the GNU General Public License
19 + # along with this program; if not, write to the Free Software
20 + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 + #
22 +
23   # CONFIGURABLE CONSTANTS: -
24  
25   include("alerts_config.inc.php");
# Line 12 | Line 29 | include("alerts_config.inc.php");
29  
30   include("iutils.inc.php");
31  
32 + if ($formMethod == "GET") {
33 +    # in order of public.php
34 +    $machine = isset($_GET['machine']) ? $_GET['machine'] : "";
35 +    $fontsize = isset($_GET['fontsize']) ? $_GET['fontsize'] : "";
36 +    $refresh = isset($_GET['refresh']) ? $_GET['refresh'] : "";
37 +    $hideform = isset($_GET['hideform']) ? $_GET['hideform'] : "";
38 +    $pagewidth = isset($_GET['pagewidth']) ? $_GET['pagewidth'] : "";
39 +    $small = isset($_GET['small']) ? $_GET['small'] : "";
40 +    $submit = isset($_GET['submut']) ? $_GET['submit'] : "";
41 + }
42 +
43   function printLine($title) {
44      echo "<hr style=\"color:#9999ff;\">";
45      echo "<b>$title</b>";
# Line 24 | Line 52 | function getValue($value, $alert) {
52  
53   function printAlert($machine, $alert, $small="") {
54  
55 +    global $fontsize;
56 +
57      include("alerts_config.inc.php");
58  
59      $alertLevelNum = getValue("alertLevel", $alert);
# Line 36 | Line 66 | function printAlert($machine, $alert, $small="") {
66      $timeTillNextAlert = getValue("timeTillNextAlert", $alert);
67      $initialAlertTime = getValue("initialAlertTime", $alert);
68  
69 +    if ($thresholdLevel == "1") {
70 +        $thresholdLevel = "Lower";
71 +    }
72 +    else if ($thresholdLevel == "2") {
73 +        $thresholdLevel = "Upper";
74 +    }
75 +    else {
76 +        $thresholdLevel = "Normal";
77 +    }
78 +
79      $alertColour = $alertLevelColours[$alertLevelNum];
80      $alertLevel = $alertLevelNames[$alertLevelNum];
81      $initialAlertTime = strftime("%x %X", intval($initialAlertTime / 1000));
82  
83 <    if ($small == "true") {
83 >    if ($small == "on") {
84          echo <<<EOT
85              <tr>
86               <td width="50">
87                &nbsp;
88               </td>
89 <             <td align="left">
89 >             <td>
90                <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel">
91               </td>
92 <             <td align="left">
93 <              <font size="3" color="$alertColour"><b>$alertLevel</b></font>
92 >             <td>
93 >              <font size="$fontsize" color="$alertColour"><b>$alertLevel</b></font>
94               </td>
95 <             <td align="left">
96 <              <font size="3">$attributeName</font>
95 >             <td>
96 >              <font size="$fontsize">$attributeName (c:$value t:$thresholdValue)</font>
97               </td>
98               <td>
99                &nbsp;
# Line 64 | Line 104 | EOT;
104      else {
105          echo <<<EOT
106          
107 <        <table border="0" cellspacing="5">
107 >        <table border="0" cellspacing="5" width="100%">
108            <tr>
109 <            <td><b>$attributeName</b></td>
110 <            <td>&nbsp;</td>
111 <            <td><font color="$alertColour" size="2"><b>$alertLevel</b></font></td>
112 <            <td>&nbsp;</td>
109 >            <td align="left" width="40%">
110 >              <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel">
111 >              <font color="$alertColour" size="2"><b>$alertLevel</b></font>
112 >            </td>
113 >            <td align="right" width="60%">
114 >              <b>$attributeName</b>
115 >            </td>
116            </tr>
117            <tr>
118 <            <td><font size="2">Threshold:</font></td>
119 <            <td>$thresholdValue</td>
77 <            <td><font size="2">Initially raised:</font></td>
78 <            <td>$initialAlertTime</td>
118 >            <td align="right"><font size="2">Threshold:</font></td>
119 >            <td align="left">$thresholdValue ($thresholdLevel)</td>
120            </tr>
121            <tr>
122 <            <td><font size="2">Alert value:</font></td>
123 <            <td><b>$value</b></td>
83 <            <td><!--Next alert time:--> </td>
84 <            <td><!--$timeTillNextAlert--> </td>
122 >            <td align="right"><font size="2">Alert value:</font></td>
123 >            <td align="left"><b>$value</b></td>
124            </tr>
125 +          <tr>
126 +            <td align="right"><font size="2">Initially raised:</font></td>
127 +            <td align="left">$initialAlertTime</td>
128 +          </tr>
129          </table>
130              
131   EOT;
# Line 92 | Line 135 | EOT;
135   }
136  
137   function printReports($machine, $small="") {
138 +    global $fontsize;
139 +
140      # Get a list of all files in the machine's directory.
141      include("alerts_config.inc.php");
142      $alertArray = getdirArray("$alertDirectory/$machine", 'rsort');
143    
144 <    if ($small == "true") {
144 >    if ($small == "on") {
145          echo <<<EOT
146 <           <table border="0" cellpadding="2" cellspacing="0">
146 >           <table border="0" cellpadding="2" cellspacing="6">
147              <tr>
148               <td colspan="5">
149 <              <font size="+1"><b>$machine</b></font>
149 >              <font size="$fontsize"><b><a href="alerts.php?machine=$machine" style="color: black; text-decoration: none;">$machine</a></b></font>
150               </td>
151              </tr>
152   EOT;
# Line 110 | Line 155 | EOT;
155          echo <<<EOT
156               <p>&nbsp;</p>
157               <table border="0" cellpadding="3" cellspacing="2" bgcolor="#000066" width="100%">
158 <               <tr>
158 >              <tr>
159                 <td>
160                  <font color="white">
161                   <b>
162 <                  Current alerts for $machine
162 >                  Current alerts for <a href="latest.php?machine=$machine" style="color: white">$machine</a>
163                   </b>
164                   <font size="2">
165                    <br>Sorted by time, latest first.
# Line 143 | Line 188 | EOT;
188          }
189      }
190      else {
191 <        echo "There are currently no alerts held about <b>$machine</b>";
192 <        printLine("");
191 >        if ($small != "on") {
192 >            echo "There are currently no alerts held about <b>$machine</b>";
193 >            printLine("");
194 >        }
195      }
196  
197 <    if ($small == "true") {
198 <        echo "</table>";
197 >    if ($small == "on") {
198 >        echo <<<EOT
199 >            <tr>
200 >             <td colspan="5">&nbsp;</td>
201 >            </tr>
202 >           </table>
203 > EOT;
204      }
205      else {
206          echo <<<EOT
# Line 164 | Line 216 | EOT;
216  
217   <? include($titleHTML); ?>
218  
219 < <? if (!$hideform) { ?>
219 > <? if ($hideform != "on") { ?>
220  
221   <? printLine("Latest alerts for hosts"); ?>
222  
# Line 195 | Line 247 | EOT;
247  
248         printLine("");
249  
250 +       $masterwidth = "";
251 +       if ($small != "on") {
252 +           $masterwidth = ' width="100%"';
253 +       }
254 +
255 +       echo <<<EOT
256 +        <table border="0" align="center"$masterwidth>
257 +         <tr>
258 +          <td>
259 + EOT;
260 +
261         if ($machine == "ALL") {
262             $machine_array = getdirArray($alertDirectory, 'asort');
263             if ($machine_array != FALSE) {
# Line 202 | Line 265 | EOT;
265                     printReports($machine, $small);
266                 }
267             }
268 +           else {
269 +               print "<font size='$fontsize'><b>There are currently no alerts</b></font>";
270 +           }
271         }
272         else {
273             printReports($machine, $small);
274         }
275        
276 +       echo <<<EOT
277 +         </td>
278 +        </tr>
279 +       </table>
280 + EOT;
281     }
282     else {
283         printLine("");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines