# | Line 26 | Line 26 | function printAlert($machine, $alert, $small="") { | |
---|---|---|
26 | ||
27 | include("alerts_config.inc.php"); | |
28 | ||
29 | < | $alertLevel = getValue("alertLevel", $alert); |
29 | > | $alertLevelNum = getValue("alertLevel", $alert); |
30 | $lastAlert = getValue("lastAlert", $alert); | |
31 | $thresholdLevel = getValue("thresholdLevel", $alert); | |
32 | $source = getValue("source", $alert); | |
# | Line 36 | Line 36 | function printAlert($machine, $alert, $small="") { | |
36 | $timeTillNextAlert = getValue("timeTillNextAlert", $alert); | |
37 | $initialAlertTime = getValue("initialAlertTime", $alert); | |
38 | ||
39 | < | $alertColour = $alertLevelColours[$alertLevel]; |
40 | < | $alertLevel = $alertLevelNames[$alertLevel]; |
39 | > | if ($thresholdLevel == "1") { |
40 | > | $thresholdLevel = "Lower"; |
41 | > | } |
42 | > | else if ($thresholdLevel == "2") { |
43 | > | $thresholdLevel = "Upper"; |
44 | > | } |
45 | > | else { |
46 | > | $thresholdLevel = "Normal"; |
47 | > | } |
48 | > | |
49 | > | $alertColour = $alertLevelColours[$alertLevelNum]; |
50 | > | $alertLevel = $alertLevelNames[$alertLevelNum]; |
51 | $initialAlertTime = strftime("%x %X", intval($initialAlertTime / 1000)); | |
52 | ||
53 | if ($small == "true") { | |
54 | < | echo "small"; |
54 | > | echo <<<EOT |
55 | > | <tr> |
56 | > | <td width="50"> |
57 | > | |
58 | > | </td> |
59 | > | <td align="left"> |
60 | > | <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel"> |
61 | > | </td> |
62 | > | <td align="left"> |
63 | > | <font size="3" color="$alertColour"><b>$alertLevel</b></font> |
64 | > | </td> |
65 | > | <td align="left"> |
66 | > | <font size="3">$attributeName</font> |
67 | > | </td> |
68 | > | <td> |
69 | > | |
70 | > | </td> |
71 | > | </tr> |
72 | > | EOT; |
73 | } | |
74 | else { | |
75 | echo <<<EOT | |
76 | ||
77 | < | <table border="0" cellspacing="5"> |
77 | > | <table border="0" cellspacing="5" width="100%"> |
78 | <tr> | |
79 | < | <td><b>$attributeName</b></td> |
80 | < | <td> </td> |
81 | < | <td><font color="$alertColour" size="2"><b>$alertLevel</b></font></td> |
82 | < | <td> </td> |
79 | > | <td align="left" width="40%"> |
80 | > | <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel"> |
81 | > | <font color="$alertColour" size="2"><b>$alertLevel</b></font> |
82 | > | </td> |
83 | > | <td align="right" width="60%"> |
84 | > | <b>$attributeName</b> |
85 | > | </td> |
86 | </tr> | |
87 | <tr> | |
88 | < | <td><font size="2">Threshold:</font></td> |
89 | < | <td>$thresholdValue</td> |
59 | < | <td><font size="2">Initially raised:</font></td> |
60 | < | <td>$initialAlertTime</td> |
88 | > | <td align="right"><font size="2">Threshold:</font></td> |
89 | > | <td align="left">$thresholdValue ($thresholdLevel)</td> |
90 | </tr> | |
91 | <tr> | |
92 | < | <td><font size="2">Alert value:</font></td> |
93 | < | <td><b>$value</b></td> |
65 | < | <td><!--Next alert time:--> </td> |
66 | < | <td><!--$timeTillNextAlert--> </td> |
92 | > | <td align="right"><font size="2">Alert value:</font></td> |
93 | > | <td align="left"><b>$value</b></td> |
94 | </tr> | |
95 | + | <tr> |
96 | + | <td align="right"><font size="2">Initially raised:</font></td> |
97 | + | <td align="left">$initialAlertTime</td> |
98 | + | </tr> |
99 | </table> | |
100 | ||
101 | EOT; | |
# | Line 80 | Line 111 | function printReports($machine, $small="") { | |
111 | ||
112 | if ($small == "true") { | |
113 | echo <<<EOT | |
114 | < | <table border="0" cellpadding="2" cellspacing="2" bgcolor="#ffffff" width="100%"> |
114 | > | <table border="0" cellpadding="2" cellspacing="0"> |
115 | <tr> | |
116 | < | <td bgcolor="#000066"> |
117 | < | <font color="white"><b>$machine</b></font> |
116 | > | <td colspan="5"> |
117 | > | <font size="+1"><b><a href="alerts.php?machine=$machine" style="color: black; text-decoration: none;">$machine</a></b></font> |
118 | </td> | |
119 | </tr> | |
120 | EOT; | |
# | Line 96 | Line 127 | EOT; | |
127 | <td> | |
128 | <font color="white"> | |
129 | <b> | |
130 | < | Current alerts for $machine |
130 | > | Current alerts for <a href="latest.php?machine=$machine" style="color: white">$machine</a> |
131 | </b> | |
132 | <font size="2"> | |
133 | <br>Sorted by time, latest first. | |
# | Line 125 | Line 156 | EOT; | |
156 | } | |
157 | } | |
158 | else { | |
159 | < | echo "There are currently no alerts held about <b>$machine</b>"; |
160 | < | printLine(""); |
159 | > | if ($small != "true") { |
160 | > | echo "There are currently no alerts held about <b>$machine</b>"; |
161 | > | printLine(""); |
162 | > | } |
163 | } | |
164 | ||
165 | if ($small == "true") { | |
# | Line 146 | Line 179 | EOT; | |
179 | ||
180 | <? include($titleHTML); ?> | |
181 | ||
182 | < | <? printLine("Display the latest alerts for a host"); ?> |
182 | > | <? if (!$hideform) { ?> |
183 | ||
184 | + | <? printLine("Latest alerts for hosts"); ?> |
185 | + | |
186 | <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> | |
187 | <? | |
188 | ||
# | Line 168 | Line 203 | EOT; | |
203 | <input type="hidden" name="small" value="<?=$small?>"> | |
204 | <input type="submit" name="submit" value="Display"> | |
205 | </form> | |
206 | + | |
207 | + | <? } ?> |
208 | ||
209 | <? if ($machine) { | |
210 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |