grafana-checkmk-datasource icon indicating copy to clipboard operation
grafana-checkmk-datasource copied to clipboard

API error

Open matzeeg3 opened this issue 3 years ago • 4 comments

Hi everybody, i have the trouble that i try to use the check_mk plugin for my check_mk core. i have version 2.0.9. the url is the right one i try to download the api .py via wget and that worked. but if i setup via grafana check_mk plugin i get the following error after safe and test: "Could not read API response, make sure the URL you provided is correct." And its not usable. can someone help me out? thanks and kind regards matze

matzeeg3 avatar Sep 03 '21 09:09 matzeeg3

I am using the "2.0.0p15.cee". I also have the same problem.... Could somebody give some comments for this problem?

But it works like below. grafana error

# curl 'cma03/remote_site/check_mk/view.py?_username=automation&_secret=XXXXXXXXXXX&view_name=svcproblems&output_format=json'; [ [ "service_state", "host", "service_description", "service_icons", "svc_plugin_output", "svc_state_age", "svc_check_age", "perfometer" ], [

regards,

Yoshihiro-jp avatar Dec 27 '21 08:12 Yoshihiro-jp

Looks like you are trying to connect to a remote site in a distributed monitoring environment. According to the documentation, you have to connect to the central site.

See 2.2 on the following page: https://docs.checkmk.com/latest/en/grafana.html

LevonTostig avatar Dec 27 '21 08:12 LevonTostig

Looks like you are trying to connect to a remote site in a distributed monitoring environment. According to the documentation, you have to connect to the central site.

See 2.2 on the following page: https://docs.checkmk.com/latest/en/grafana.html

Dear LevonTostig, problem2

I disable the "Distributed Monitoring" then it was the same.

So I created the new site(mysite) but the problem was the same like attached file. If you had some idea kindly tell me.

regards, Yoshihiro

Yoshihiro-jp avatar Dec 28 '21 01:12 Yoshihiro-jp

Same issue here... Using 2.0.0p17 (CRE) - has anyone figured this out?

bdeprez avatar Jan 05 '22 16:01 bdeprez

Was there ever a resolution to this problem? I am on CheckMK 2.1.0p17. I have been using the old grafana plugin of version 1.1.0 for a long time and it still works but I can't seem to upgrade to the new 2.0.3 version. I get the same error above.

CVT-Adam avatar Dec 08 '22 19:12 CVT-Adam

The problem here is that there are a lot of different conditions under which this error could occur. If you could share the response of the network request with me, I can take a look. It should show up as webapi.py?action=get_combined_graph_identifications in the Network Tab of the Inspector.

TheSpacyCat avatar Dec 09 '22 12:12 TheSpacyCat

for me the issue was an http proxy in between, which was sending a forbidden (to not use it for the connection to checkmk). I was able to see the error when switching from https to http (in the mentioned network inspector of the chrome developer tools).

so excluding it using NOPROXY was fixing it the error, revealing a second issue (visible thanks to the newest 2.0.3 plugin version). you must use an automation secret instead of a password.

hope this helps some of you

m1schka avatar Dec 09 '22 13:12 m1schka

this below is from the grafana.log file when i attempt save and test in the datasource. @m1schka I am using the secret and not the password for the automation user already.

logger=context userId=6 orgId=1 uname=xxxxxx t=2022-12-09T08:16:56.19340588-09:00 level=info msg="Request Completed" method=GET path=/login/ status=302 remote_addr=192.168.xxx.xxx time_ms=36 duration=36.178574ms size=24 referer= handler=/login logger=context userId=6 orgId=1 uname=xxxxxx t=2022-12-09T08:16:56.464335642-09:00 level=info msg="Request Completed" method=GET path=/api/live/ws status=-1 remote_addr=192.168.xxx.xxx time_ms=2 duration=2.181657ms size=0 referer= handler=/api/live/ws logger=data-proxy-log userId=6 orgId=1 uname=xxxxxx path=/api/datasources/proxy/15/cmk/check_mk/webapi.py remote_addr=192.168.xxx.xxx referer=http://lovejoy.cvtc.org:3000/datasources/edit/GufJd9F4k t=2022-12-09T08:17:06.958309189-09:00 level=error msg="Proxy request failed" err="x509: certificate signed by unknown authority" logger=context userId=6 orgId=1 uname=xxxxxx t=2022-12-09T08:17:06.958460911-09:00 level=error msg="Request Completed" method=POST path=/api/datasources/proxy/15/cmk/check_mk/webapi.py status=502 remote_addr=192.168.xxx.xxx time_ms=12 duration=12.301322ms size=0 referer=http://lovejoy.cvtc.org:3000/datasources/edit/GufJd9F4k handler=/api/datasources/proxy/:id/*

CVT-Adam avatar Dec 09 '22 17:12 CVT-Adam

this looks like grafana is not trusting the certificate from the checkmk I'm using the grafana operator inside k8s, there this can be achieved by mounting the certificates to /etc/ssl/certs/ca-certificates.crt using a configmap and extraVolume(Mounts). in case of openshift this configmap can easily been created by letting openshift injecting the cluster trusted CA into a configmap

I hope this helps

m1schka avatar Dec 09 '22 17:12 m1schka

I find that strange because my checkmk is loaded with a valid wildcard ssl from godaddy.

CVT-Adam avatar Dec 09 '22 18:12 CVT-Adam

Ok well sure enough I put the SSL into the ca-certificates.crt file and rebooted and now it is connecting and pulling data just fine. I do find that odd that I had to do that for a publicly validated certificate, but all is working now, and I am getting the host and data.

CVT-Adam avatar Dec 09 '22 22:12 CVT-Adam

Hello All,

I also have the same problem. I am using the CheckMK "1.6.0p20" Enterprise and the Open Source Grafana v9.3.6 (978237e7cb)

For the plug-in, I´m using the "grafana-checkmk-datasource-1.1.0", because the compatibility with CheckMK "1.6.0p20", as I could see on https://docs.checkmk.com/1.6.0/en/grafana.html.

But, I not sure if this plug-in version 1.1.0 works fine with Open Source Grafana v9.3.6 (978237e7cb).

Checking on the README.md file zip on "https://github.com/tribe29/grafana-checkmk-datasource/archive/1.1.0.zip" I could check it below.

Requirements

Minimal Checkmk Version is 1.6.0p2. The Grafana datsource requires the Checkmk Enterprise Edition or Checkmk Managed Services Edition.

But, I couldn´t find information about Grafana requirements. How can I check compatibility between them?

And about the error message, someone could help me to understand it? I´m really newbie on this new world.

Thanks in advance.

m23gh avatar Feb 03 '23 18:02 m23gh

Passive maintenance for checkmk 1.6.0 ended 2022-09-09 (see https://docs.checkmk.com/latest/en/cmk_versions.html#support_periods). We don't support this version for this plugin.

Version 1.1.0 of this plugin was release on 2019-09-30. Grafana released 6.3.6 on 2019-09-23, so those two versions probably should work together.

As for general troubleshooting you have multiple places to look for hints what's going wrong:

  • network tab of the development console of your browser
  • grafana logs
  • checkmk logs

Please understand that we can not put time into supporting old versions of this plugin.

BenediktSeidl avatar Feb 06 '23 11:02 BenediktSeidl

Hello @BenediktSeidl,

Sure, completely understand.

Thanks for the information.

Best regards,

m23gh avatar Feb 09 '23 11:02 m23gh

I think all issues from this ticket should be resolved, so I'm closing that. If I missed something, please add a comment.

BenediktSeidl avatar May 30 '23 13:05 BenediktSeidl