I have over 1,000 service checks to add to Nagios so I'm using the REST API to do it. I can successfully query the API for objects and even my curl command below generates a successful new service in CCM. However, each time I do this the check_command never seems to work. In the CCM, the check command box and the args boxes are blank. When I go to apply the config, it fails since the check_command is missing.
Are there any logs that would be helpful to provide or tail?
curl -XPOST "http://xxxx/nagiosxi/api/v1/config/serv ... x&pretty=1" -d "host_name=xxxx&service_description=Disk&check_command=check_nrpe_disk_space\!15%\!10%\!/apps&check_interval=15&retry_interval=4&max_check_attempts=3&check_period=xi_timeperiod_24x7&contacts=nagiosadmin¬ification_interval=5¬ification_period=xi_timeperiod_24x7&applyconfig=1"
{
"success": "Successfully added xxxx :: Disk to the system. Config applied, Nagios Core was restarted."
}
API Config Service Ingnores check_command
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Config Service Ingnores check_command
Are you sure you have a command defined with the name check_nrpe_disk_space?
I used your example and had the my check command was blank but args filled in, when I changed it to a command I had defined all items were filled in, I am running 5.5.2
I used your example and had the my check command was blank but args filled in, when I changed it to a command I had defined all items were filled in, I am running 5.5.2
Re: API Config Service Ingnores check_command
Yes, it's in the config files as below and used in many other checks.
I'm still on 5.2.8, is there a bug that was reported for this and fixed since then?
Code: Select all
define command {
command_name check_nrpe_disk_space
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 90 -c check_nrpe_filesystem -a $ARG1$ $ARG2$ $ARG3$
}
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Config Service Ingnores check_command
This was addressed in 5.2.9
https://www.nagios.com/downloads/nagios-xi/change-log/Fixed issue in config/service API section not using the check_command argument [TPS#8629] -JO
Re: API Config Service Ingnores check_command
Thanks!
I'm not sure an upgrade is an option at this point. Are there any other methods that we could use to add a large number of services to existing hosts that already have other services configured?
I'm not sure an upgrade is an option at this point. Are there any other methods that we could use to add a large number of services to existing hosts that already have other services configured?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: API Config Service Ingnores check_command
If the services are generally the same, I would highly recommend the Bulk Host Cloning Wizard
https://assets.nagios.com/downloads/nag ... Wizard.pdf
https://assets.nagios.com/downloads/nag ... Wizard.pdf