Feature #4448

add acknowledge in warning and unknown

Added by Jm0u almost 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:08/22/2013
Priority:NormalDue date:
Assignee:ddurieux% Done:

100%

Category:-
Target version:Plugin_monitoring 0.84+1.1

Description

add acknowledge in warning and unknown

display.class.php Magnifier (66.8 KB) Jm0u, 08/22/2013 02:56 PM

History

#1 Updated by Jm0u almost 7 years ago

voici le fichier modifié pour faire cela

#2 Updated by ddurieux almost 7 years ago

Ca marchera dans glpi, mais pas dans shinken, l'ack ne fonctionne pas sur le warning il me semble (à vérifier)

#3 Updated by Jm0u almost 7 years ago

in inc/display.class.php

replace function getState

   static function getState($state, $state_type, $event, $acknowledge=0) {
      $shortstate = '';
      switch($state) {

         case 'UP':
         case 'OK':
            $shortstate = 'green';
            break;

         case 'DOWN':
         case 'UNREACHABLE':
         case 'CRITICAL':
         case 'DOWNTIME':
            if ($acknowledge) {
               $shortstate = 'redblue';
            } else {
               $shortstate = 'red';
            }
            break;

         case 'WARNING':
         case 'RECOVERY':
         case 'FLAPPING':
            if ($acknowledge) {
               $shortstate = 'redblue';
            } else {
            $shortstate = 'orange';
            }
            break;

         case 'UNKNOWN':
         case '':
            if ($acknowledge) {
               $shortstate = 'redblue';
            } else {
                $shortstate = 'yellow';
            }
            break;

      }
      if ($state == 'WARNING' && $event == '') {
            if ($acknowledge) {
               $shortstate = 'redblue';
            } else {
            $shortstate = 'yellow';
            }

      }
      if ($state_type == 'SOFT') {
         $shortstate.= '_soft';
      }
      return $shortstate;
   }

file inc/display.class.php

modify line 1137 $acknowledge by :

         $acknowledge = countElementsInTable("glpi_plugin_monitoring_services", 
                 "(`state_type`='HARD' OR `state_type`='WARNING' 
                    OR `state_type`='UNKNOWN')
                    AND `entities_id` IN (".$_SESSION['glpiactiveentities_string'].")
                    AND `is_acknowledged`='1'");

file inc/display.class.php

modify line 1318
$warning_link
$warningdata_link
$warningconnection_link


      $warning_link = $CFG_GLPI['root_doc'].
               "/plugins/monitoring/front/service.php?hidesearch=1&reset=reset".
                  "&field[0]=3&searchtype[0]=contains&contains[0]=FLAPPING&link[1]=AND".
                  "&field[1]=23&searchtype[1]=equals&contains[1]=0&link[2]=OR".
                  "&field[2]=3&searchtype[2]=contains&contains[2]=RECOVERY&link[3]=AND".
                  "&field[3]=23&searchtype[3]=equals&contains[3]=0&link[4]=OR".
                  "&field[4]=3&searchtype[4]=contains&contains[4]=WARNING&link[5]=AND".
                  "&field[5]=23&searchtype[5]=equals&contains[5]=0".
                  "&itemtype=PluginMonitoringService&start=0&glpi_tab=3'";
      $warningdata_link = $CFG_GLPI['root_doc'].
               "/plugins/monitoring/front/service.php?hidesearch=1&reset=reset".
                  "&field[0]=3&searchtype[0]=contains&contains[0]=FLAPPING&link[1]=AND".
                  "&field[1]=23&searchtype[1]=equals&contains[1]=0&link[2]=OR".
                  "&field[2]=3&searchtype[2]=contains&contains[2]=RECOVERY&link[3]=AND".
                  "&field[3]=23&searchtype[3]=equals&contains[3]=0&link[4]=OR".
                  "&field[4]=3&searchtype[4]=contains&contains[4]=WARNING&link[5]=AND".
                  "&field[5]=23&searchtype[5]=equals&contains[5]=0&link[6]=AND".
                  "&field[6]=9&searchtype[6]=contains&contains[6]=^".
                  "&itemtype=PluginMonitoringService&start=0&glpi_tab=3'";
      $warningconnection_link = $CFG_GLPI['root_doc'].
               "/plugins/monitoring/front/service.php?hidesearch=1&reset=reset".
                  "&field[0]=3&searchtype[0]=contains&contains[0]=UNKNOWN&link[1]=AND".
                  "&field[1]=23&searchtype[1]=equals&contains[1]=0&link[2]=OR".
                  "&field[2]=3&searchtype[2]=contains&contains[2]=NULL&link[3]=AND".
                  "&field[3]=23&searchtype[3]=equals&contains[3]=0&&link[4]=AND".
                  "&field[4]=9&searchtype[4]=contains&contains[4]=^$".
                  "&itemtype=PluginMonitoringService&start=0&glpi_tab=3'";

file inc/display.class.php

delete in line 675

if ($shortstate == 'red') {

delete in line 690
     
} else {
  echo $data['state'];
}

#4 Updated by Jm0u almost 7 years ago

  • Assignee set to ddurieux
  • Target version set to Plugin_monitoring 0.84+1.1
  • % Done changed from 0 to 80

possible de mettre ceci dans la prochaine release

#5 Updated by ddurieux almost 7 years ago

  • Status changed from New to Closed
  • % Done changed from 80 to 100

Also available in: Atom PDF