Dear all,
i have a question about the inheritance option ("+","standard","null") which can be set in the Servicegroups, Contacts and Contactgroups tab when defining a new service.
I 'd like to know if is there a way to modify the default selection (set to "standard") to the "+" value.
In our environment we have designed our monitoring implementation in order to always inherit settings from the previous level, so all our services have the inherit option set to "+". However every time we create a new service we have to manually change this value, and this can be a source of problem.
Moreover, using the Nagios XI API, is here a way to set this value to "+"? (I use the config/import endpoint to create services).
Regards
Francesco
inheritance option, default values and API
Re: inheritance option, default values and API
How are you adding the new services - via a wizard, manually (in the CCM), cloning an existing service, running the Bulk Import wizard, using the REST API, etc.? We need more information in order to point you to the right direction.i have a question about the inheritance option ("+","standard","null") which can be set in the Servicegroups, Contacts and Contactgroups tab when defining a new service.
I 'd like to know if is there a way to modify the default selection (set to "standard") to the "+" value.
When you import a config via the REST API, the additive inheritance options will be imported as well. See the example below:Moreover, using the Nagios XI API, is here a way to set this value to "+"? (I use the config/import endpoint to create services).
Code: Select all
[root@main-nagios-xi nagiosxi]# curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/config/import?apikey=OYdoHa7JGoreQbKFjEGg0OWO8vurBkMFiYjf9pe57JieTjSsduLeCXi0s6L3puXL&pretty=1" -d '
> define host {
> host_name newhost.example
> address 127.0.0.1
> use xiwizard_generic_host
> contacts +nagiosadmin
> contact_groups +admins
> max_check_attempts 5
> check_interval 5
> check_period xi_timeperiod_24x7
> notification_period xi_timeperiod_24x7
> register 1
> }'
{
"success": "Imported configuration data. Config imported but not yet applied."
}
[root@main-nagios-xi nagiosxi]# curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/system/applyconfig?apikey=OYdoHa7JGoreQbKFjEGg0OWO8vurBkMFiYjf9pe57JieTjSsduLeCXi0s6L3puXL"
{"success":"Apply config command has been sent to the backend.","command_id":1444}
[root@main-nagios-xi nagiosxi]# cat /usr/local/nagios/etc/hosts/newhost.example.cfg
###############################################################################
#
# Hosts configuration file
#
# Created by: Nagios CCM 3.0.2
# Date: 2019-06-07 09:55:04
# Version: Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define host {
host_name newhost.example
use xiwizard_generic_host
address 127.0.0.1
max_check_attempts 5
check_interval 5
check_period xi_timeperiod_24x7
contacts +nagiosadmin
contact_groups +admins
notification_period xi_timeperiod_24x7
register 1
}
###############################################################################
#
# Hosts configuration file
#
# END OF FILE
#
###############################################################################Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: inheritance option, default values and API
Hello,
i create services manually and using the rest API.
In particular, if i use the API i know that i can modify the inheritance behavior in this way:
servicegroups +localserver
The problem is that, as a best practice, we insert the Service Group inside a Service Template, as usually a Service Template is applyed to a block of omogeneous services. In this way, also if i define a Service Template with the inherance set to '0+', the service created via API will have the inheritance set to 'standard'.
i create services manually and using the rest API.
In particular, if i use the API i know that i can modify the inheritance behavior in this way:
servicegroups +localserver
The problem is that, as a best practice, we insert the Service Group inside a Service Template, as usually a Service Template is applyed to a block of omogeneous services. In this way, also if i define a Service Template with the inherance set to '0+', the service created via API will have the inheritance set to 'standard'.
Re: inheritance option, default values and API
You can use a service template to apply an additive inheritance via the REST API. I am not sure what you mean by:
I can see the "MyTestService" added to the "PING" servicegroup in the GUI.
Hope this helps.
but here's an example (with a template):if i define a Service Template with the inherance set to '0+'
Code: Select all
define service {
name my_template
service_description My Template
servicegroups +PING
check_command check_xi_service_none!!!!!!!!
is_volatile 0
max_check_attempts 5
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
check_period xi_timeperiod_24x7
parallelize_check 1
obsess_over_service 1
check_freshness 0
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 1
register 0
}Code: Select all
[root@main-nagios-xi nagiosxi]# curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/config/import?apikey=OYdoHa7JGoreQbKFjEGg0OWO8vurBkMFiYjf9pe57JieTjSsduLeCXi0s6L3puXL&pretty=1" -d '
> define service {
> host_name localhost
> service_description MyTestService
> use my_template
> check_command check_ping!100.0,20%!500.0,60%
> notification_period 24x7
> notification_options w,c,u,r,f,s,
> notifications_enabled 1
> contacts +nagiosadmin
> contact_groups +admins
> register 1
> }'
{
"success": "Imported configuration data. Config imported but not yet applied."
}Code: Select all
[root@main-nagios-xi nagiosxi]# curl -XPOST "http://x.x.x.x/nagiosxi/api/v1/system/applyconfig?apikey=OYdoHa7JGoreQbKFjEGg0OWO8vurBkMFiYjf9pe57JieTjSsduLeCXi0s6L3puXL"
{"success":"Apply config command has been sent to the backend.","command_id":1499}Hope this helps.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!