简体   繁体   English

在 Kibana 面板中显示字段的准确值

[英]Display the exact value of a field in Kibana panel

I am using NATS in my project and I am trying to display its monitoring data in a Kibana panel.我在我的项目中使用NATS ,我试图在Kibana面板中显示它的监控数据 What I need is to display number of connections connected to each server.我需要的是显示连接到每个服务器的连接数。 The raw data for a server is like this:服务器的原始数据是这样的:

{
  "server_id": "NACDVKFBUW4C4XA24OOT6L4MDP56MW76J5RJDFXG7HLABSB46DCMWCOW",
  "now": "2019-06-24T14:28:16.520365-07:00",
  "num_connections": 25,
  "total": 25,
  "offset": 0,
  "limit": 1024,
  "connections": [
    {
      "cid": 1,
      "ip": "127.0.0.1",
      "port": 49764,
      "start": "2019-06-24T14:27:25.94611-07:00",
      "last_activity": "2019-06-24T14:27:25.954046-07:00",
      "rtt": "275µs",
      "uptime": "50s",
      "idle": "50s",
      "pending_bytes": 0,
      "in_msgs": 0,
      "out_msgs": 0,
      "in_bytes": 0,
      "out_bytes": 0,
      "subscriptions": 1,
      "name": "NATS Sample Subscriber",
      "lang": "go",
      "version": "1.8.1",
      "subscriptions_list": [
    "hello.world"
      ]
    },
    ...
  ]
}

What I need is a chart which shows num_connections of each server;我需要的是一张图表,显示每台服务器的num_connections a simple line chart is fine.一个简单的折线图就可以了。

I have tried Count and Unique Count of connections.cid , but it won't show the correct value.我已经尝试CountUnique Count of connections.cid ,但它不会显示正确的值。 The only ways that comes into my mind to achieve my needs are either showing the exact value of num_connections or displaying the length of connections ;我想到的满足我需求的唯一方法是显示num_connections的确切值或显示connections的长度; but I'm not sure if there are any possible ways to do this in Kibana .但我不确定在Kibana中是否有任何可能的方法可以做到这一点。

BTW, index is a simple nats-connz* wildcard without any time filed.顺便说一句,索引是一个简单的nats-connz*通配符,没有任何时间归档。

if by a Kibana panel you mean a visualization that you could add to a dashboard, then you might consider using Lens .如果 Kibana 面板是指可以添加到仪表板的 可视化,那么您可以考虑使用Lens What you would need to do is to你需要做的是

  1. Go to Kibana > Visualize Go 到Kibana > Visualize
  2. Click on the Create Visualization button, and then click on Lens单击“ Create Visualization ”按钮,然后单击“ Lens
  3. Select the nats-connz* index pattern from the dropdown (if you haven't created an index pattern yet, do that first ) Select 下拉列表中的nats-connz*索引模式(如果您尚未创建索引模式,请先创建)
  4. Drag the now field from the left column and drop it into the central areanow字段从左列拖放到中央区域
  5. Drag the num_connections field from the left column and drop it into the central areanum_connections字段从左列拖放到中央区域
  6. Select the Line type of visualization from the dropdown menu Select 下拉菜单中可视化的Line

If your version of Kibana doesn't include Lens, you can如果您的 Kibana 版本不包含 Lens,您可以

  1. Go to Kibana > Visualize Go 到Kibana > Visualize
  2. Click on the Create Visualization button, and then click on TSVB单击Create Visualization按钮,然后单击TSVB
  3. In the Panel Options tab, type nats-connz* into the Index pattern field (if you haven't created an index pattern yet, do that first ), then set now into the Time Field fieldPanel Options卡中,在Index pattern字段中输入nats-connz* (如果您还没有创建索引模式,请先创建),然后在Time Field字段now设置
  4. In the Data panel, set the Max aggregation for the num_connections fieldData面板中,为num_connections字段设置Max聚合

I have solved the issue by using the TopHit aggregator.我已经使用TopHit聚合器解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM