Hallo wir versuchen grad per API+ Powershell ein Service Discovery anzustoßen.
CheckMK 2.1.0.P38
Company daten mit xxx ersetzt:
> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
> Invoke-WebRequest -Uri https:/xxxx
> $HOST_NAME= "xxx”
> $SITE_NAME= “xxx”
> #$API_URL= “https://$HOST_NAME/$SITE_NAME/check_mk/api/1.0/domain-types/host_config/collections/all”
> #$API_URL2= "https://$HOST_NAME/$SITE_NAME/check_mk/api/1.0/domain-types/activation_run/actions/activate-changes/invoke"
>
> $API_URL3= "https://$HOST_NAME/$SITE_NAME/check_mk/api/1.0/domain-types/service_discovery_run/actions/start/invoke"
>
> $USERNAME= "xxx"
> $PASSWORD= "xxx"
>
> $Headers = @{
> ‘Accept’ = ‘application/json’
> ‘Authorization’ = "Bearer $USERNAME $PASSWORD"
>
>
> }
> $BODY3='{"host_name": "schrott44", "mode": "refresh"}'
>
> Invoke-RestMethod -Method Post -Uri $API_URL3 -Headers $Headers -Body $BODY3 -ContentType "application/json"
Result:
Invoke-RestMethod -Method Post -Uri $API_URL3 -Headers $Headers -Body …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"title": "Unexpected status code returned: 403", "status": 500, "detail": "Endpoint cmk.gui.plugins.openapi.endpoints.service_discovery.execute_service_discovery\nThis is a bug, please report.", "ext": {"codes": [302, 409, 200, 400, 415,
| 400]}}
Ist ein “Automation User” mit den rechten lt. Doku.
Hosts anlegen + löschen geht ohne Probleme.
Hat da jemand eine Idee dazu ?