Comments (16)
@robin-tribe29 It is an issue of the API because I have tested it on shell. So I write you an email at feedback if you can't put a ticket yourself. This ticket can be closed.
from ansible-collection-checkmk.general.
Hi @elwood218,
I fixed the discovery module in the devel branch. The error message still looks a bit ugly, but at least it's no longer an "Exception", and it contains the actual error message from the API.
Can you please test it?
Best regards
Lars
from ansible-collection-checkmk.general.
@lgetwan This is the output now.
TASK [cmk_host_registration : service discovery] *********************************************************************
Friday 03 June 2022 11:09:39 +0200 (0:00:17.068) 0:01:15.787 ***********
Friday 03 June 2022 11:09:39 +0200 (0:00:17.068) 0:01:15.787 ***********
changed: [pgdb03 -> localhost]
changed: [pgdb02 -> localhost]
changed: [db01 -> localhost]
fatal: [pgdb01 -> localhost]: FAILED! => changed=false
http_code: -1
msg: 'Error calling API. HTTP Return Code is -1 Details: N/A'
fatal: [db02 -> localhost]: FAILED! => changed=false
http_code: -1
msg: 'Error calling API. HTTP Return Code is -1 Details: N/A'
fatal: [app01 -> localhost]: FAILED! => changed=false
http_code: -1
msg: 'Error calling API. HTTP Return Code is -1 Details: N/A'
from ansible-collection-checkmk.general.
Hi @elwood218,
I definitely didn't expect a "-1". :-o
But when checking the sources of fetch_url, I found some further information about that case. I improved the error message. Can you please check again?
Thanks so far for your help!
Best regards
Lars
from ansible-collection-checkmk.general.
Hi, if that git pull
are your changes then the output is same:
From https://github.com/tribe29/ansible-collection-tribe29.checkmk
3c52245..32ca914 devel -> origin/devel
58aba7f..8315f77 fix-51-exceptionhandling -> origin/fix-51-exceptionhandling
Updating 3c52245..32ca914
fatal: [pgdb03 -> localhost]: FAILED! => changed=false
http_code: -1
msg: 'Error calling API. HTTP Return Code is -1 Details: N/A'
from ansible-collection-checkmk.general.
Hi,
for some reason, my fix wasn't merged into the devel branch. I did that again and verified it. Can you please try again?
Best regards
Lars
from ansible-collection-checkmk.general.
Hi, now it looks like that:
fatal: [pgdb03 -> localhost]: FAILED! => changed=false
http_code: -1
msg: 'Error calling API. HTTP Return Code is -1 Details: Connection failure: The read operation timed out'
Btw. before when I was getting a 500 from the API sometimes a link to a crashreport was directly shown.. but it seems that this is not working anymore. Just wanted to mention it - don't know if it is related.
from ansible-collection-checkmk.general.
Hi,
for some reason, your API is not responding in time.
Probably you should try to do the call with curl for testing:
out=$(curl -v \
--request POST \
--write-out "\nxxx-status_code=%{http_code}\n" \
--header "Authorization: Bearer <your_user> <your_password>" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '{ "alias": "SLES12_cgroup2", "name": "SLES12_cgroup2" }' \
"http://<your_cmk_server>/<your_cmk_site>/check_mk/api/1.0/objects/host/<your_host>/actions/discover_services/invoke")
echo "$out"
resp=$( echo "${out}" | grep -v "xxx-status_code" )
code=$( echo "${out}" | awk -F"=" '/^xxx-status_code/ {print $2}')
echo "$resp" | jq
if [[ $code -lt 400 ]]; then
echo "OK"
else
echo "Request error"
fi
How long does this call take approximately?
from ansible-collection-checkmk.general.
Hi, I don't think that this is the problem.
xxx-status_code=302
OK
The problem only occurs after the first 2 or 3 hosts and only when called like I already described in #33.
But you can close the this issue if you want because it was more or less only about the body variable. At least we got now a "better" error message.
The issue with the API I don't really know how to debug and for now my workaround is at least working.
Thank you for your help.
from ansible-collection-checkmk.general.
I just recognized that the curl was missing a "follow" so I put https manually. Now this is the output:
{"title": "Bad Request", "status": 400, "detail": "These fields have problems: name, alias", "fields": {"name": ["Unknown field."], "alias": ["Unknown field."]}}
xxx-status_code=400
{
"title": "Bad Request",
"status": 400,
"detail": "These fields have problems: name, alias",
"fields": {
"name": [
"Unknown field."
],
"alias": [
"Unknown field."
]
}
}
Request error
from ansible-collection-checkmk.general.
It must look like that I guess:
--data '{
"mode": "new"
}' \
from ansible-collection-checkmk.general.
http_code: 200
time_namelookup: 0.072466s
time_connect: 0.087947s
time_appconnect: 0.250204s
time_pretransfer: 0.250424s
time_redirect: 0.000000s
time_starttransfer: 0.250430s
----------
time_total: 4.760772s
But service discovery could take longer.. and like I said it is working when I "loop" over it in Ansible but when I run it for each inventory host (which could be parallel) then it fails.
from ansible-collection-checkmk.general.
I have just tested it on shell.
discover-all-hosts.sh
-> this script does a "for" loop - so sequential and it takes about 4 secs for each host like in my last post.
But if I do that and run all those 4 scripts in parallel:
discover-host1.sh
discover-host2.sh
discover-host3.sh
discover-host4.sh
Then these are the times of each host:
time_total: 4.544909s
time_total: 9.610563s
time_total: 13.358466s
time_total: 17.429323s
from ansible-collection-checkmk.general.
If I understand this right, we are chasing another issue here, so @elwood218 would you be so kind to close this issue and move your research about the timing issue into a new issue? There we can then research, whether it is a collection issue or an API issue.
Thanks!
from ansible-collection-checkmk.general.
@elwood218 Alright, then please send an email, so all relevant information is in there. Thanks!
from ansible-collection-checkmk.general.
But maybe the module could use bulk discovery but I don't know how to solve that in Ansible.. (and the discovery and "accepting" is not working anyway - already opened a FEED for that)
from ansible-collection-checkmk.general.
Related Issues (20)
- [Feed] folder lookup plugin does not return the title of the folder HOT 3
- fixed downtime? HOT 4
- [BUG] "Register Agent for TLS" does not allow for "!" in checkmk_agent_auth on Linux HOT 1
- [FEED] Only register agent if host was created on the server or agent was installed HOT 4
- [FEED] Implement module for LDAP Connections
- [BUG] module "folder" not idempotent HOT 10
- [BUG] `discovery` module out of sync with the Checkmk REST API HOT 2
- [BUG] Error in the Agent role, Firewall seems to be only installed if checkmk_agent_server is an ip address HOT 3
- [FEED] Configure new web services monitoring HOT 1
- [BUG] rule idempotency check does not work for special_agents:vsphere rules HOT 4
- [BUG] ckeckmk agent deployment not respecting variables HOT 1
- [BUG] Unable to register agent for automatic updates HOT 5
- [BUG] Integration tests for downtime module creates downtime in the past HOT 1
- [BUG] Agent role crashes, when connections file absent HOT 4
- [BUG] InvalidAccessKeyId during installing the collection HOT 1
- Agent TLS registration does not work in disributed monitoring
- [BUG] Skip verifying the ssl cert for setting downtimes HOT 1
- [BUG] update_attribute on folder always results in 'changed' HOT 12
- [FEED] Implement module for DCD Connections
- Ansible trying to use linux shell to execute a powershell command HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-collection-checkmk.general.