diff --git a/README.md b/README.md index 6690ca6..7987ac2 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Clone the project to your Docker host. If you would like to change which targets should be monitored or make configuration changes edit the [/prometheus/prometheus.yml](./prometheus/prometheus.yml) file. The targets section is where you define what should be monitored by Prometheus. The names defined in this file are actually sourced from the service name in the docker-compose file. If you wish to change names of the services you can add the "container_name" parameter in the `docker-compose.yml` file. ## Configuration -To change what hosts you ping you change the `targets` section under `blackbox` in [/prometheus/prometheus.yml](./prometheus/prometheus.yml) file. +To change what hosts you ping you change the `targets` section in [/prometheus/pinghosts.yml](./prometheus/pinghosts.yml) file. For speedtest the only relevant configuration is how often you want the check to happen. It is at 5 minutes by default which might be too much if you have limit on downloads. This is changed by editing `scrape_interval` under `speedtest` in [/prometheus/prometheus.yml](./prometheus/prometheus.yml). @@ -41,3 +41,15 @@ This dashboard is intended to help you get started with graphing your GitHub Rep ## Troubleshooting It appears some people have reported no data appearing in Grafana. If this is happening to you be sure to check the time range being queried within Grafana to ensure it is using Today's date with current time. + +## Interesting urls + +http://localhost:9090/targets shows status of monitored targets as seen from prometheus - in this case which hosts being pinged and speedtest. note: speedtest will take a while before it shows as UP as it takes ~30s to respond. + +http://localhost:9090/graph?g0.expr=probe_http_status_code&g0.tab=1 shows prometheus value for `probe_http_status_code` for each host. You can edit/play with additional values. Useful to check everything is okey in prometheus (in case Grafana is not showing the data you expect). + +http://localhost:9115 blackbox exporter endpoint. Lets you see what have failed/succeded. + +http://localhost:9696/metrics speedtest exporter endpoint. Does take ~30 seconds to shohw its result as it runs an actual speedtest when requested. + + diff --git a/grafana/provisioning/dashboards/ping-speed-stats.json b/grafana/provisioning/dashboards/ping-speed-stats.json index db10aae..8c59250 100644 --- a/grafana/provisioning/dashboards/ping-speed-stats.json +++ b/grafana/provisioning/dashboards/ping-speed-stats.json @@ -1,34 +1,4 @@ { - "__inputs": [ - { - "name": "prometheus", - "label": "prometheus", - "description": "", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "5.2.4" - }, - { - "type": "panel", - "id": "graph", - "name": "Graph", - "version": "5.0.0" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "5.0.0" - } - ], "annotations": { "list": [ { @@ -37,7 +7,9 @@ "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", + "limit": 100, "name": "Annotations & Alerts", + "showIn": 0, "type": "dashboard" } ] @@ -45,10 +17,250 @@ "editable": true, "gnetId": null, "graphTooltip": 0, - "id": null, - "iteration": 1538410449101, "links": [], "panels": [ + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "prometheus", + "format": "none", + "gauge": { + "maxValue": 50, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 9, + "w": 6, + "x": 0, + "y": 0 + }, + "id": 8, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "speedtest_bits_per_second{direction=\"downstream\"}", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": "25,40", + "title": "Download", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "prometheus", + "format": "none", + "gauge": { + "maxValue": 20, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 9, + "w": 6, + "x": 6, + "y": 0 + }, + "id": 10, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "speedtest_bits_per_second{direction=\"upstream\"}", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": "5,10", + "title": "Upload", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#d44a3a", + "rgba(237, 129, 40, 0.89)", + "#299c46" + ], + "datasource": "prometheus", + "decimals": 2, + "format": "ms", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 12, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": true + }, + "tableColumn": "", + "targets": [ + { + "expr": "speedtest_ping", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": "", + "title": "speedtest ping", + "transparent": false, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, { "aliasColors": {}, "bars": false, @@ -60,7 +272,7 @@ "h": 9, "w": 12, "x": 0, - "y": 0 + "y": 9 }, "id": 6, "legend": { @@ -134,6 +346,67 @@ "alignLevel": null } }, + { + "cards": { + "cardMinWidth": 5, + "cardRound": null, + "cardSpacing": 2 + }, + "color": { + "cardColor": "#b4ff00", + "colorScale": "sqrt", + "colorScheme": "interpolateGnYlRd", + "defaultColor": "#757575", + "exponent": 0.5, + "mode": "spectrum", + "thresholds": [] + }, + "data": { + "decimals": null, + "unitFormat": "short" + }, + "datasource": "prometheus", + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 9 + }, + "highlightCards": true, + "id": 14, + "legend": { + "show": false + }, + "links": [], + "nullPointMode": "as empty", + "targets": [ + { + "expr": "probe_success", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "title": "Panel Title", + "tooltip": { + "show": true + }, + "type": "flant-statusmap-panel", + "useMax": true, + "xAxis": { + "labelFormat": "%a %m/%d", + "minBucketWidthToShowWeekends": 4, + "show": true, + "showCrosshair": true, + "showWeekends": true + }, + "yAxis": { + "show": true, + "showCrosshair": false + } + }, { "aliasColors": {}, "bars": false, @@ -145,7 +418,7 @@ "h": 9, "w": 24, "x": 0, - "y": 9 + "y": 18 }, "id": 4, "legend": { @@ -174,7 +447,7 @@ "steppedLine": false, "targets": [ { - "expr": "probe_success{}", + "expr": "sum(probe_http_duration_seconds) by (instance)", "format": "time_series", "intervalFactor": 1, "legendFormat": "{{instance}}", @@ -184,7 +457,7 @@ "thresholds": [], "timeFrom": null, "timeShift": null, - "title": "http reachable", + "title": "http duration", "tooltip": { "shared": true, "sort": 0, @@ -229,31 +502,10 @@ "ping" ], "templating": { - "list": [ - { - "allValue": null, - "current": {}, - "datasource": "prometheus", - "hide": 0, - "includeAll": true, - "label": "", - "multi": true, - "name": "instance", - "options": [], - "query": "label_values(probe_success,instance)", - "refresh": 1, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [], - "tagsQuery": "", - "type": "query", - "useTags": false - } - ] + "list": [] }, "time": { - "from": "now-7d", + "from": "now-24h", "to": "now" }, "timepicker": { @@ -283,5 +535,6 @@ }, "timezone": "browser", "title": "internet connection", - "version": 0 + "uid": "o9mIe_Aik", + "version": 8 } \ No newline at end of file diff --git a/prometheus/pinghosts.yaml b/prometheus/pinghosts.yaml new file mode 100644 index 0000000..6ae6342 --- /dev/null +++ b/prometheus/pinghosts.yaml @@ -0,0 +1,6 @@ +- targets: + - http://google.com # Target to probe with http. + - http://github.com + - https://blackdata.xam.dk:5001 # Target to probe with https. + - http://orbilogin.com + - http://192.168.1.103 \ No newline at end of file diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 6c54bf4..185e395 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -41,11 +41,9 @@ scrape_configs: scrape_interval: 5s params: module: [http_2xx] # Look for a HTTP 200 response. - static_configs: - - targets: - - http://google.com # Target to probe with http. - - https://blackdata.xam.dk:5001 # Target to probe with https. - - http://doesnotexistreally.com # Target to probe with http on port 8080. + file_sd_configs: + - files: + - pinghosts.yaml relabel_configs: - source_labels: [__address__] target_label: __param_target