| 22 |  | return $matches[1]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 25 | < | function printAlert($machine, $alert) { | 
 
 
 
 
 
 
 
 
 | 25 | > | function printAlert($machine, $alert, $small="") { | 
 
 
 
 
 
 
 
 
 
 
 | 26 |  |  | 
 
 
 
 
 
 
 
 | 27 | + | global $fontsize; | 
 
 
 
 
 
 
 
 | 28 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 |  | include("alerts_config.inc.php"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 31 | < | $alertLevel = getValue("alertLevel", $alert); | 
 
 
 
 
 
 
 
 
 | 31 | > | $alertLevelNum = getValue("alertLevel", $alert); | 
 
 
 
 
 
 
 
 
 
 
 | 32 |  | $lastAlert = getValue("lastAlert", $alert); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 |  | $thresholdLevel = getValue("thresholdLevel", $alert); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 |  | $source = getValue("source", $alert); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 |  | $timeTillNextAlert = getValue("timeTillNextAlert", $alert); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 |  | $initialAlertTime = getValue("initialAlertTime", $alert); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 40 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 41 | < | $alertColour = $alertLevelColours[$alertLevel]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 | < | $alertLevel = $alertLevelNames[$alertLevel]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 41 | > | if ($thresholdLevel == "1") { | 
 
 
 
 
 | 42 | > | $thresholdLevel = "Lower"; | 
 
 
 
 
 | 43 | > | } | 
 
 
 
 
 | 44 | > | else if ($thresholdLevel == "2") { | 
 
 
 
 
 | 45 | > | $thresholdLevel = "Upper"; | 
 
 
 
 
 | 46 | > | } | 
 
 
 
 
 | 47 | > | else { | 
 
 
 
 
 | 48 | > | $thresholdLevel = "Normal"; | 
 
 
 
 
 | 49 | > | } | 
 
 
 
 
 | 50 | > |  | 
 
 
 
 
 | 51 | > | $alertColour = $alertLevelColours[$alertLevelNum]; | 
 
 
 
 
 | 52 | > | $alertLevel = $alertLevelNames[$alertLevelNum]; | 
 
 
 
 
 
 
 
 
 
 
 | 53 |  | $initialAlertTime = strftime("%x %X", intval($initialAlertTime / 1000)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 54 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 55 | < | if ($small) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 56 | < |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 55 | > | if ($small == "on") { | 
 
 
 
 
 | 56 | > | echo <<<EOT | 
 
 
 
 
 | 57 | > | <tr> | 
 
 
 
 
 | 58 | > | <td width="50"> | 
 
 
 
 
 | 59 | > |   | 
 
 
 
 
 | 60 | > | </td> | 
 
 
 
 
 | 61 | > | <td align="left"> | 
 
 
 
 
 | 62 | > | <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel"> | 
 
 
 
 
 | 63 | > | </td> | 
 
 
 
 
 | 64 | > | <td align="left"> | 
 
 
 
 
 | 65 | > | <font size="$fontsize" color="$alertColour"><b>$alertLevel</b></font> | 
 
 
 
 
 | 66 | > | </td> | 
 
 
 
 
 | 67 | > | <td align="left"> | 
 
 
 
 
 | 68 | > | <font size="$fontsize">$attributeName</font> | 
 
 
 
 
 | 69 | > | </td> | 
 
 
 
 
 | 70 | > | <td> | 
 
 
 
 
 | 71 | > |   | 
 
 
 
 
 | 72 | > | </td> | 
 
 
 
 
 | 73 | > | </tr> | 
 
 
 
 
 | 74 | > | EOT; | 
 
 
 
 
 
 
 
 
 
 
 | 75 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 76 |  | else { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 |  | echo <<<EOT | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 78 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 79 | < | <table border="0" cellspacing="5"> | 
 
 
 
 
 
 
 
 
 | 79 | > | <table border="0" cellspacing="5" width="100%"> | 
 
 
 
 
 
 
 
 
 
 
 | 80 |  | <tr> | 
 
 
 
 
 
 
 
 
 
 
 | 81 | < | <td><b>$attributeName</b></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | < | <td> </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | < | <td><font color="$alertColour" size="2"><b>$alertLevel</b></font></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | < | <td> </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | > | <td align="left" width="40%"> | 
 
 
 
 
 | 82 | > | <img src="level$alertLevelNum.gif" width="41" height="9" border="0" alt="$alertLevel"> | 
 
 
 
 
 | 83 | > | <font color="$alertColour" size="2"><b>$alertLevel</b></font> | 
 
 
 
 
 | 84 | > | </td> | 
 
 
 
 
 | 85 | > | <td align="right" width="60%"> | 
 
 
 
 
 | 86 | > | <b>$attributeName</b> | 
 
 
 
 
 | 87 | > | </td> | 
 
 
 
 
 
 
 
 
 
 
 | 88 |  | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 89 |  | <tr> | 
 
 
 
 
 
 
 
 
 
 
 | 90 | < | <td><font size="2">Threshold:</font></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 91 | < | <td>$thresholdValue</td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 59 | < | <td><font size="2">Initially raised:</font></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 60 | < | <td>$initialAlertTime</td> | 
 
 
 
 
 
 
 
 
 | 90 | > | <td align="right"><font size="2">Threshold:</font></td> | 
 
 
 
 
 | 91 | > | <td align="left">$thresholdValue ($thresholdLevel)</td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 92 |  | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 93 |  | <tr> | 
 
 
 
 
 
 
 
 
 
 
 | 94 | < | <td><font size="2">Alert value:</font></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 95 | < | <td><b>$value</b></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | < | <td><!--Next alert time:--> </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | < | <td><!--$timeTillNextAlert--> </td> | 
 
 
 
 
 
 
 
 
 | 94 | > | <td align="right"><font size="2">Alert value:</font></td> | 
 
 
 
 
 | 95 | > | <td align="left"><b>$value</b></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 |  | </tr> | 
 
 
 
 
 
 
 
 | 97 | + | <tr> | 
 
 
 
 
 
 
 
 | 98 | + | <td align="right"><font size="2">Initially raised:</font></td> | 
 
 
 
 
 
 
 
 | 99 | + | <td align="left">$initialAlertTime</td> | 
 
 
 
 
 
 
 
 | 100 | + | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 |  | </table> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 |  | EOT; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 109 | < | function printReports($machine) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 | > | function printReports($machine, $small="") { | 
 
 
 
 
 | 110 | > | global $fontsize; | 
 
 
 
 
 | 111 | > |  | 
 
 
 
 
 
 
 
 
 
 
 | 112 |  | # Get a list of all files in the machine's directory. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 113 |  | include("alerts_config.inc.php"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 114 |  | $alertArray = getdirArray("$alertDirectory/$machine", 'rsort'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 115 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 116 | < | echo <<<EOT | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 117 | < | <p> </p> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 118 | < | <table border="0" cellpadding="3" cellspacing="2" bgcolor="#000066" width="100%"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 119 | < | <tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 120 | < | <td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 121 | < | <font color="white"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 122 | < | <b> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 123 | < | Current alerts for $machine | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 124 | < | </b> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 125 | < | <font size="2"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 126 | < | <br>Sorted by time, latest first. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 127 | < | </font> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 128 | < | </font> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | < | </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 130 | < | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 131 | < | <tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 132 | < | <td bgcolor="white"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 116 | > | if ($small == "on") { | 
 
 
 
 
 | 117 | > | echo <<<EOT | 
 
 
 
 
 | 118 | > | <table border="0" align="center" cellpadding="2" cellspacing="6"> | 
 
 
 
 
 | 119 | > | <tr> | 
 
 
 
 
 | 120 | > | <td colspan="5"> | 
 
 
 
 
 | 121 | > | <font size="$fontsize"><b><a href="alerts.php?machine=$machine" style="color: black; text-decoration: none;">$machine</a></b></font> | 
 
 
 
 
 | 122 | > | </td> | 
 
 
 
 
 | 123 | > | </tr> | 
 
 
 
 
 | 124 | > | EOT; | 
 
 
 
 
 | 125 | > | } | 
 
 
 
 
 | 126 | > | else { | 
 
 
 
 
 | 127 | > | echo <<<EOT | 
 
 
 
 
 | 128 | > | <p> </p> | 
 
 
 
 
 | 129 | > | <table border="0" cellpadding="3" cellspacing="2" bgcolor="#000066" width="100%"> | 
 
 
 
 
 | 130 | > | <tr> | 
 
 
 
 
 | 131 | > | <td> | 
 
 
 
 
 | 132 | > | <font color="white"> | 
 
 
 
 
 | 133 | > | <b> | 
 
 
 
 
 | 134 | > | Current alerts for <a href="latest.php?machine=$machine" style="color: white">$machine</a> | 
 
 
 
 
 | 135 | > | </b> | 
 
 
 
 
 | 136 | > | <font size="2"> | 
 
 
 
 
 | 137 | > | <br>Sorted by time, latest first. | 
 
 
 
 
 | 138 | > | </font> | 
 
 
 
 
 | 139 | > | </font> | 
 
 
 
 
 | 140 | > | </td> | 
 
 
 
 
 | 141 | > | </tr> | 
 
 
 
 
 | 142 | > | <tr> | 
 
 
 
 
 | 143 | > | <td bgcolor="white"> | 
 
 
 
 
 
 
 
 
 
 
 | 144 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 145 |  | EOT; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 146 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 147 | < | printLine(""); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 147 | > | printLine(""); | 
 
 
 
 
 | 148 | > | } | 
 
 
 
 
 
 
 
 
 
 
 | 149 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 150 |  | if ($alertArray != FALSE) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 156 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 |  | foreach ($alerts as $alert) { | 
 
 
 
 
 
 
 
 
 
 
 | 159 | < | printAlert($machine, $alert); | 
 
 
 
 
 
 
 
 
 | 159 | > | printAlert($machine, $alert, $small); | 
 
 
 
 
 
 
 
 
 
 
 | 160 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 162 |  | else { | 
 
 
 
 
 
 
 
 
 
 
 | 163 | < | echo "There are currently no alerts held about <b>$machine</b>"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 164 | < | printLine(""); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 163 | > | if ($small != "on") { | 
 
 
 
 
 | 164 | > | echo "There are currently no alerts held about <b>$machine</b>"; | 
 
 
 
 
 | 165 | > | printLine(""); | 
 
 
 
 
 | 166 | > | } | 
 
 
 
 
 
 
 
 
 
 
 | 167 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 168 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 169 | < | echo <<<EOT | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 170 | < | </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | < | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 172 | < | </table> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 169 | > | if ($small == "on") { | 
 
 
 
 
 | 170 | > | echo "</table>"; | 
 
 
 
 
 | 171 | > | } | 
 
 
 
 
 | 172 | > | else { | 
 
 
 
 
 | 173 | > | echo <<<EOT | 
 
 
 
 
 | 174 | > | </td> | 
 
 
 
 
 | 175 | > | </tr> | 
 
 
 
 
 | 176 | > | </table> | 
 
 
 
 
 
 
 
 
 
 
 | 177 |  | EOT; | 
 
 
 
 
 
 
 
 | 178 | + | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 179 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 180 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 181 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 183 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 |  | <? include($titleHTML); ?> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 185 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 186 | < | <? printLine("Display the latest alerts for a host"); ?> | 
 
 
 
 
 
 
 
 
 | 186 | > | <? if ($hideform != "on") { ?> | 
 
 
 
 
 
 
 
 
 
 
 | 187 |  |  | 
 
 
 
 
 
 
 
 | 188 | + | <? printLine("Latest alerts for hosts"); ?> | 
 
 
 
 
 
 
 
 | 189 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 190 |  | <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 191 |  | <? | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 192 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 204 |  | print "</select>"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 205 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 206 |  | ?> | 
 
 
 
 
 
 
 
 | 207 | + | <input type="hidden" name="small" value="<?=$small?>"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 208 |  | <input type="submit" name="submit" value="Display"> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 209 |  | </form> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 210 |  |  | 
 
 
 
 
 
 
 
 | 211 | + | <? } ?> | 
 
 
 
 
 
 
 
 | 212 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 213 |  | <? if ($machine) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 214 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 215 |  | printLine(""); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 218 |  | $machine_array = getdirArray($alertDirectory, 'asort'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 219 |  | if ($machine_array != FALSE) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 220 |  | foreach ($machine_array as $machine) { | 
 
 
 
 
 
 
 
 
 
 
 | 221 | < | printReports($machine); | 
 
 
 
 
 
 
 
 
 | 221 | > | printReports($machine, $small); | 
 
 
 
 
 
 
 
 
 
 
 | 222 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 223 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 224 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 225 |  | else { | 
 
 
 
 
 
 
 
 
 
 
 | 226 | < | printReports($machine); | 
 
 
 
 
 
 
 
 
 | 226 | > | printReports($machine, $small); | 
 
 
 
 
 
 
 
 
 
 
 | 227 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 228 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 229 |  | } |