diff --git a/README.md b/README.md index 05b19df..c64cd4a 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,75 @@ This graph shows the fping\_rtt summary as "SmokePing"-like graph in Grafana: replacement: 127.0.0.1:9605 # The fping-exporter's real hostname:port. ``` +## Installation for CentOS 8 +1. Install Go on RHEL 8 using and set PATH : +``` +[root@prometheus ~]# sudo yum module -y install go-toolset +[root@prometheus ~]# vi ~/.bash_profile +[root@prometheus ~]# export PATH=$PATH:/usr/bin/go +[root@prometheus ~]# source ~/.bash_profile +``` +2. Install fping on RHEL 8 using : +``` +[root@prometheus ~]# yum install -y fping +``` +3. Download and compile fping-exporter on RHEL 8 using : +``` +[root@prometheus ~]# git clone https://github.com/schweikert/fping-exporter.git /tmp/fping-exporter +[root@prometheus ~]# go build -o /tmp/fping-exporter +[root@prometheus ~]# cp fping-exporter /usr/local/bin +``` +4. Next, adjust the firewall as follows to allow external connections to the server via port 9605 +``` +[root@prometheus ~]# firewall-cmd --add-port=9605/tcp --permanent +[root@prometheus ~]# firewall-cmd --reload +``` +5. Creating a Systemd service file for fping-exporter (For us to manage fping-exporter as a service using systemd, we need to create a system file for it. So, create the file as shown and paste the content,) +``` +[root@prometheus ~]# vi /etc/systemd/system/fping-exporter.service +``` + +``` +[Unit] +Description=fping-exporter allows you to run measure network latency using fping and prometheus +Wants=network-online.target +After=network-online.target + +[Service] +User=root +Group=root +Type=simple +CapabilityBoundingSet=CAP_NET_RAW +AmbientCapabilities=CAP_NET_RAW + +# Application Options: +# -l, --listen=[HOST]:PORT Listen address (default: :9605) +# -p, --period=SECS Period in seconds, should match Prometheus scrape interval (default: 60) +# -f, --fping=PATH Fping binary path (default: /usr/bin/fping) +# -c, --count=N Number of pings to send at each period (default: 20) + +ExecStart=/usr/local/bin/fping-exporter \ + -f /usr/sbin/fping \ + -p 300 \ + -c 5 + +[Install] +WantedBy=multi-user.target +``` +6. For the changes to take effect, reload the systemctl : +``` +[root@prometheus ~]# systemctl daemon-reload +``` +7. Now start and enable fping-exporter to run on boot +``` +[root@prometheus ~]# systemctl start fping-exporter +[root@prometheus ~]# systemctl enable fping-exporter +``` +8. Just to be certain that fping-exporter is running, run the command: +``` +[root@prometheus ~]# systemctl status fping-exporter +``` + ## Metrics fping-exporter produces the following metrics: diff --git a/README_screenshot.png b/README_screenshot.png index 415720b..37d0027 100644 Binary files a/README_screenshot.png and b/README_screenshot.png differ diff --git a/grafana-dashboard.json b/grafana-dashboard.json index 1f1f31a..70400d6 100644 --- a/grafana-dashboard.json +++ b/grafana-dashboard.json @@ -10,11 +10,17 @@ } ], "__requires": [ + { + "type": "panel", + "id": "corpglory-multibar-graph-panel", + "name": "Multibar Graph Panel", + "version": "0.2.5" + }, { "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "6.2.5" + "version": "6.7.3" }, { "type": "panel", @@ -27,6 +33,12 @@ "id": "prometheus", "name": "Prometheus", "version": "1.0.0" + }, + { + "type": "panel", + "id": "singlestat", + "name": "Singlestat", + "version": "" } ], "annotations": { @@ -46,40 +58,278 @@ "gnetId": null, "graphTooltip": 0, "id": null, - "iteration": 1584732188434, + "iteration": 1588328407901, "links": [], "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 21, + "panels": [], + "title": "Multi Ping Metrics", + "type": "row" + }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, + "datasource": "${DS_PROMETHEUS}", + "decimals": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 26, + "interval": "1m", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 350, + "sort": "max", + "sortDesc": false, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pluginVersion": "6.6.2", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": true, + "targets": [ + { + "expr": "avg_over_time(fping_rtt{instance=~\"$host\",quantile=\"0.500\"}[$__interval])", + "interval": "", + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Ping Average Latency", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transparent": true, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 31, + "panels": [], + "title": "Multi Packet Loss", + "type": "row" + }, + { + "aliasColors": {}, + "bars": true, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_PROMETHEUS}", + "decimals": 2, + "displayBarsSideBySide": true, + "fill": 1, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 13 + }, + "id": 36, + "interval": "1m", + "labelAlign": "center", + "legend": { + "alignAsTable": true, + "avg": true, + "current": false, + "max": true, + "min": true, + "rightSide": true, + "show": true, + "sideWidth": 350, + "total": false, + "values": true + }, + "lines": false, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg_over_time(fping_lost_count{instance=~\"$host\"}[$__interval])/avg_over_time(fping_sent_count{instance=~\"$host\"}[$__interval])", + "instant": false, + "interval": "", + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Packet Loss Percentage", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "transparent": true, + "type": "corpglory-multibar-graph-panel", + "xaxis": { + "buckets": null, + "customDateFormat": "", + "customDateFormatShow": false, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 24 + }, + "id": 5, + "panels": [], + "title": "Target Metrics", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "${DS_PROMETHEUS}", + "decimals": 2, "fill": 0, + "fillGradient": 0, "gridPos": { "h": 7, "w": 12, "x": 0, - "y": 0 + "y": 25 }, + "hiddenSeries": false, "id": 2, "interval": "1m", "legend": { - "avg": false, + "alignAsTable": true, + "avg": true, "current": false, "hideEmpty": false, "hideZero": false, - "max": false, - "min": false, + "max": true, + "min": true, + "rightSide": false, "show": true, "total": false, - "values": false + "values": true }, "lines": true, "linewidth": 1, "links": [], "maxPerRow": 2, "nullPointMode": "null", - "options": {}, + "options": { + "dataLinks": [] + }, "percentage": false, "pointradius": 2, "points": false, @@ -206,31 +456,33 @@ "lines": false }, { - "alias": "median", + "alias": "avg", "color": "#FFB357", "linewidth": 3, "zindex": 1 }, { - "alias": "l100", + "alias": "max", "color": "#202020", "hideTooltip": true, "legend": false }, { - "alias": "l5", + "alias": "min", "color": "#202020", "hideTooltip": true, "legend": false }, { "alias": "/p.*/", + "hideTooltip": true, "legend": false }, { "alias": "% loss", "bars": true, "color": "#E02F44", + "lines": false, "yaxis": 2, "zindex": -3 } @@ -382,27 +634,31 @@ { "expr": "avg_over_time(fping_rtt{instance=~\"$host\",quantile=\"0.500\"}[$__interval])", "format": "time_series", + "interval": "", "intervalFactor": 1, - "legendFormat": "median", + "legendFormat": "avg", "refId": "G" }, { "expr": "avg_over_time(fping_rtt{instance=~\"$host\",quantile=\"1.000\"}[$__interval])", "format": "time_series", + "interval": "", "intervalFactor": 1, - "legendFormat": "l100", + "legendFormat": "max", "refId": "V" }, { "expr": "avg_over_time(fping_rtt{instance=~\"$host\",quantile=\"0.050\"}[$__interval])", "format": "time_series", + "interval": "", "intervalFactor": 1, - "legendFormat": "l5", + "legendFormat": "min", "refId": "W" }, { "expr": "avg_over_time(fping_lost_count{instance=~\"$host\"}[$__interval])/avg_over_time(fping_sent_count{instance=~\"$host\"}[$__interval])", "format": "time_series", + "interval": "", "intervalFactor": 1, "legendFormat": "% loss", "refId": "X" @@ -412,7 +668,7 @@ "timeFrom": null, "timeRegions": [], "timeShift": null, - "title": "Ping Latency [[host]]", + "title": "Ping Latency $host", "tooltip": { "shared": true, "sort": 2, @@ -437,6 +693,7 @@ "show": true }, { + "decimals": null, "format": "percentunit", "label": null, "logBase": 1, @@ -449,12 +706,221 @@ "align": true, "alignLevel": null } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 32 + }, + "id": 8, + "panels": [], + "repeat": null, + "title": "Availability Metrics", + "type": "row" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorPostfix": false, + "colorPrefix": false, + "colorValue": true, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "${DS_PROMETHEUS}", + "decimals": 2, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 33 + }, + "height": "100px", + "id": 10, + "interval": "1m", + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "maxPerRow": 6, + "nullPointMode": "connected", + "nullText": null, + "pluginVersion": "6.6.2", + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "repeat": "host", + "repeatDirection": "h", + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": true, + "lineColor": "rgb(31, 120, 193)", + "show": true, + "ymax": 100, + "ymin": 0 + }, + "tableColumn": "", + "targets": [ + { + "expr": "100 - avg_over_time(fping_lost_count{instance=~\"$host\"}[$__interval])/avg_over_time(fping_sent_count{instance=~\"$host\"}[$__interval]) * 100", + "format": "time_series", + "instant": false, + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": "95,99.9", + "title": "Uptime $host", + "transparent": true, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 36 + }, + "id": 14, + "panels": [], + "title": "Ping Metrics", + "type": "row" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": [ + "rgba(50, 172, 45, 0.97)", + "rgba(237, 129, 40, 0.89)", + "rgba(245, 54, 54, 0.9)" + ], + "datasource": "${DS_PROMETHEUS}", + "format": "s", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 37 + }, + "height": "100px", + "id": 16, + "interval": "1m", + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "maxPerRow": 6, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "repeat": "host", + "repeatDirection": "h", + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": true, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "avg_over_time(fping_rtt{instance=~\"$host\",quantile=\"0.500\"}[$__interval])", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": "50,100", + "title": "Ping $host", + "transparent": true, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" } ], "refresh": false, - "schemaVersion": 18, + "schemaVersion": 22, "style": "dark", - "tags": [], + "tags": [ + "Prometheus" + ], "templating": { "list": [ { @@ -464,6 +930,7 @@ "definition": "label_values(fping_rtt_count, instance)", "hide": 0, "includeAll": true, + "index": -1, "label": null, "multi": true, "name": "host", @@ -482,7 +949,7 @@ ] }, "time": { - "from": "now-2d", + "from": "now-24h", "to": "now" }, "timepicker": { @@ -513,5 +980,8 @@ "timezone": "", "title": "fping", "uid": "exQs214Wk", - "version": 21 + "variables": { + "list": [] + }, + "version": 11 }