0

I am new on Icinga2, using 2.4.0 version and I am trying to execute some API calls but I have found a problem when I have tried to create a service manually.

This is the command that I execute to create a service called api_dummy_service_1 for api_dummy_host_1 host:

curl -u $ICINGA2_API_USER:$ICINGA2_API_PASSWORD  \
     -H 'Accept: application/json' -X PUT \
     -k "https://$ICINGA2_HOST:$ICINGA2_API_PORT/v1/objects/services/api_dummy_host_1!api_dummy_service_1" \
     -d '{ "templates": [ "generic-service" ], "attrs": { "display_name": "api_dummy_service_1", "check_command" : "dns", "vars.dns_lookup": "google-public-dns-a.google.com.", "vars.dns_expected_answer": "8.8.8.8", "host_name": "api_dummy_host_1" } }' | python -m json.tool

When I execute it, the following error message appears:

-bash: !api_dummy_service_1: event not found

I have examinated Icinga logs, I have activated debug mode on Icinga also and tried to search information related to this in internet with no results.

Can anyone help me please? Thanks in advance!

1 Answers1

0

Issue fixed! After doing more test in detail we have detected that the problem was related to the URL that we use to connect with icinga2 API, the ! character must be escaped.

I have changed ! to %21 and the command works