2017-03-02 3 views
0

Nicht sicher, ob dies möglich ist, aber wir versuchen, ein grafisches Status Dashboard in Grafana mit dem SingleStat Panel zu erstellen. Wir nutzten Templating, um unsere Hosts an zwei Standorten zu gruppieren und den Paketverlustwert von hostalive in Icinga2 zu verwenden. Wir möchten, dass das Einzelstatusfeld den Prozentsatz der Hosts anzeigt, aber manchmal erhalten wir Nullwerte. Hier ist die JSON aus unseren Panels:Grafana Status Board

{ 
    "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 
    } 
} 

Das Abfrageintervall für die Gastgeber alle zehn Minuten, der grafana Board Bereich ist „heute“ und setzte jede Sekunde zu aktualisieren.

Antwort

0

Haben Sie es mit dem keeplastvalue herausgefunden.

"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 
    } 
    ],