service/host escalations
service/host escalations
is there a way to service/host escalations and their members via the rest api or a cgi? i am trying to automate creating them and i need a way to find out what hosts/services do not exist in an escalation policy to ensure they are added.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: service/host escalations
Perhaps the JSON Query is what you are after, with the Object CGI:
https://labs.nagios.com/2014/06/19/expl ... -7-part-1/
https://labs.nagios.com/2014/06/19/expl ... -7-part-1/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: service/host escalations
thanks for the info, this appears to show almost what i need. i currently assign services to host groups and would like to see what services are assigned to a host group and then make sure that host group is in a service escalation policy.
is there a way to query which host groups are in a service escalation policy?
is there a way to query which services are assigned to a hostgroup?
is there a way to query which host groups are in a service escalation policy?
is there a way to query which services are assigned to a hostgroup?
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: service/host escalations
CGI: Object JSON CGIdoneil326 wrote:is there a way to query which host groups are in a service escalation policy?
Query: serviceescalationlist
Host Group: <the hostgroup you want to query>
https://xitest.box293.local/nagios/cgi- ... _localhost
Code: Select all
{
"format_version": 0,
"result": {
"query_time": 1463631719000,
"cgi": "objectjson.cgi",
"user": "nagiosadmin",
"query": "serviceescalationlist",
"query_status": "released",
"program_start": 1463631237000,
"last_data_update": 1463631237000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"hostgroup": "hostgroup_localhost"
},
"serviceescalationlist": [
{
"host_name": "localhost",
"description": "Current Load assigned to hostgroup_localhost",
"first_notification": 1,
"last_notification": 0,
"notification_interval": 50.00,
"escalation_period": "24x7",
"escalation_options": 15,
"contact_groups": [
"admins"
],
"contacts": [
]
}
]
}
}Not that I can see.doneil326 wrote:is there a way to query which services are assigned to a hostgroup?
The reason behind this goes back to what Nagios does when it starts up.
It reads all the config files and creates all the "final objects". Things like services that are created using hostgroups, that information is lost as it's no longer required, it's purpose was to allow simple/complex configurations. The "final objects" reside in /usr/local/nagios/var/objects.cache.
Here's an example:
This is in the config file:
Code: Select all
define service {
service_description Current Load assigned to hostgroup_localhost
use local-service
hostgroup_name hostgroup_localhost
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0!!!!!!
register 1
}This is in objects.cache:
Code: Select all
define service {
host_name localhost
service_description Current Load assigned to hostgroup_localhost
check_period 24x7
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0!!!!!!
contact_groups admins
notification_period 24x7
initial_state o
importance 0
check_interval 5.000000
retry_interval 1.000000
max_check_attempts 4
is_volatile 0
parallelize_check 1
active_checks_enabled 1
passive_checks_enabled 1
obsess 1
event_handler_enabled 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
flap_detection_enabled 1
flap_detection_options a
freshness_threshold 0
check_freshness 0
notification_options r,w,u,c
notifications_enabled 1
notification_interval 60.000000
first_notification_delay 0.000000
stalking_options n
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
}As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.