Changeset 1325
- Timestamp:
- 01/26/08 19:04:28 (10 months ago)
- Files:
-
- trunk/wifidog-auth/wifidog/cron/page.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/wifidog/cron/page.php
r1286 r1325 55 55 $last_heartbeat = strtotime($nodeObject->getLastHeartbeatTimestamp()); 56 56 $time = time(); 57 $downtime = round((time() - $last_heartbeat)/60, 0); 58 $paged_addresses = ""; 57 59 58 60 if ($time - $last_heartbeat > 60*$minutes) {//If hostpot is down for longuer than the requested average interval … … 78 80 $mail->setRecipientEmail($officer->getEmail()); 79 81 $mail->setMessageSubject($minutes . " - " . $network->getName()." "._("node")." ".$nodeObject->getName()); 82 $mail->setHighPriority(true); 80 83 $mail->setMessageBody(sprintf(_("Node %s (%s) has been down for %d minutes (since %s)"), $nodeObject->getName(), $nodeObject->getId(), $minutes, date("r", $last_heartbeat))); 81 84 $mailRetval = $mail->send(); 82 85 $usersMsg .= sprintf("%s: %s", $officer->getUsername(), $mailRetval?_("Success"):_("Failed sending mail"))."\n"; 83 84 86 } 85 87 $msg = sprintf("Node %s has been DOWN for %d minutes, we mailed the following %d user(s):\n%s", $nodeObject->getName(), ($time-$last_heartbeat)/60, count($usersToPage), $usersMsg) ; … … 99 101 throw new Exception(_("No deployed nodes could not be found in the database")); 100 102 103 echo "<html>\n<head>\n"; 104 echo "<title>Node Monitoring System</title>\n</head>\n"; 105 echo "<style>\n"; 106 echo "table {border: 1px solid black;}\n"; 107 echo "td {padding: 4px;}\n"; 108 echo "tr {border: 1px solid black;}\n"; 109 echo ".alert {background: #ffaaaa;}\n"; 110 echo "</style>"; 111 echo "<body>\n"; 112 echo "<p>Current server time: " . date("r") . "</p>"; 113 echo "<table>\n<tr><th>Node</th><th>Last Heartbeat</th><th>Last IP Address</th><th>Status Message</th></tr>\n"; 101 114 foreach ($nodes_results as $node_row) 102 115 { 103 $nodeObject = Node :: getObject($node_row['node_id']); 104 #echo $nodeObject->getName(); 105 #echo " - "; 106 #echo $nodeObject->getLastHeartbeatTimestamp(); 107 #echo " - "; 116 $nodeObject = Node :: getObject($node_row['node_id']); 117 echo "<tr><td>"; 118 echo $nodeObject->getName(); 119 echo "</td><td>"; 120 echo $nodeObject->getLastHeartbeatTimestamp(); 121 echo "</td><td>"; 122 echo $nodeObject->getLastHeartbeatIP(); 123 echo "</td>"; 108 124 try { 109 125 page_if_down_since($nodeObject, 43200);//A month … … 113 129 page_if_down_since($nodeObject, 30);//30 min 114 130 page_if_down_since($nodeObject, 5);//5 min 131 echo "<td>ok</td>"; 115 132 } catch (Exception $e) { 116 133 # Do nothing, we cronned this 117 echo $e->getMessage(); 134 echo "<td class=\"alert\">"; 135 echo $e->getMessage() . "<br>"; 136 echo "</td>"; 118 137 } 119 #echo "<br>"; 120 #echo "<hr>"; 121 #echo "\n"; 138 echo "</tr>\n"; 122 139 } 140 echo "</table></body></html>\n"; 123 141 } catch (Exception $e) { 124 142 echo $e; 125 143 } 126 127 144 /* 128 145 * Local variables: … … 132 149 * End: 133 150 */ 134 135 151 ?>
