Diferencia entre revisiones de «Usuario:ManuelRomero/proyecto/proyectoIternova/borrador»

De WikiEducator
Saltar a: navegación, buscar
(Página creada con «<source lang=php> /** * * @param int $service un identificador de servicio (0, 1, 2, .. representado a SSH, HTTP, ...) * @return array Una lista de los índ...»)
 
Línea 1: Línea 1:
 
<source lang=php>
 
<source lang=php>
  /**
+
   
    *
+
    /** SSH - PLUGIN_OUTPUT Y PERFORMANCE DATA */
     * @param int $service un identificador de servicio (0, 1, 2, .. representado a SSH, HTTP, ...)
+
 
     * @return array Una lista de los índices que corresponden a los valores de lo que quiero leer del nagios
+
    /**
     * Consiste en crear una lista de índices (performance_data, ....)
+
     * * @return array el listado de índice
     * Esos índices serán los datos de lo que quiero obtener de todo lo que nagios me da
+
     * A continuación El listado del array que retorna el nagios
 +
     * Se trata de seleccionar qué indices nos interesan
 +
      ["SSH"] =>    object(stdClass)#98 (54) {
 +
      ["host_name"] =>      string(12) "5c43117b78e8"
 +
      ["service_description"] =>      string(3) "SSH"
 +
      ["modified_attributes"] =>      string(1) "0"
 +
      ["check_command"] =>      string(9) "check_ssh"
 +
      ["check_period"] =>      string(4) "24x7"
 +
      ["notification_period"] =>      string(4) "24x7"
 +
      ["check_interval"] =>      string(8) "5.000000"
 +
      ["retry_interval"] =>      string(8) "1.000000"
 +
      ["event_handler"] =>      string(0) ""
 +
      ["has_been_checked"] =>      string(1) "1"
 +
      ["should_be_scheduled"] =>      string(1) "1"
 +
      ["check_execution_time"] =>      string(5) "0.004"
 +
      ["check_latency"] =>      string(5) "0.100"
 +
      ["check_type"] =>      string(1) "0"
 +
      ["current_state"] =>     string(1) "2"
 +
      ["last_hard_state"] =>      string(1) "2"
 +
      ["last_event_id"] =>      string(2) "14"
 +
      ["current_event_id"] =>      string(2) "40"
 +
      ["current_problem_id"] =>      string(2) "20"
 +
      ["last_problem_id"] =>      string(1) "3"
 +
      ["current_attempt"] =>      string(1) "4"
 +
      ["max_attempts"] =>      string(1) "4"
 +
      ["state_type"] =>      string(1) "1"
 +
      ["last_state_change"] =>      string(10) "1479666559"
 +
      ["last_hard_state_change"] =>      string(10) "1479666739"
 +
      ["last_time_ok"] =>      string(10) "1479592202"
 +
      ["last_time_warning"] =>      string(1) "0"
 +
      ["last_time_unknown"] =>      string(1) "0"
 +
      ["last_time_critical"] =>      string(10) "1480498807"
 +
      ["plugin_output"] =>      string(18) "Connection refused"
 +
      ["long_plugin_output"] =>      string(0) ""
 +
      ["performance_data"] =>      string(0) ""
 +
      ["last_check"] =>      string(10) "1480498807"
 +
      ["next_check"] =>      string(10) "1480499107"
 +
      ["check_options"] =>      scurrent_problem_idtring(1) "0"
 +
      ["current_notification_number"] =>      string(1) "0"
 +
      ["current_notification_id"] =>      string(1) "0"
 +
      ["last_notification"] =>      string(1) "0"
 +
      ["next_notification"] =>      string(1) "0"
 +
      ["no_more_notifications"] =>      string(1) "0"
 +
      ["notifications_enabled"] =>      string(1) "0"
 +
      ["active_checks_enabled"] =>      string(1) "1"
 +
      ["passive_checks_enabled"] =>      string(1) "1"
 +
      ["event_handler_enabled"] =>      string(1) "1"
 +
      ["problem_has_been_acknowledged"] =>      string(1) "0"
 +
      ["acknowledgement_type"] =>      string(1) "0"
 +
      ["flap_detection_enabled"] =>      string(1) "1"
 +
      ["failure_prediction_enabled"] =>      string(1) "1"
 +
      ["process_performance_data"] =>      string(1) "1"
 +
      ["obsess_over_service"] =>      string(1) "1"
 +
      ["last_update"] =>      string(10) "1480498887"
 +
      ["is_flapping"] =>      string(1) "0"
 +
      ["percent_state_change"] =>      string(4) "0.00"
 +
      ["scheduled_downtime_depth"] =>      string(1) "0"
 +
      }
 +
      }
 
     */
 
     */
     public static function get_index_of_service( $service ) {
+
     public static function getIndexSsh() {
         $index = [];
+
         $index = [
        switch ( $service ) {
+
             "plugin_output",
             case Monitorizacion_Constants::SERVICIO_SSH || "SSH":
+
             "performance_data"
                $index = self::getIndexSsh();
+
        ];
                break;
+
             case Monitorizacion_Constants::SERVICIO_HTTP || "HTTP" :
+
                $index = self::getIndexHttp();
+
                break;
+
            case Monitorizacion_Constants::SERVICIO_MYSQL || "MYSQL":
+
                $index = self::getIndexMysql();
+
                break;
+
            case Monitorizacion_Constants::SERVICIO_DISCOS || "DISK":
+
                $index = self::getIndexDisk();
+
                break;
+
            case Monitorizacion_Constants::SERVICIO_CPU || "CPU":
+
                $index = self::getIndexCpu();
+
                break;
+
            case Monitorizacion_Constants::SERVICIO_PING || "PING":
+
                $index = self::getIndexPing();
+
                break;
+
            case Monitorizacion_Constants::SERVICIO_PROCESOS || "PROCESS":
+
                $index = self::getIndexProcesos();
+
                break;
+
            default:
+
                return null;
+
        }
+
  
 
         return $index;
 
         return $index;
 
 
     }
 
     }
 
</source>
 
</source>

Revisión de 03:52 8 sep 2017

 
    /** SSH - PLUGIN_OUTPUT Y PERFORMANCE DATA */
 
    /**
     * * @return array el listado de índice
     * A continuación El listado del array que retorna el nagios
     * Se trata de seleccionar qué indices nos interesan
      ["SSH"] =>    object(stdClass)#98 (54) {
      ["host_name"] =>      string(12) "5c43117b78e8"
      ["service_description"] =>      string(3) "SSH"
      ["modified_attributes"] =>      string(1) "0"
      ["check_command"] =>      string(9) "check_ssh"
      ["check_period"] =>      string(4) "24x7"
      ["notification_period"] =>      string(4) "24x7"
      ["check_interval"] =>      string(8) "5.000000"
      ["retry_interval"] =>      string(8) "1.000000"
      ["event_handler"] =>      string(0) ""
      ["has_been_checked"] =>      string(1) "1"
      ["should_be_scheduled"] =>      string(1) "1"
      ["check_execution_time"] =>      string(5) "0.004"
      ["check_latency"] =>      string(5) "0.100"
      ["check_type"] =>      string(1) "0"
      ["current_state"] =>      string(1) "2"
      ["last_hard_state"] =>      string(1) "2"
      ["last_event_id"] =>      string(2) "14"
      ["current_event_id"] =>      string(2) "40"
      ["current_problem_id"] =>      string(2) "20"
      ["last_problem_id"] =>      string(1) "3"
      ["current_attempt"] =>      string(1) "4"
      ["max_attempts"] =>      string(1) "4"
      ["state_type"] =>      string(1) "1"
      ["last_state_change"] =>      string(10) "1479666559"
      ["last_hard_state_change"] =>      string(10) "1479666739"
      ["last_time_ok"] =>      string(10) "1479592202"
      ["last_time_warning"] =>      string(1) "0"
      ["last_time_unknown"] =>      string(1) "0"
      ["last_time_critical"] =>      string(10) "1480498807"
      ["plugin_output"] =>      string(18) "Connection refused"
      ["long_plugin_output"] =>      string(0) ""
      ["performance_data"] =>      string(0) ""
      ["last_check"] =>      string(10) "1480498807"
      ["next_check"] =>      string(10) "1480499107"
      ["check_options"] =>      scurrent_problem_idtring(1) "0"
      ["current_notification_number"] =>      string(1) "0"
      ["current_notification_id"] =>      string(1) "0"
      ["last_notification"] =>      string(1) "0"
      ["next_notification"] =>      string(1) "0"
      ["no_more_notifications"] =>      string(1) "0"
      ["notifications_enabled"] =>      string(1) "0"
      ["active_checks_enabled"] =>      string(1) "1"
      ["passive_checks_enabled"] =>      string(1) "1"
      ["event_handler_enabled"] =>      string(1) "1"
      ["problem_has_been_acknowledged"] =>      string(1) "0"
      ["acknowledgement_type"] =>      string(1) "0"
      ["flap_detection_enabled"] =>      string(1) "1"
      ["failure_prediction_enabled"] =>      string(1) "1"
      ["process_performance_data"] =>      string(1) "1"
      ["obsess_over_service"] =>      string(1) "1"
      ["last_update"] =>      string(10) "1480498887"
      ["is_flapping"] =>      string(1) "0"
      ["percent_state_change"] =>      string(4) "0.00"
      ["scheduled_downtime_depth"] =>      string(1) "0"
      }
      }
     */
    public static function getIndexSsh() {
        $index = [
            "plugin_output",
            "performance_data"
        ];
 
        return $index;
    }