API Config Service Ingnores check_command

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mikebreed
Posts: 3
Joined: Fri Aug 10, 2018 11:22 am

API Config Service Ingnores check_command

Post by mikebreed »

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&notification_interval=5&notification_period=xi_timeperiod_24x7&applyconfig=1"​

{
"success": "Successfully added xxxx :: Disk to the system. Config applied, Nagios Core was restarted."
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Config Service Ingnores check_command

Post by scottwilkerson »

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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
mikebreed
Posts: 3
Joined: Fri Aug 10, 2018 11:22 am

Re: API Config Service Ingnores check_command

Post by mikebreed »

Yes, it's in the config files as below and used in many other checks.

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$
}
I'm still on 5.2.8, is there a bug that was reported for this and fixed since then?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Config Service Ingnores check_command

Post by scottwilkerson »

This was addressed in 5.2.9
Fixed issue in config/service API section not using the check_command argument [TPS#8629] -JO
https://www.nagios.com/downloads/nagios-xi/change-log/
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
mikebreed
Posts: 3
Joined: Fri Aug 10, 2018 11:22 am

Re: API Config Service Ingnores check_command

Post by mikebreed »

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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: API Config Service Ingnores check_command

Post by scottwilkerson »

If the services are generally the same, I would highly recommend the Bulk Host Cloning Wizard

https://assets.nagios.com/downloads/nag ... Wizard.pdf
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked