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.2 by pjm2, Thu Mar 15 10:55:03 2001 UTC vs.
Revision 1.5 by pjm2, Thu Mar 15 17:14:59 2001 UTC

# Line 23 | Line 23 | function getValue($value, $alert) {
23   }
24  
25   function printAlert($machine, $alert) {
26 +
27 +    include("alerts_config.inc.php");
28 +
29      $alertLevel = getValue("alertLevel", $alert);
30      $lastAlert = getValue("lastAlert", $alert);
31      $thresholdLevel = getValue("thresholdLevel", $alert);
# Line 32 | Line 35 | function printAlert($machine, $alert) {
35      $attributeName = getValue("attributeName", $alert);
36      $timeTillNextAlert = getValue("timeTillNextAlert", $alert);
37      $initialAlertTime = getValue("initialAlertTime", $alert);
38 <    echo "<b>$alertLevel</b>$alert<br>";
38 >
39 >    $alertColour = $alertLevelColours[$alertLevel];
40 >    $alertLevel = $alertLevelNames[$alertLevel];
41 >
42 >    echo <<<EOT
43 >    
44 >    <table border="0">
45 >      <tr>
46 >        <td><b>$attributeName</b></td>
47 >        <td>&nbsp;</td>
48 >        <td>Alert level:</td>
49 >        <td><font color="$alertColour"><b>$alertLevel</b></font></td>
50 >      </tr>
51 >      <tr>
52 >        <td>Threshold:</td>
53 >        <td>$thresholdValue</td>
54 >        <td>Initially raised:</td>
55 >        <td>$initialAlertTime</td>
56 >      </tr>
57 >      <tr>
58 >        <td>Alert value:</td>
59 >        <td><b>$value</b></td>
60 >        <td><!--Next alert time:--> </td>
61 >        <td><!--$timeTillNextAlert--> </td>
62 >      </tr>
63 >    </table>
64 >    
65 > EOT;
66 >
67 >    printLine("");
68 >
69   }
70  
71 + function printReports($machine) {
72 +   # Get a list of all files in the machine's directory.
73 +   include("alerts_config.inc.php");
74 +   $alertArray = getdirArray("$alertDirectory/$machine", 'rsort');
75 +      
76 +   foreach($alertArray as $file_name) {
77 +       $input = file("$alertDirectory/$machine/$file_name");
78 +       $input = $input[0];
79 +       $alerts[] = $input;
80 +   }
81 +      
82 +   foreach ($alerts as $alert) {
83 +       printAlert($machine, $alert);
84 +   }
85 + }
86 +
87 +
88   ?>
89  
90   <? include($titleHTML); ?>
91  
92 < <? printLine("Display alerts about all hosts, or a host"); ?>
92 > <? printLine("Display the latest alerts for a host"); ?>
93  
94   <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
95   <?
# Line 63 | Line 113 | function printAlert($machine, $alert) {
113  
114   <? if ($machine) {
115  
116 <       # Get a list of all files in the machine's directory.
67 <       $alertArray = getdirArray("$alertDirectory/$machine", 'rsort');
68 <      
69 <       foreach($alertArray as $file_name) {
70 <           $input = file("$alertDirectory/$machine/$file_name");
71 <           $input = $input[0];
72 <           $alerts[] = $input;
73 <       }
74 <      
75 <       foreach ($alerts as $alert) {
76 <           printAlert($machine, $alert);
77 <       }
116 >       printLine("");
117  
118 +       printReports($machine);
119 +      
120     }
121 +   else {
122 +       printLine("");
123 +   }
124  
125   ?>
82
83 <? printLine(""); ?>
126  
127   <? include($bottomHTML); ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines