Grafana-zabbix: Add zabbix datasource, Testing... going forever, the dashboard pannel is empty

Created on 1 Sep 2016  Â·  17Comments  Â·  Source: alexanderzobnin/grafana-zabbix

zabbix-server:3.0.4
grafana: 3.1.1
grafana-zabbix: 3.0.0

Browser dev show as below:

Request URL:http://x.x.x.x/zabbix/api_jsonrpc.php
Request Method:GET
Status Code:412 Precondition Failed
Remote Address:202.55.17.24:3980
Response Headers
view source
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:POST
Access-Control-Allow-Origin:*
Access-Control-Max-Age:1000
Connection:close
Content-Length:0
Content-Type:text/html
Date:Thu, 01 Sep 2016 06:36:47 GMT
Server:Apache/2.4.7 (Ubuntu)
X-Powered-By:PHP/5.5.9-1ubuntu4.19

Most helpful comment

@alexanderzobnin I got it working. I had to put http://zabbix.home/api_jsonrpc.php in the url setting. If I should put manually the api_jsonrpc.php is not clear in the documentation that I found. If its clear in your docs and I completely ignored it sorry for wasting your time. In any case, huge thanks for your help.

Edit: Yep, it was perfectly clear in your documentation. Completely my fault. Sorry again.

All 17 comments

Same with me as well. When trying to add the data source from grafana it is happening.

@ChuckPeng which connection type do you use when create datasource? _Proxy_ or _Direct_ ?

@alexanderzobnin . For me it is happening for both proxy and direct.

Similar problem here (Same versions of everything). But in my case, with proxy connection it gives me the message

Invalid user name or password
Zabbix API version: undefined

and I have checked the name and password. With direct connection it just get stuck in Testing... forever.

Do you use proxy in front of Zabbix? HTTP auth?

There is no proxy for me. Can directly access zabbix url, but not via
grafana.

On Sep 10, 2016 11:53 AM, "Alexander Zobnin" [email protected]
wrote:

Do you use proxy in front of Zabbix? HTTP auth?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/alexanderzobnin/grafana-zabbix/issues/270#issuecomment-246100551,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARIcyQzouo8U9kNy7YaZsdNHeI33MqBEks5qom_0gaJpZM4JyXaj
.

No proxy nor HTTP Auth, but I use a VHost to access with zabbix.home.

I've discovered that with http://192.168.1.3/zabbix it gets stuck in Testing..., instead of giving the error Zabbix API version: undefined. Both with proxy as Access.

Zabbix and grafana are in the same machine. I have also tested with localhost and loopback IPs and it also gets stuck.

What is VHost?

@alexanderzobnin Apache's way to host more than one website in the same IP (More info)

May be problem in Apache config?

I don't think so. Downloading/authenticating via other navigators/console tools does not give any problems.

@wynro Can you check HTTP status code in dev tools?

@alexanderzobnin, Of course, the request and answer info is:

Request URL: http://grafana.home/api/datasources/proxy/3
Request method: POST
Remote address: 192.168.1.3:80
Status code: 200 OK
Version: HTTP/1.1

Request headers:
Host: grafana.home
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: application/json, text/plain, _/_
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
Referer: http://grafana.home/datasources/edit/3
Content-Length: 63
Cookie: zbx_sessionid=7f7516fa2769ad5488ab8654afa98d24; grafana_user=admin; grafana_remember=07353a9e86476373c3692c27fa38ec0ac3bb964642b9db4a; grafana_sess=d0b15e9a70ae3e39; PHPSESSID=lg2oqt5t4qng2uqc64i8297483
Connection: keep-alive

Request params:
JSON
id: 1
jsonrpc: "2.0"
method: "apiinfo.version"
params: []

Response headers:
Cache-Control: no-store, no-cache, must-revalidate
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 1178
Content-Type: text/html; charset=UTF-8
Date: Tue, 13 Sep 2016 23:14:35 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=98
Pragma: no-cache
Server: Apache/2.4.23 (Raspbian)
Set-Cookie: zbx_sessionid=afe23be10cb826dbcebd3d3de4847b2e
zbx_sessionid=afe23be10cb826dbcebd3d3de4847b2e
PHPSESSID=256onk40g01s05529qh870cdq6; path=/
Vary: Accept-Encoding

Response text:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="Author" content="Zabbix SIA" />
        <title>Zabbix</title>
        <link rel="icon" href="favicon.ico">
        <link rel="apple-touch-icon-precomposed" sizes="76x76" href="img/apple-touch-icon-76x76-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="120x120" href="img/apple-touch-icon-120x120-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="img/apple-touch-icon-152x152-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="180x180" href="img/apple-touch-icon-180x180-precomposed.png">
        <link rel="icon" sizes="192x192" href="img/touch-icon-192x192.png">
        <meta name="msapplication-TileImage" content="img/ms-tile-144x144.png">
        <meta name="msapplication-TileColor" content="#d40000">
        <meta name="msapplication-config" content="none"/>
<link rel="stylesheet" type="text/css" href="styles/blue-theme.css" />
<style type="text/css">.na-bg, .na-bg input[type="radio"]:checked + label { background-color: #97AAB3 }
.info-bg, .info-bg input[type="radio"]:checked + label { background-color: #7499FF }
.warning-bg, .warning-bg input[type="radio"]:checked + label { background-color: #FFC859 }
.average-bg, .average-bg input[type="radio"]:checked + label { background-color: #FFA059 }
.high-bg, .high-bg input[type="radio"]:checked + label { background-color: #E97659 }
.disaster-bg, .disaster-bg input[type="radio"]:checked + label { background-color: #E45959 }
</style><script>var PHP_TZ_OFFSET = 7200;</script><script src="js/browsers.js"></script>
<script src="jsLoader.php?ver=3.0.4&amp;lang=en_GB&showGuiMessaging=1"></script>
</head>
<body>
<div class="msg-bad-global" id="msg-bad-global"></div>
<div class="article"><div class="signin-container"><div class="signin-logo"></div><form method="post" action="index.php" accept-charset="utf-8"><input type="hidden" id="sid" name="sid" value="cebd3d3de4847b2e"><input type="hidden" id="form_refresh" name="form_refresh" value="1"><ul><li><label for="name">Username</label><input type="text" id="name" name="name" value="" maxlength="255" autofocus="autofocus"></li><li><label for="password">Password</label><input type="password" id="password" name="password" value="" maxlength="255"></li><li><label for="autologin"><input type="checkbox" id="autologin" name="autologin" value="1" checked="checked">Remember me for 30 days</label></li><li><button type="submit" id="enter" name="enter" value="Sign in">Sign in</button></li><li class="sign-in-txt">or <a href="zabbix.php?action=dashboard.view">sign in as guest</a></li></ul></form></div><div class="signin-links"><a target="_blank" class="grey link-alt" href="http://www.zabbix.com/documentation/3.0/">Help</a>&nbsp;&nbsp;•&nbsp;&nbsp;<a target="_blank" class="grey link-alt" href="http://www.zabbix.com/support.php">Support</a></div></div><div class="footer">&copy; 2001&ndash;2016, <a class="grey link-alt" target="_blank" href="http://www.zabbix.com/">Zabbix SIA</a></div></body>

There are 2 requests like this. The first requests appinfo.version and the second user.login, with the correct parameters. They also differ in Content-Length, Keep-alive and Set-Cookie. There are no other differences.

Seems, Zabbix returns login page. Very strange. Check it with curl request:

curl -X POST -d '{"jsonrpc":"2.0","method":"apiinfo.version","params":[],"id":1}' -H "Content-Type:application/json" http://your_zabbix/api_jsonrpc.php

@alexanderzobnin It returns {"jsonrpc":"2.0","result":"3.0.4","id":1}, which I presume is the correct answer.

To be sure I also requested via curl a user login (with {"jsonrpc":"2.0","method":"user.login","params":{"user":"grafana","password":"grafana"},"id":1} and it also give me a correct answer ({"jsonrpc":"2.0","result":"daa2de3b9eb50c74bc8bc95842ec36b6","id":1})

@alexanderzobnin I got it working. I had to put http://zabbix.home/api_jsonrpc.php in the url setting. If I should put manually the api_jsonrpc.php is not clear in the documentation that I found. If its clear in your docs and I completely ignored it sorry for wasting your time. In any case, huge thanks for your help.

Edit: Yep, it was perfectly clear in your documentation. Completely my fault. Sorry again.

@wynro yes, api url config described here http://docs.grafana-zabbix.org/installation/configuration/

Was this page helpful?
0 / 5 - 0 ratings