但是图表中的返回值是“N / A”
我正在使用elasticsearch(7.6.0)和Grafana(6.6.2)。
以下是我发送给elasticsearch的out文件
{ "latencies":{
"total":3981710268690,
"mean":43876078,
"50th":916913,
"90th":2217744,
"95th":5162430,
"99th":60233348,
"max":60000209373,
"min":43652
},
"@version":"1",
"latest":"2020-03-05T16:14:44.23387091Z",
"path":"test23.json",
"duration":61163899322,
"wait":552109,
"status_codes":{
"0":90624,
"200":125
},
"earliest":"2020-03-05T16:13:43.069971588Z",
"rate":1483.702004057131,
"throughput":2.0436707446156577,
"@timestamp":"2020-03-05T16:14:44.453Z",
"errors":[
"Post http://www: dial tcp 0.0.0.0:0->10.133.9.87:8688: socket: too many open files",
"Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.30.30: dial udp 10.20.30:45: socket: too many open files"
],
"bytes_in":{
"mean":70.90298515686123,
"total":6434375
},
"requests":90749,
"Report_Title":"test23",
"host":"ABS",
"success":0.0013774256465635985,
"end":"2020-03-05T16:14:44.234423019Z",
"bytes_out":{
"mean":70.90298515686123,
"total":6434375
}
}
另外,我已经使用Singlestat插件作为@yash提及,但仍然可以解决问题。
Query section
Visualization section
有人能帮我吗
最佳答案
这是一个相当容易的任务。您只需要使用“Singlestat Math”或“Metaqueries”插件即可。您需要做的是,在同一面板的两个查询中使用计数指标,一个查询获取成功状态代码的计数,另一个查询不成功状态代码的计数。然后,您可以使用任何一个插件从另一个查询中减去查询结果的值。
https://grafana.com/grafana/plugins/blackmirror1-singlestat-math-panel
https://grafana.com/grafana/plugins/goshposh-metaqueries-datasource
根据我的经验,我建议您使用singlestat数学插件,使用起来会更容易。
注意:计算(A-B)在singlestat数学插件的可视化部分而不是查询部分中完成。
附言singlestat-math插件实际上在可视化部分中添加了一个新面板。与默认的singlestat面板不同。
关于elasticsearch - Grafana在Elasticsearch数据源中使用两个字段的减法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60557523/