grafana - 如何将 HTML 数据填充到 Grafana Ajax 插件
问题描述
我有一个动态生成的 html 内容,我想在 Grafana 中显示相同的内容。手动填充 Ajax 插件是不可行的。我知道 Ajax 插件也可以用于相同的用途。我如何将 html 内容发送到这个插件,以及必须更新哪些不同的参数(下图)才能正确获取数据?
我正在使用 Python 将数据推送到 Influxdb。下面的例子 -
变量 htmloutput 包含必须显示的 html 数据。
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)
我得到的需要显示的示例 HTML 输出 -
HTML 代码 -
<!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>
提前致谢。
解决方案
推荐阅读
- aem - 如何在 AEM 搜索查询生成器中包含标签名称,同时标签 ID 保存在存储库中
- python - 如何以另一种方法将所选图像的路径显示为变量?
- mysql - MYSQL从字符串中删除第一个逗号
- java - 通过向 spark dtaframe 列添加值来生成新列
- linux - Shell 错误 xargs:由信号 11 终止
- java - 找到具有最高价值的对象的最有效方法
- java - 特殊的 HashMap 行为
- r - 跨数据帧的行 NA 进行插值
- powershell - 找不到“ToString”的重载和参数计数:“1”
- angular6 - 如何将多个 .js 文件输出到 Angular 6 angular.json 中的 dist/ 文件夹