| 17 |  | echo "<b>$title</b>"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 |  |  | 
 
 
 
 
 
 
 
 | 20 | + | function getValue($value, $alert) { | 
 
 
 
 
 
 
 
 | 21 | + | preg_match("/$value=([^\,\}]*)[\,\}]/", $alert, $matches); | 
 
 
 
 
 
 
 
 | 22 | + | return $matches[1]; | 
 
 
 
 
 
 
 
 | 23 | + | } | 
 
 
 
 
 
 
 
 | 24 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 |  | function printAlert($machine, $alert) { | 
 
 
 
 
 
 
 
 
 
 
 | 26 | < | echo "$alert<br>"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 26 | > | $alertLevel = getValue("alertLevel", $alert); | 
 
 
 
 
 | 27 | > | $lastAlert = getValue("lastAlert", $alert); | 
 
 
 
 
 | 28 | > | $thresholdLevel = getValue("thresholdLevel", $alert); | 
 
 
 
 
 | 29 | > | $source = getValue("source", $alert); | 
 
 
 
 
 | 30 | > | $thresholdValue = getValue("thresholdValue", $alert); | 
 
 
 
 
 | 31 | > | $value = getValue("value", $alert); | 
 
 
 
 
 | 32 | > | $attributeName = getValue("attributeName", $alert); | 
 
 
 
 
 | 33 | > | $timeTillNextAlert = getValue("timeTillNextAlert", $alert); | 
 
 
 
 
 | 34 | > | $initialAlertTime = getValue("initialAlertTime", $alert); | 
 
 
 
 
 | 35 | > | echo "<b>$alertLevel</b>$alert<br>"; | 
 
 
 
 
 
 
 
 
 
 
 | 36 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 |  | ?> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 40 |  | <? include($titleHTML); ?> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 41 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 42 | < | <? printLine("Display alerts about all hosts, or a host"); ?> | 
 
 
 
 
 
 
 
 
 | 42 | > | <? printLine("Display the latest alerts for a host"); ?> | 
 
 
 
 
 
 
 
 
 
 
 | 43 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 44 |  | <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 45 |  | <? | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 |  | <? if ($machine) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 |  |  | 
 
 
 
 
 
 
 
 | 66 | + | printLine(""); | 
 
 
 
 
 
 
 
 | 67 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 |  | # Get a list of all files in the machine's directory. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 |  | $alertArray = getdirArray("$alertDirectory/$machine", 'rsort'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 71 | < | foreach($file_array as $file_name) { | 
 
 
 
 
 
 
 
 
 | 71 | > | foreach($alertArray as $file_name) { | 
 
 
 
 
 
 
 
 
 
 
 | 72 |  | $input = file("$alertDirectory/$machine/$file_name"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 73 |  | $input = $input[0]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 74 |  | $alerts[] = $input; |