Announcement

Collapse
No announcement yet.

Extension to show all services with disabled notification

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extension to show all services with disabled notification

    Hi,

    I wrote an extension which shows all services with disabled notification in the resume bar (the bar who says x services are OK, y are CRITICAL, ...) and lists them on an extra page.

    You can use it if you want (under the terms of the GPL).


    Add the following lines (after line 72) to ./oreon/include/monitoring/parselogfile.php:
    Code:
    else if (isset($_GET["o"]) && !strcmp($_GET['o'], "sdis"))
    include("./disabled/list_disabled_services.php");
    Change the .oreon/include/status/resume.php by the following instructions:

    Code:
    33c33
    <                                       <td class="tabTableWC"<? if ($Logs->host["UNREACHABLE"] != 0 || $Logs->host["UNKNOWN"] != 0 || $Logs->host["PENDING"] != 0) print " bgcolor='#".$oreon->optGen->get_color_unreachable()."'"; ?>><? print ""; print $Logs->host["UNREACHABLE"] + $Logs->host["PENDING"] + $Logs->host["UNKNOWN"] ; print ""; ?></td>
    ---
    >                                       <td class="tabTableWC"<? if ($Logs->host["UNREACHABLE"] != 0 || $Logs->host["UNKNOWN"] != 0 || $Logs->host["PENDING"] != 0) print " bgcolor='#".$oreon->optGen->get_color_unreachable()."'"; ?>><? print ""; print $Logs->host["UNREACHABLE"] + $Logs->host["PENDING"] + $Logs->host["UNKNOWN"] ; print ""; ?> </td>
    48a49
    >                                     <td class="tabTableTitle"><? echo "DISABLED"; ?></td>
    55a57,59
    >
    > <td class="tabTableWC"><? print ""; include ("./disabled/count_disabled_services.php"); print ""; ?></td>
    >
    58c62
    <                                       <td height="1" bgcolor="#CCCCCC" colspan="5"></td>
    ---
    >                                       <td height="1" bgcolor="#CCCCCC" colspan="6"></td>
    This will show the extension in the resume bar.


    Create the directory ./oreon/disabled/

    Create the file count_disabled_services.php with the following content:
    Code:
    <?
     $count = 0;
    
     if (!isset($oreon))
      exit();
    
     foreach ($Logs->log_h as $log_h) {
      foreach ($log_h->log_s as $s) {
       if ($oreon->is_accessible($log_h->get_id()) && !$s->get_not_en()) {
        $count = $count + 1;
       }
      }
     }
     echo $count;
    
    ?>
    Copy your ./oreon/include/status/service_probleme.php to ./oreon/disabled/list_disabled_services.php

    Change the content of the list_disabled_services.php after the following instructions:


    Code:
    29c29
    <               <td class="text14b" align="center" style="text-decoration: underline; padding-bottom: 10px;"><? echo $lang['m_services_problems']; ?></td>
    ---
    >               <td class="text14b" align="center" style="text-decoration: underline; padding-bottom: 10px;"><? echo "Disabled Services"; ?></td>
    46c46
    <                                               if ($oreon->is_accessible($log_h->get_id()) && (!strcmp("CRITICAL", $s->get_status()) || !strcmp("WARNING", $s->get_status()) || !strcmp("UNKNOWN", $s->get_status()) || !strcmp("PENDING", $s->get_status()))){
    ---
    >                                               if ($oreon->is_accessible($log_h->get_id()) && !$s->get_not_en())       {
    Now the table will list all services with disabled notificatons.



    Code:
    53c53,56
    <                                                               echo "[img]./img/notification.gif[/img]";
    ---
    >                                                               echo "<a href='http://linuxap02e.dmc.de/oreon/oreon.php?p=306&cmd=13&id=".$s->get_id()."'>[img]./img/notification.gif[/img]";
    >
    > if (!$s->get_not_en())
    >                                                                                 echo "<a href='http://linuxap02e.dmc.de/oreon/oreon.php?p=306&cmd=12&id=".$s->get_id()."'>[img]./img/notifications.gif[/img]";
    Now its possible to re-enable the notifications without leaving this page.
    (This patch you also could cut into the normal ./oreon/include/status/service_probleme.php to be able to enable and disable the notifications in this list.)


    It should not be very hard to extend this to work also for hosts with disabled notifications.


    edit: It's designed for and tested with Oreon 1.2.3-RC3 but should also work with older versions.

    /prom

  • #2
    Thank you for your works :wink:
    Intel(R) Xeon(TM) CPU 3.4GHz - MemTotal : 1034476 kB
    Centreon 2.4.1 - Nagios 3.2.1 - Nagios Plugins 1.4.15 - Manubulon Plugins tuné
    Fedora Core 5 - 2.6.20-1.2320

    Comment

    Working...
    X