Hi,
You can update the check command using the API. However, the string will be for the entire command, check command plus arguments. Each separate argument needs to be separated by an
!.
So a command like this:
/usr/local/nagios/libexec/check_ncpa.py -H 192.168.23.142 -t 'welcome' -P 5693 -M 'disk/logical/|' -w '70' -c '90'
Would look like this using an API call. The exclamation point needs to be escaped and %20 is used for spaces.
Code: Select all
curl -XPUT "https://192.168.23.113/nagiosxi/api/v1/config/service/192.168.23.142/Disk?apikey=sCWXTQ3rHtm483AgRUUtLi04v5ECCVmktCCGoU8mINpPPflWafJbRKeGO8fGjUh6&pretty=1&check_command=check_xi_ncpa\!-t%20'welcome'%20-P%205693%20-M%20'disk/logical/|'%20-w%20'70'%20-c%20'90'&applyconfig=1"
If you do not need to do this programmatically, the
Bulk Mods Tool is very good at updating individual arguments.
Let us know if you have more questions.
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy.
Be sure to check out our
Knowledgebase for helpful articles and solutions!