Icinga2 API response object

Hi,
I am writing an application reading runtime data from Icinga2’s API. I have copied below the response object for a HOST, parsing the returned JSON into a PHP associative array.

Is there a definitive list of the definitions of what the keys actually are in the object?

Thanks Keith

Array
(
    [0] => Array
        (
            [attrs] => Array
                (
                    [__name] => BRX Sky Fibre WAN interface
                    [acknowledgement] => 0
                    [acknowledgement_expiry] => 0
                    [action_url] => 
                    [active] => 1
                    [address] => 10.100.100.1
                    [address6] => 
                    [check_attempt] => 1
                    [check_command] => hostalive
                    [check_interval] => 60
                    [check_period] => 
                    [check_timeout] => 
                    [command_endpoint] => 
                    [display_name] => BRX Sky Fibre WAN interface
                    [downtime_depth] => 0
                    [enable_active_checks] => 1
                    [enable_event_handler] => 1
                    [enable_flapping] => 
                    [enable_notifications] => 1
                    [enable_passive_checks] => 1
                    [enable_perfdata] => 1
                    [event_command] => 
                    [flapping] => 
                    [flapping_current] => 5.9
                    [flapping_last_change] => 0
                    [flapping_threshold] => 0
                    [flapping_threshold_high] => 30
                    [flapping_threshold_low] => 25
                    [force_next_check] => 
                    [force_next_notification] => 
                    [groups] => Array
                        (
                            [0] => routers
                        )

                    [ha_mode] => 0
                    [icon_image] => 
                    [icon_image_alt] => 
                    [last_check] => 1570178395.6984
                    [last_check_result] => Array
                        (
                            [active] => 1
                            [check_source] => ns01.knknb.lan
                            [command] => Array
                                (
                                    [0] => /usr/lib/nagios/plugins/check_ping
                                    [1] => -H
                                    [2] => 10.100.100.1
                                    [3] => -c
                                    [4] => 5000,100%
                                    [5] => -w
                                    [6] => 3000,80%
                                )

                            [execution_end] => 1570178395.6981
                            [execution_start] => 1570178395.5747
                            [exit_status] => 128
                            [output] => 
                            [performance_data] => Array
                                (
                                )

                            [schedule_end] => 1570178395.6984
                            [schedule_start] => 1570178395.5724
                            [state] => 3
                            [ttl] => 0
                            [type] => CheckResult
                            [vars_after] => Array
                                (
                                    [attempt] => 1
                                    [reachable] => 1
                                    [state] => 3
                                    [state_type] => 0
                                )

                            [vars_before] => Array
                                (
                                    [attempt] => 1
                                    [reachable] => 1
                                    [state] => 0
                                    [state_type] => 1
                                )

                        )

                    [last_hard_state] => 0
                    [last_hard_state_change] => 1570175352.742
                    [last_reachable] => 1
                    [last_state] => 0
                    [last_state_change] => 1570178395.6984
                    [last_state_down] => 0
                    [last_state_type] => 1
                    [last_state_unreachable] => 0
                    [last_state_up] => 1570178337.2224
                    [max_check_attempts] => 3
                    [name] => BRX Sky Fibre WAN interface
                    [next_check] => 1570178454.3791
                    [notes] => 
                    [notes_url] => 
                    [original_attributes] => 
                    [package] => _etc
                    [paused] => 
                    [retry_interval] => 30
                    [severity] => 136
                    [source_location] => Array
                        (
                            [first_column] => 1
                            [first_line] => 117
                            [last_column] => 41
                            [last_line] => 117
                            [path] => /etc/icinga2/conf.d/hosts.conf
                        )

                    [state] => 1
                    [state_type] => 0
                    [templates] => Array
                        (
                            [0] => BRX Sky Fibre WAN interface
                            [1] => generic-host
                        )

                    [type] => Host
                    [vars] => Array
                        (
                            [geolocation] => 55.93666, -3.47899
                            [map_icon] => move
                            [os] => FTTC Cable Modem Router
                        )

                    [version] => 0
                    [volatile] => 
                    [zone] => 
                )

            [joins] => Array
                (
                )

            [meta] => Array
                (
                )

            [name] => BRX Sky Fibre WAN interface
            [type] => Host
        )

Is that list what you’re looking for?

1 Like

Thanks - looks good! :slight_smile: