Json 格拉凡纳地位委员会

Json 格拉凡纳地位委员会,json,grafana,Json,Grafana,不确定这是否可行,但我们正在尝试使用singlestat面板在grafana中创建一个总体状态仪表板。我们使用模板将主机分为两个站点,并使用Icinga2中hostalive的数据包丢失值。我们希望singlestat面板显示主机下降的百分比,但有时会得到空值。以下是来自我们小组的JSON: { "id": 2, "title": "Host Group 2", "span": 6, "type": "singlestat", "targets": [ {

不确定这是否可行,但我们正在尝试使用singlestat面板在grafana中创建一个总体状态仪表板。我们使用模板将主机分为两个站点,并使用Icinga2中hostalive的数据包丢失值。我们希望singlestat面板显示主机下降的百分比,但有时会得到空值。以下是来自我们小组的JSON:

{
  "id": 2,
  "title": "Host Group 2",
  "span": 6,
  "type": "singlestat",
  "targets": [
    {
      "target": "icinga2.$group1.host.hostalive.perfdata.pl.value",
      "refId": "A",
      "hide": true
    },
    {
      "target": "keepLastValue(averageSeries(#A))",
      "refId": "B",
      "textEditor": true,
      "targetFull": "keepLastValue(averageSeries(icinga2.$group1.host.hostalive.perfdata.pl.value), 10000)"
    }
  ],
  "links": [],
  "datasource": null,
  "maxDataPoints": "",
  "interval": null,
  "cacheTimeout": null,
  "format": "percent",
  "prefix": "",
  "postfix": "",
  "nullText": null,
  "valueMaps": [
    {
      "value": "null",
      "op": "=",
      "text": "N/A"
    }
  ],
  "mappingTypes": [
    {
      "name": "value to text",
      "value": 1
    },
    {
      "name": "range to text",
      "value": 2
    }
  ],
  "rangeMaps": [
    {
      "from": "null",
      "to": "null",
      "text": "N/A"
    }
  ],
  "mappingType": 1,
  "nullPointMode": "connected",
  "valueName": "current",
  "prefixFontSize": "50%",
  "valueFontSize": "80%",
  "postfixFontSize": "50%",
  "thresholds": "50, 100",
  "colorBackground": true,
  "colorValue": false,
  "colors": [
    "rgba(50, 172, 45, 0.97)",
    "rgba(237, 129, 40, 0.89)",
    "rgba(245, 54, 54, 0.9)"
  ],
  "sparkline": {
    "show": false,
    "full": false,
    "lineColor": "rgb(31, 120, 193)",
    "fillColor": "rgba(31, 118, 189, 0.18)"
  },
  "gauge": {
    "show": false,
    "minValue": 0,
    "maxValue": 100,
    "thresholdMarkers": true,
    "thresholdLabels": false
  }
}

主机的轮询间隔为每十分钟一次,grafana板的范围为“今天”,并设置为每秒刷新一次。

已使用该值计算出来

"targets": [
    {
      "hide": true,
      "refId": "A",
      "target": "exclude(keepLastValue(icinga2.$group1.host.hostalive.perfdata.pl.value, 144), '1-99')",
      "textEditor": true
    },
    {
      "refId": "B",
      "target": "averageSeries(#A)",
      "targetFull": "averageSeries(icinga2.$group1.host.hostalive.perfdata.pl.value)",
      "textEditor": false
    }
  ],