1

I have a html content that gets generated dynamically and i want to display the same in the Grafana. Manually populating the Ajax Plugin is not feasible. I understand that the Ajax plugin can be used for the same. How can i send the html content to this plugin and what are the different parameters (image below) that have to be updated to get the data right?

enter image description here

I’m using Python to push the data to the Influxdb. example below -

The variable htmloutput contains the html data that has to be displayed.

client = InfluxDBClient(host='10.10.10.10', port=8086)
client.switch_database('TesDB')
json_body = [
              {
                      "measurement": "MS1",
                      "tags": {
                              "Server": QA1,
                      },
                      "time": timestamp,
                      "fields": {
                              "HTMLCONTENT": htmloutput
                        }
                }
                ]
client.write_points(json_body)

Sample HTML Output that I get which needs to be displayed -

enter image description here

HTML Code -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-type" content="text/html;charset=UTF-8"><title>Errors</title><link rel="stylesheet" type="text/css" href="styles.css"><script src="code.js" type="text/javascript"></script></head><body onload="preparepage();"><input type="hidden" id="imageBase" value="img/"><a name="17">Problem 1</a></h3><div id="exp17"><div class="important"><div><p>104 errors of <b>General Exceptions</b>, at <b>Overview page</b> occupy <b>26.92%</b> in total. <br><br><b>Keywords</b><br>General<br>Unavailable, Temporary<br></div></div></div></div><br>
</body></html>

Thanks in advance.

sdgd
  • 723
  • 1
  • 17
  • 38
  • It's not clear why do you intend to use that AJAX plugin to display data from Influx DB - could you please elaborate on that? – Yuri G Nov 30 '18 at 21:27
  • The data what i get from the source is in HTML format and in the same HTML format, I would like to display the data, i see that there are two panels to do this, 1. Text Panel and 2. Ajax Panel. How do I show my html data in Grafana? the content is dynamic and varies from time to time. – sdgd Dec 03 '18 at 10:30
  • Sorry, I'm not quite following that. First, you said "My data source is InfluxDB". Then, you go like "The data what i get from the source is in HTML format". I beg your pardon, but what's that? These two don't come together. – Yuri G Dec 03 '18 at 14:58
  • ok, i have a csv data which i am pushing it to Influxdb and along with csv data, i also a html data which i want to push to influxdb to show that in Grafana. so, my query is how do I display my html content in Grafana which is dynamic and varies from time to time? Hope i am clear. – sdgd Dec 04 '18 at 10:45
  • HTML data? Uhm... that doesn't look like smart usage of timeseries DB whatsoever. What kind of thing is that? Could you show an example? What could be the need for such a thing? – Yuri G Dec 04 '18 at 14:49
  • the data contains few lines of some results which we are getting from the server (the output is always in html) with simple

    and
    tags but the content will be dynamic. I would like to show the content as is in Grafana

    – sdgd Dec 04 '18 at 16:58
  • The strangest use of telemetry I've ever seen, so far. How do you suppose to aggregate your HTML values? Would you please show at least one example of such a value & explain what you going to measure, calculate & show in there? – Yuri G Dec 04 '18 at 17:12
  • Sure, I've updated the question with the sample HTML code i get which i need to display and how it is displayed in Grafana. – sdgd Dec 05 '18 at 14:54
  • I would suggest you to extract what you need from these htmls, whatever it is - codes, keywords, anything that carries information you need - PRIOR to putting that into Influx. How do you collect it to put into Influx, BTW? – Yuri G Dec 06 '18 at 16:49
  • Yeah, I'm thinking the same now. Get all the info from the HTML but the tags can increase/decrease i.e. new info can be added sometimes. To write it to Influxdb, i'm using the `write_points` API coded in Python – sdgd Dec 06 '18 at 16:55
  • 1
    As you control the writing piece, and it is custom - then the problem is solved: parse it there, send only the valuable METRICS to Influx, not all that surrounding garbage. And don't worry about new tags - Influx would embrace it seamlessly. Just be smart in measurement buildup, and ALWAYS mind the cardinality of your data point parts (low ? -> tag, high? -> field). – Yuri G Dec 06 '18 at 17:16

0 Answers0