cat /etc/icinga2/conf.d/icinga/zone.conf
apply Service "icinga_zone" {
display_name = "Icinga Zone"
check_command = "cluster-zone"
if (host.vars.cluster_zone) {
vars.cluster_zone = host.vars.cluster_zone
}
assign where get_object("Endpoint", host.name)
ignore where host.name == NodeName
}
icinga2 object list -n icinga_zone
Object 'mon1.site1.em.lan!icinga_zone' of type 'Service':
% declared in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
* __name = "mon1.site1.em.lan!icinga_zone"
* action_url = ""
* check_command = "cluster-zone"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 3:4-3:33
* check_interval = 300
* check_period = ""
* check_timeout = null
* command_endpoint = ""
* display_name = "Icinga Zone"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 2:4-2:31
* enable_active_checks = true
* enable_event_handler = true
* enable_flapping = false
* enable_notifications = true
* enable_passive_checks = true
* enable_perfdata = true
* event_command = ""
* flapping_threshold = 0
* flapping_threshold_high = 30
* flapping_threshold_low = 25
* groups = [ ]
* host_name = "mon1.site1.em.lan"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
* icon_image = ""
* icon_image_alt = ""
* max_check_attempts = 3
* name = "icinga_zone"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
* notes = ""
* notes_url = ""
* package = "_etc"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
* retry_interval = 60
* source_location
* first_column = 0
* first_line = 1
* last_column = 26
* last_line = 1
* path = "/etc/icinga2/conf.d/icinga2/zone.conf"
* templates = [ "icinga_zone" ]
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
* type = "Service"
* vars = null
* volatile = false
* zone = "site1.em.lan"
% = modified in '/etc/icinga2/conf.d/icinga2/zone.conf', lines 1:0-1:26
curl -k -s -u ‘user:password’ ‘https://localhost:5665/v1/objects/services?service=mon1.site1.em.lan!icinga_zone’ | python -m json.tool
{
"results": [
{
"attrs": {
"__name": "mon1.site1.em.lan!icinga_zone",
"acknowledgement": 0.0,
"acknowledgement_expiry": 0.0,
"action_url": "",
"active": true,
"check_attempt": 1.0,
"check_command": "cluster-zone",
"check_interval": 300.0,
"check_period": "",
"check_timeout": null,
"command_endpoint": "",
"display_name": "Icinga Zone",
"downtime_depth": 0.0,
"enable_active_checks": true,
"enable_event_handler": true,
"enable_flapping": false,
"enable_notifications": true,
"enable_passive_checks": true,
"enable_perfdata": true,
"event_command": "",
"flapping": false,
"flapping_current": 0.0,
"flapping_last_change": 0.0,
"flapping_threshold": 0.0,
"flapping_threshold_high": 30.0,
"flapping_threshold_low": 25.0,
"force_next_check": true,
"force_next_notification": false,
"groups": [],
"ha_mode": 0.0,
"handled": false,
"host_name": "mon1.site1.em.lan",
"icon_image": "",
"icon_image_alt": "",
"last_check": 1549022198.450375,
"last_check_result": {
"active": true,
"check_source": "main.em.lan",
"command": null,
"execution_end": 1549022198.450375,
"execution_start": 1549022198.450254,
"exit_status": 0.0,
"output": "Zone 'site1.em.lan' is connected. Log lag: less than 1 millisecond",
"performance_data": [
{
"counter": false,
"crit": 0.0,
"label": "slave_lag",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "s",
"value": 0.0,
"warn": 0.0
},
{
"counter": false,
"crit": null,
"label": "last_messages_sent",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 1549022194.870903,
"warn": null
},
{
"counter": false,
"crit": null,
"label": "last_messages_received",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 1549022194.169085,
"warn": null
},
{
"counter": false,
"crit": null,
"label": "sum_messages_sent_per_second",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 0.3,
"warn": null
},
{
"counter": false,
"crit": null,
"label": "sum_messages_received_per_second",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 1.2833333333333334,
"warn": null
},
{
"counter": false,
"crit": null,
"label": "sum_bytes_sent_per_second",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 27.566666666666666,
"warn": null
},
{
"counter": false,
"crit": null,
"label": "sum_bytes_received_per_second",
"max": null,
"min": null,
"type": "PerfdataValue",
"unit": "",
"value": 457.73333333333335,
"warn": null
}
],
"schedule_end": 1549022198.450375,
"schedule_start": 1549022198.45,
"state": 0.0,
"ttl": 0.0,
"type": "CheckResult",
"vars_after": {
"attempt": 1.0,
"reachable": true,
"state": 0.0,
"state_type": 1.0
},
"vars_before": {
"attempt": 1.0,
"reachable": true,
"state": 0.0,
"state_type": 1.0
}
},
"last_hard_state": 0.0,
"last_hard_state_change": 1548241662.976568,
"last_reachable": true,
"last_state": 0.0,
"last_state_change": 1548241662.976568,
"last_state_critical": 1548241606.296162,
"last_state_ok": 1549022198.4504,
"last_state_type": 1.0,
"last_state_unknown": 0.0,
"last_state_unreachable": 0.0,
"last_state_warning": 0.0,
"max_check_attempts": 3.0,
"name": "icinga_zone",
"next_check": 1571143097.6620665,
"notes": "",
"notes_url": "",
"original_attributes": null,
"package": "_etc",
"paused": false,
"previous_state_change": 1569922221.539295,
"problem": false,
"retry_interval": 60.0,
"severity": 8.0,
"source_location": {
"first_column": 0.0,
"first_line": 1.0,
"last_column": 26.0,
"last_line": 1.0,
"path": "/etc/icinga2/conf.d/icinga2/zone.conf"
},
"state": 0.0,
"state_type": 1.0,
"templates": [
"icinga_zone"
],
"type": "Service",
"vars": null,
"version": 0.0,
"volatile": false,
"zone": "site1.em.lan"
},
"joins": {},
"meta": {},
"name": "mon1.site1.em.lan!icinga_zone",
"type": "Service"
}
]
}