commit 562d5c1eb8a76a65d49d14b36edefb846f747494
parent 1646fdebffc4c9069b824f65f8639120c224f312
Author: Oliver Lowe <o@olowe.co>
Date: Wed, 19 Jan 2022 16:34:03 +1100
Store acknowledgement status of hosts, services
Diffstat:
| M | host.go | | | 35 | +++++++++++++++++++++++++++-------- |
| M | host_test.go | | | 35 | +++++++++++++++++++++++++++++++++++ |
| M | service.go | | | 19 | +++++++++++++++++++ |
| A | testdata/hosts.json | | | 1152 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 files changed, 1233 insertions(+), 8 deletions(-)
diff --git a/host.go b/host.go
@@ -5,14 +5,15 @@ import "encoding/json"
// Host represents a Host object. To create a Host, the Name and CheckCommand
// fields must be set.
type Host struct {
- Name string `json:"name"`
- Address string `json:"address"`
- Address6 string `json:"address6"`
- Groups []string `json:"groups"`
- State HostState `json:"state"`
- StateType StateType `json:"state_type"`
- CheckCommand string `json:"check_command"`
- DisplayName string `json:"display_name"`
+ Name string `json:"name"`
+ Address string `json:"address"`
+ Address6 string `json:"address6"`
+ Groups []string `json:"groups"`
+ State HostState `json:"state"`
+ StateType StateType `json:"state_type"`
+ CheckCommand string `json:"check_command"`
+ DisplayName string `json:"display_name"`
+ Acknowledgement bool
}
type HostGroup struct {
@@ -70,6 +71,24 @@ func (h Host) MarshalJSON() ([]byte, error) {
return json.Marshal(m)
}
+// UnmarhsalJSON unmarshals host attributes into more meaningful Host field types.
+func (h *Host) UnmarshalJSON(data []byte) error {
+ type alias Host
+ aux := &struct {
+ Acknowledgement int
+ *alias
+ }{
+ alias: (*alias)(h),
+ }
+ if err := json.Unmarshal(data, &aux); err != nil {
+ return err
+ }
+ if aux.Acknowledgement != 0 {
+ h.Acknowledgement = true
+ }
+ return nil
+}
+
func (hg HostGroup) MarshalJSON() ([]byte, error) {
type attrs struct {
DisplayName string `json:"display_name"`
diff --git a/host_test.go b/host_test.go
@@ -2,6 +2,7 @@ package icinga
import (
"encoding/json"
+ "os"
"reflect"
"testing"
)
@@ -36,3 +37,37 @@ func TestHostMarshal(t *testing.T) {
}
t.Log("want", want, "got", got)
}
+
+func TestHostUnmarshal(t *testing.T) {
+ want := Host{
+ Name: "example.com",
+ Address: "",
+ Groups: []string{"example"},
+ State: HostDown,
+ StateType: StateSoft,
+ CheckCommand: "hostalive",
+ DisplayName: "example.com",
+ Acknowledgement: false,
+ }
+ f, err := os.Open("testdata/hosts.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ resp, err := parseResponse(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var got Host
+ for _, r := range resp.Results {
+ h := r.(Host)
+ if h.Name == "example.com" {
+ got = h
+ break
+ }
+ }
+ if !reflect.DeepEqual(want, got) {
+ t.Fail()
+ }
+ t.Logf("want %+v, got %+v", want, got)
+}
diff --git a/service.go b/service.go
@@ -19,6 +19,7 @@ type Service struct {
CheckCommand string `json:"check_command"`
DisplayName string `json:"display_name"`
LastCheckResult CheckResult `json:"last_check_result"`
+ Acknowledgement bool
}
type CheckResult struct {
@@ -60,3 +61,21 @@ func (s Service) MarshalJSON() ([]byte, error) {
}{Attrs: attrs}
return json.Marshal(jservice)
}
+
+// UnmarshalJSON unmarshals service attributes into more meaningful Service field types.
+func (s *Service) UnmarshalJSON(data []byte) error {
+ type alias Service
+ aux := &struct {
+ Acknowledgement int
+ *alias
+ }{
+ alias: (*alias)(s),
+ }
+ if err := json.Unmarshal(data, &aux); err != nil {
+ return err
+ }
+ if aux.Acknowledgement != 0 {
+ s.Acknowledgement = true
+ }
+ return nil
+}
diff --git a/testdata/hosts.json b/testdata/hosts.json
@@ -0,0 +1,1152 @@
+{
+ "results": [
+ {
+ "attrs": {
+ "__name": "VuS9jZ8u.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "VuS9jZ8u.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "VuS9jZ8u.example.org",
+ "next_check": 1641614556.854738,
+ "next_update": 1641614856.854738,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/VuS9jZ8u.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "VuS9jZ8u.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.032706,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "VuS9jZ8u.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "BpLnfgDs.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "BpLnfgDs.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "BpLnfgDs.example.org",
+ "next_check": 1641614577.5548902,
+ "next_update": 1641614877.5548902,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/BpLnfgDs.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "BpLnfgDs.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608344.943679,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "BpLnfgDs.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "NfHK5a84.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "NfHK5a84.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "NfHK5a84.example.org",
+ "next_check": 1641614602.0174599,
+ "next_update": 1641614902.0174599,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/NfHK5a84.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "NfHK5a84.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608344.979022,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "NfHK5a84.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "alpine.olowe.co",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "127.0.0.1",
+ "address6": "::1",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 60,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "alpine.olowe.co",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 0,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 0,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "alpine.olowe.co",
+ "next_check": 1641614604.5996702,
+ "next_update": 1641614664.5996702,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_etc",
+ "paused": false,
+ "previous_state_change": 0,
+ "problem": false,
+ "retry_interval": 30,
+ "severity": 16,
+ "source_location": {
+ "first_column": 1,
+ "first_line": 11,
+ "last_column": 20,
+ "last_line": 11,
+ "path": "/etc/icinga2/conf.d/ye.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "alpine.olowe.co",
+ "generic-host"
+ ],
+ "type": "Host",
+ "vars": {
+ "disks": {
+ "disk": {},
+ "disk /": {
+ "disk_partitions": "/"
+ }
+ },
+ "http_vhosts": {
+ "http": {
+ "http_uri": "/"
+ }
+ },
+ "os": "Linux"
+ },
+ "version": 0,
+ "volatile": false,
+ "zone": ""
+ },
+ "joins": {},
+ "meta": {},
+ "name": "alpine.olowe.co",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "h9h2fhfU.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "h9h2fhfU.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "h9h2fhfU.example.org",
+ "next_check": 1641614603.4985132,
+ "next_update": 1641614903.4985132,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/h9h2fhfU.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "h9h2fhfU.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.014598,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "h9h2fhfU.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "VbhV3vC5.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "VbhV3vC5.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "VbhV3vC5.example.org",
+ "next_check": 1641614568.2078724,
+ "next_update": 1641614868.2078724,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/VbhV3vC5.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "VbhV3vC5.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.051545,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "VbhV3vC5.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "c2WD8F2q.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "c2WD8F2q.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "c2WD8F2q.example.org",
+ "next_check": 1641614564.5870316,
+ "next_update": 1641614864.5870316,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/c2WD8F2q.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "c2WD8F2q.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608344.961148,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "c2WD8F2q.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "iWvqZTa2.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "iWvqZTa2.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "iWvqZTa2.example.org",
+ "next_check": 1641614593.0765781,
+ "next_update": 1641614893.0765781,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/iWvqZTa2.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "iWvqZTa2.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.106559,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "iWvqZTa2.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "WSP2NcHc.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "WSP2NcHc.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "WSP2NcHc.example.org",
+ "next_check": 1641614575.643016,
+ "next_update": 1641614875.643016,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/WSP2NcHc.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "WSP2NcHc.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.087904,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "WSP2NcHc.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "9p.io",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "9p.io",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 60,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "9p.io",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 0,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 0,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "9p.io",
+ "next_check": 1641614597.059014,
+ "next_update": 1641614657.059014,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_etc",
+ "paused": false,
+ "previous_state_change": 0,
+ "problem": false,
+ "retry_interval": 30,
+ "severity": 16,
+ "source_location": {
+ "first_column": 1,
+ "first_line": 34,
+ "last_column": 19,
+ "last_line": 34,
+ "path": "/etc/icinga2/conf.d/ye.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "9p.io",
+ "generic-host"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 0,
+ "volatile": false,
+ "zone": ""
+ },
+ "joins": {},
+ "meta": {},
+ "name": "9p.io",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "example.com",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "example.com",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [
+ "example"
+ ],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "example.com",
+ "next_check": 1641614582.1707706,
+ "next_update": 1641614882.1707706,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 24,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/example.com.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "example.com"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.23193,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "example.com",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "AWX39IVU.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "AWX39IVU.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "AWX39IVU.example.org",
+ "next_check": 1641614588.918596,
+ "next_update": 1641614888.918596,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/AWX39IVU.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "AWX39IVU.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608345.069673,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "AWX39IVU.example.org",
+ "type": "Host"
+ },
+ {
+ "attrs": {
+ "__name": "jjJkwzDk.example.org",
+ "acknowledgement": 0,
+ "acknowledgement_expiry": 0,
+ "acknowledgement_last_change": 0,
+ "action_url": "",
+ "active": true,
+ "address": "",
+ "address6": "",
+ "check_attempt": 1,
+ "check_command": "hostalive",
+ "check_interval": 300,
+ "check_period": "",
+ "check_timeout": null,
+ "command_endpoint": "",
+ "display_name": "jjJkwzDk.example.org",
+ "downtime_depth": 0,
+ "enable_active_checks": true,
+ "enable_event_handler": true,
+ "enable_flapping": false,
+ "enable_notifications": true,
+ "enable_passive_checks": true,
+ "enable_perfdata": true,
+ "event_command": "",
+ "executions": null,
+ "flapping": false,
+ "flapping_current": 0,
+ "flapping_ignore_states": null,
+ "flapping_last_change": 0,
+ "flapping_threshold": 0,
+ "flapping_threshold_high": 30,
+ "flapping_threshold_low": 25,
+ "force_next_check": false,
+ "force_next_notification": false,
+ "groups": [],
+ "ha_mode": 0,
+ "handled": false,
+ "icon_image": "",
+ "icon_image_alt": "",
+ "last_check": -1,
+ "last_check_result": null,
+ "last_hard_state": 1,
+ "last_hard_state_change": 1641607863.315727,
+ "last_reachable": true,
+ "last_state": 1,
+ "last_state_change": 1641607863.315727,
+ "last_state_down": 0,
+ "last_state_type": 0,
+ "last_state_unreachable": 0,
+ "last_state_up": 0,
+ "max_check_attempts": 3,
+ "name": "jjJkwzDk.example.org",
+ "next_check": 1641614599.1525059,
+ "next_update": 1641614899.1525059,
+ "notes": "",
+ "notes_url": "",
+ "original_attributes": null,
+ "package": "_api",
+ "paused": false,
+ "previous_state_change": 1641607863.315727,
+ "problem": false,
+ "retry_interval": 60,
+ "severity": 16,
+ "source_location": {
+ "first_column": 0,
+ "first_line": 1,
+ "last_column": 33,
+ "last_line": 1,
+ "path": "/var/lib/icinga2/api/packages/_api/19602f4d-849c-4589-a9fe-cc1c71790f3c/conf.d/hosts/jjJkwzDk.example.org.conf"
+ },
+ "state": 1,
+ "state_type": 0,
+ "templates": [
+ "jjJkwzDk.example.org"
+ ],
+ "type": "Host",
+ "vars": null,
+ "version": 1641608344.996657,
+ "volatile": false,
+ "zone": "alpine.olowe.co"
+ },
+ "joins": {},
+ "meta": {},
+ "name": "jjJkwzDk.example.org",
+ "type": "Host"
+ }
+ ]
+}