API Service Discovery Invocation Error 302

**CMK version:2.2.0p7
**OS version:Ubuntu Jammy

**Error message:302: FOUND

**Output of “cmk --debug -vvn hostname”:cmk: command not found :stuck_out_tongue: (If it is a problem with checks or plugins - it is not)

I’m trying to run some API integrations via ansible.

I’m able to create a profile, and could swear I had service discovery working before, but now, potentially after upgrading from 2.2.0p6 to 7 (could be a coincidence), I always get “Status code was 302 and not [200]: HTTP Error 302: FOUND”.

What is that actually supposed to mean?

If I invoke the same URL with the same parameters (as “swagger UI” provides) on curl from bash, I get… no output at all, don’t even know if it’s also getting error 302.
The thing is, while I can’t get exit code 200, I can get different errors:

uri:
 url: http://127.0.0.1/sitename/check_mk/api/1.0/domain-types/service_discovery_run/actions/start/invoke
 [...] // the rest of stuff is identical to what I use for host creation successfully
 body:
  host_name: "{{ somevariable }}"
  mode: "refresh"
  bull: "shit"

This does cause it to complain about the unexpected variable, and gives “400 bad request” because of “bull: unknown field”. So I don’t understand why it gets an error when the variables are correct.

Google results for error 302 says “the resource has been temporarily moved to a different location” - but this cannot be…? It’s exactly the same path as this thing suggests:

Edit: One observation: This only happens with mode refresh. Mode new which is supposed to run after refresh has result 200 and works.

This seems to be the answer:


So it’s a fake error, just need to configure it as expected instead of 200.
Guess I previously tested it without actually using ansbile-

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.