PHP scripts to display a more user-friendly overview of nagios status
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Formats.php 978B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?PHP
  2. function translateStatus($status) {
  3. switch ($status) {
  4. case 0: return 'OK';
  5. case 1: return 'Warning';
  6. case 2: return 'Critical';
  7. default: return 'Unknown';
  8. }
  9. }
  10. function formatDate($date, $scheduled = false, $id) {
  11. if ($date == 0) {
  12. return '<td class="date never update" id="' . $id . '">Never</td>';
  13. } else if ($date < strtotime('-30 seconds') && $scheduled) {
  14. return '<td class="date overdue update" id="' . $id . '">' . date('d/m/Y H:i', $date) . '</td>';
  15. } else {
  16. return '<td class="date update" id="' . $id . '">' . date('d/m/Y H:i', $date) . '</td>';
  17. }
  18. }
  19. function trunc($string) {
  20. if (strlen($string) > 60) {
  21. $string = substr($string, 0, 59).'…';
  22. }
  23. return $string;
  24. }
  25. function knatsort(&$karr){
  26. $kkeyarr = array_keys($karr);
  27. natsort($kkeyarr);
  28. $ksortedarr = array();
  29. foreach($kkeyarr as $kcurrkey){
  30. $ksortedarr[$kcurrkey] = $karr[$kcurrkey];
  31. }
  32. $karr = $ksortedarr;
  33. return true;
  34. }
  35. ?>