AJAX panel erratic behaviour

Hi,

Using the latest version of Grafana and the latest version of the JSON plugin I try to view a very simple html page using the AJAX plugin. This is for testing only to keep it simple.

The page looks like:

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

I’m trying to display this page in an AJAX panel plugin (not the text panel because the text panel cannot easily receive the time range for the panel if the user changes it after initial display).

After initial setup this works fine, but when I change something (for instance I change the URL, and I change it back) the panel doesn’t show the page anymore (blanc) or shows an error message ‘404’. I have played around using html pages of various complexity and ended up with this simple setup of the AJAX panel:

Request.Source: HTTP
Request.URL: http://localhost:1880/simple-html
Request. Method: Get
Request.response: Text
Request.Credentials: No
Request.Only changes: No
Request.Show errors: Yes

Parameters : {}

Headers (via javascript): {Accept : ‘text/html’}
Mode: Direct HTML

I’m using the AJAX panel because the TEXT panel doesn’t provide me with the time-range. The page works fine in the text pane though so I’m wondering why it doesn’t work in the AJAX panel. If the AJAX panel is set to TEXT/HTML is should work the same way as the text panel or shouldn’t it?

Hi Kortenbach, Hi community
I have a similar problem:
Just want to show a very simple text from a different application on the same server.
Called with webservice.

So, if anyone can help us will be grateful.
My text is similar to the one of Kortenbach.

My URL looks like this: http://localhost:8080/appname/http/ReST/Html_Test_Webservice
When I just do on the command line:
curl http://localhost:8080/appname/http/ReST/Html_Test_Webservice
I receive the correct answer and can see it in the other application.
However from Grafana not any request seems to be sent.

The panel just remains black (in dark mode).

Json of the dashboard:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 44,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "postgres",
        "uid": "zEUu0p3nk"
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "header_js": "{}",
      "id": 2,
      "method": "GET",
      "mode": "html",
      "params_js": "{\n from:ctrl.range.from.format('x'),  // x is unix ms timestamp\n to:ctrl.range.to.format('x'), \n height:ctrl.height,\n now:Date.now(),\n interval: ctrl.template('$__interval'),\n sample: 'Not escaped: $__interval',\n since:ctrl.lastRequestTime\n}",
      "request": "http",
      "responseType": "text",
      "showErrors": true,
      "showTime": false,
      "showTimeFormat": "LTS",
      "showTimeValue": "request",
      "skipSameURL": true,
      "templateResponse": true,
      "title": "Panel Title",
      "type": "ryantxu-ajax-panel",
      "url": "http://localhost:8080/appname/http/ReST/Html_Test_Webservice",
      "withCredentials": false
    }
  ],
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "HTML Test 2",
  "uid": "xTtF-B7Vk",
  "version": 1,
  "weekStart": ""
}

I switched the three log params in the ini file on:

Log web requests

router_logging = true

Set to true to log the sql calls and execution times.

log_queries = true

This enables data proxy logging, default is false

logging = true

But still cannot see any information regarding what is happening. When I go to Inspect, Query, Stats will just remain empty. Data will stay in the hourglass forever.

Any hint will be highly welcome.

Short update:
I switched to the html graphics panel. It seems to work very well.
I’m using it to display an iframe and I use postmessage to send the from and to times to the page in the iFrame.

Best regards,
Bert Kortenbach