|
|
Línea 1: |
Línea 1: |
| <source lang=php> | | <source lang=php> |
− |
| + | public static function get_value( $index_service, $service_value ) { |
− | /** SSH - PLUGIN_OUTPUT Y PERFORMANCE DATA */ | + | switch ( $index_service ) { |
− | | + | case "plugin_output": |
− | /**
| + | $value = self::get_value_of_plugin_output( $service_value ); |
− | * * @return array el listado de índice
| + | break; |
− | * A continuación El listado del array que retorna el nagios
| + | case "performance_data": |
− | * Se trata de seleccionar qué indices nos interesan
| + | $value = self::get_value_of_performance_data( $service_value ); |
− | ["SSH"] => object(stdClass)#98 (54) {
| + | break; |
− | ["host_name"] => string(12) "5c43117b78e8"
| + | } |
− | ["service_description"] => string(3) "SSH"
| + | return $value; |
− | ["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; | + | |
| } | | } |
| </source> | | </source> |
public static function get_value( $index_service, $service_value ) {
switch ( $index_service ) {
case "plugin_output":
$value = self::get_value_of_plugin_output( $service_value );
break;
case "performance_data":
$value = self::get_value_of_performance_data( $service_value );
break;
}
return $value;
}