diff --git a/README.md b/README.md index 871cfcf..d9d3454 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,68 @@ -[![Build Status](https://travis-ci.org/vegasbrianc/github-monitoring.svg?branch=master)](https://travis-ci.org/vegasbrianc/github-monitoring) -# A Docker Stack which Monitors your GitHub Repos -Here's a quick start to stand-up a Docker [Prometheus](http://prometheus.io/) stack containing Prometheus, Grafana and [github-exporter](https://github.com/infinityworksltd/github-exporter) to collect and graph GitHub statistics. +NOTE: For some reason this repository stays super popular even though I stopped using and maintaing it (missed notifications) - thus I'm going to mark this as archived to not unnecessarily mislead. If you made a fork that is better and more maintained please let me know and I'll link to it in the project description/issues. + +# A Docker Stack which Monitors your home network +Here's a quick start to stand-up a Docker [Prometheus](http://prometheus.io/) stack containing Prometheus, Grafana with [blackbox-exporter](https://github.com/prometheus/blackbox_exporter) and [speedtest-exporter](https://github.com/stefanwalther/speedtest-exporter) to collect and graph home network connections and speed. ## Pre-requisites -Before we get started installing the Prometheus stack. Ensure you install the latest version of docker and [docker-compose](https://docs.docker.com/compose/install/) on your Docker host machine. This has also been tested with Docker for Mac and it works well. +Before we get started installing the Prometheus stack. Ensure you install the latest version of docker and [docker-compose](https://docs.docker.com/compose/install/) on your Docker host machine. This has been tested with Docker for Mac and Synology and it works. -## Installation -Clone the project to your Docker host. +# Quick Start -If you would like to change which targets should be monitored or make configuration changes edit the [/prometheus/prometheus.yml](https://github.com/vegasbrianc/prometheus/blob/version-2/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. +If on Mac run this: -## Configuration -In order to pull GitHub stats consistently it is recommended you create a personal access token inside of GitHub. This token will allow you to query the GitHub API more frequently than a public user. [Create GitHub Token](https://github.com/settings/tokens). It is only necessary to give the repo scope to the token permission. +``` +git clone https://github.com/maxandersen/internet-monitoring && cd internet-monitoring/prometheus && docker-compose up && open http://localhost:3030/d/o9mIe_Aik/internet-connection +``` -
+otherwise: -Copy the GitHub Token you created and paste into the bottom of the [docker-compose.yml](https://github.com/vegasbrianc/github-monitoring/blob/master/docker-compose.yml) file under the metrics service section replacing the `GITHUB_TOKEN` with your newly created token. +``` +git clone https://github.com/maxandersen/internet-monitoring +cd internet-monitoring/prometheus +docker-compose up +``` -The REPOS variable can also be updated to point to the Repos that you wish to monitor. In my example I monitor freeCodeCamp and Docker. +Goto [http://localhost:3030/d/o9mIe_Aik/internet-connection](http://localhost:3030/d/o9mIe_Aik/internet-connection) (change `localhost` to your docker host ip/name). - metrics: - tty: true - stdin_open: true - expose: - - 9171 - image: infinityworks/github-exporter:latest - environment: - - REPOS=freeCodeCamp/freeCodeCamp, docker/docker - - GITHUB_TOKEN= - networks: - - back-tier +## Configuration +To change what hosts you ping you change the `targets` section in [/prometheus/pinghosts.yaml](./prometheus/pinghosts.yaml) 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). Once configurations are done let's start it up. From the /prometheus project directory run the following command: $ docker-compose up -d - That's it. docker-compose builds the entire Grafana and Prometheus stack automagically. -The Grafana Dashboard is now accessible via: `http://:3000` for example http://192.168.10.1:3000 +The Grafana Dashboard is now accessible via: `http://:3030` for example http://localhost:3030 username - admin -password - foobar (Password is stored in the `config.monitoring` env file) +password - wonka (Password is stored in the `config.monitoring` env file) + +The DataSource and Dashboard for Grafana are automatically provisioned. + +If all works it should be available at http://localhost:3030/d/o9mIe_Aik/internet-connection - if no data shows up try change the timeduration to something smaller. + +
+ +## Interesting urls + +Note: replace `localhost` with your docker host ip/name if not running this locally. -The DataSource and Dashboard for Grafana are automatically provisioned. You can still install the dashboard manually if you choose below. +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. -## Manual Install Dashboard -I created a Dashboard template which is available on [GitHub Stats Dashboard](https://grafana.net/dashboards/1559). Simply download the dashboard and select from the Grafana menu -> Dashboards -> Import +http://localhost:9696/metrics speedtest exporter endpoint. Does take ~30 seconds to show its result as it runs an actual speedtest when requested. -This dashboard is intended to help you get started with graphing your GitHub Repos. If you have any changes you would like to see in the Dashboard let me know so I can update Grafana site as well. +## Thanks and a disclaimer +Thanks to @vegasbrianc work on making a [super easy docker](https://github.com/vegasbrianc/github-monitoring) stack for running prometheus and grafana. -
+I also want to disclaim that Prometheus aren't really (currently) intended for this kind of blackbox/external monitoring and this setup is not in anyway secured. Thus only use this for inspiration and do not blame me if someone hacks this and figure out what your real internet sped is :) -## 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. diff --git a/blackbox/config/blackbox.yml b/blackbox/config/blackbox.yml new file mode 100644 index 0000000..4efb434 --- /dev/null +++ b/blackbox/config/blackbox.yml @@ -0,0 +1,35 @@ +modules: + http_2xx: + prober: http + http: + preferred_ip_protocol: "ip4" + http_post_2xx: + prober: http + http: + method: POST + tcp_connect: + prober: tcp + pop3s_banner: + prober: tcp + tcp: + query_response: + - expect: "^+OK" + tls: true + tls_config: + insecure_skip_verify: false + ssh_banner: + prober: tcp + tcp: + query_response: + - expect: "^SSH-2.0-" + irc_banner: + prober: tcp + tcp: + query_response: + - send: "NICK prober" + - send: "USER prober prober prober :prober" + - expect: "PING :([^ ]+)" + send: "PONG ${1}" + - expect: "^:[^ ]+ 001" + icmp: + prober: icmp \ No newline at end of file diff --git a/config.monitoring b/config.monitoring deleted file mode 100644 index f12466b..0000000 --- a/config.monitoring +++ /dev/null @@ -1,2 +0,0 @@ -GF_SECURITY_ADMIN_PASSWORD=foobar -GF_USERS_ALLOW_SIGN_UP=false diff --git a/docker-compose.yml b/docker-compose.yml index d1084d7..4788e75 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,35 +22,80 @@ services: ports: - 9090:9090 links: - - metrics:metrics + - ping:ping + - speedtest:speedtest networks: - back-tier grafana: image: grafana/grafana - depends_on: - - prometheus - ports: - - 3000:3000 volumes: - grafana_data:/var/lib/grafana - ./grafana/provisioning/:/etc/grafana/provisioning/ + depends_on: + - prometheus + ports: + - 3030:3000 env_file: - ./grafana/config.monitoring networks: - back-tier - front-tier - metrics: + ping: tty: true stdin_open: true expose: - - 9171 + - 9115 ports: - - 9171:9171 - image: infinityworks/github-exporter:latest - environment: - - REPOS=freeCodeCamp/freeCodeCamp, docker/docker - - GITHUB_TOKEN= + - 9115:9115 + image: prom/blackbox-exporter + volumes: + - ./blackbox/config:/config + command: + - '--config.file=/config/blackbox.yml' networks: - back-tier + + speedtest: + tty: true + stdin_open: true + expose: + - 9696 + ports: + - 9696:9696 + image: stefanwalther/speedtest-exporter + restart: always + networks: + - back-tier + + sonos: + tty: true + stdin_open: true + expose: + - 1915 + ports: + - 1915:1915 + image: maxandersen/sonos_exporter + command: + - '--address=0.0.0.0:1915' + network_mode: host + + nodeexp: + privileged: true + image: prom/node-exporter + volumes: + - /proc:/host/proc:ro + - /sys:/host/sys:ro + - /:/rootfs:ro + ports: + - 9100:9100 + restart: always + command: + - '--path.procfs=/host/proc' + - '--path.sysfs=/host/sys' + - --collector.filesystem.ignored-mount-points + - "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)" + networks: + - back-tier + diff --git a/grafana/config.monitoring b/grafana/config.monitoring index f12466b..d93ec5c 100644 --- a/grafana/config.monitoring +++ b/grafana/config.monitoring @@ -1,2 +1,3 @@ -GF_SECURITY_ADMIN_PASSWORD=foobar +GF_SECURITY_ADMIN_PASSWORD=wonka GF_USERS_ALLOW_SIGN_UP=false + GF_INSTALL_PLUGINS=flant-statusmap-panel diff --git a/grafana/provisioning/dashboards/github-stats_rev2.json b/grafana/provisioning/dashboards/github-stats_rev2.json deleted file mode 100644 index f188239..0000000 --- a/grafana/provisioning/dashboards/github-stats_rev2.json +++ /dev/null @@ -1,593 +0,0 @@ -{ - "__inputs": [ - { - "name": "prometheus", - "label": "Prometheus", - "description": "Standard Prometheus datasource", - "type": "datasource", - "pluginId": "prometheus", - "pluginName": "Prometheus" - } - ], - "__requires": [ - { - "type": "panel", - "id": "graph", - "name": "Graph", - "version": "" - }, - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "4.0.2" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - } - ], - "id": null, - "title": "GitHub Stats", - "tags": [], - "style": "dark", - "timezone": "browser", - "editable": true, - "sharedCrosshair": false, - "hideControls": false, - "time": { - "from": "now-3h", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "templating": { - "list": [] - }, - "annotations": { - "list": [] - }, - "schemaVersion": 13, - "version": 6, - "links": [], - "gnetId": 1559, - "rows": [ - { - "title": "Dashboard Row", - "panels": [ - { - "aliasColors": { - "stars": "#1F78C1" - }, - "bars": false, - "datasource": "prometheus", - "editable": true, - "error": false, - "fill": 1, - "id": 1, - "legend": { - "avg": false, - "current": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": true, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "stars", - "yaxis": 1 - } - ], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_stars{repo=\"docker\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{stars}}", - "metric": "github_repo_stars", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Docker Stars", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": { - "Docker Open Issues": "#C15C17", - "Open Issues": "#C15C17" - }, - "bars": false, - "datasource": "prometheus", - "editable": true, - "error": false, - "fill": 4, - "id": 2, - "legend": { - "avg": false, - "current": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": true, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_open_issues{repo=\"docker\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{Open Issues}}", - "metric": "github_repo_open_issues", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Docker Open Issues", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "decimals": null - }, - { - "aliasColors": { - "Forks": "#F9BA8F" - }, - "bars": false, - "datasource": "prometheus", - "editable": true, - "error": false, - "fill": 1, - "id": 3, - "legend": { - "avg": false, - "current": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": true, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_forks{repo=\"docker\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{Forks}}", - "metric": "github_repo_forks", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Docker Forks", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "decimals": null - } - ], - "showTitle": false, - "titleSize": "h6", - "height": "250px", - "repeat": null, - "repeatRowId": null, - "repeatIteration": null, - "collapse": false - }, - { - "title": "Dashboard Row", - "panels": [ - { - "aliasColors": { - "stars": "#E5A8E2" - }, - "bars": false, - "datasource": "prometheus", - "decimals": 3, - "editable": true, - "error": false, - "fill": 1, - "id": 4, - "legend": { - "avg": false, - "current": true, - "hideEmpty": false, - "hideZero": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": true, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "stars", - "yaxis": 1 - } - ], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_stars{repo=\"freeCodeCamp\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{stars}}", - "metric": "github_repo_stars", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "freeCodeCamp Stars", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": { - "Docker Open Issues": "#C15C17", - "Open Issues": "#BF1B00" - }, - "bars": false, - "datasource": "prometheus", - "editable": true, - "error": false, - "fill": 3, - "id": 5, - "legend": { - "avg": false, - "current": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 3, - "points": true, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_open_issues{repo=\"freeCodeCamp\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{Open Issues}}", - "metric": "github_repo_open_issues", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "freeCodeCamp Open Issues", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "decimals": -1 - }, - { - "aliasColors": { - "Forks": "#F9BA8F" - }, - "bars": false, - "datasource": "prometheus", - "decimals": 3, - "editable": true, - "error": false, - "fill": 1, - "id": 6, - "legend": { - "avg": false, - "current": true, - "max": false, - "min": false, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": true, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "github_repo_forks{repo=\"freeCodeCamp\"}", - "interval": "5m", - "intervalFactor": 2, - "legendFormat": "{{Forks}}", - "metric": "github_repo_forks", - "refId": "A", - "step": 600 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "FreecodeCamp Forks", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "showTitle": false, - "titleSize": "h6", - "height": 250, - "repeat": null, - "repeatRowId": null, - "repeatIteration": null, - "collapse": false - } - ], - "description": "A docker stack which uses Grafana to collect GitHub statistics for selected Repositories" -} diff --git a/grafana/provisioning/dashboards/ping-speed-stats.json b/grafana/provisioning/dashboards/ping-speed-stats.json new file mode 100644 index 0000000..8c59250 --- /dev/null +++ b/grafana/provisioning/dashboards/ping-speed-stats.json @@ -0,0 +1,540 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "limit": 100, + "name": "Annotations & Alerts", + "showIn": 0, + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "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, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "fill": 1, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "speedtest_bits_per_second{}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{direction}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "speedtest", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "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, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "fill": 1, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "minSpan": 2, + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": "host", + "repeatDirection": "h", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(probe_http_duration_seconds) by (instance)", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "http duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "schemaVersion": 16, + "style": "dark", + "tags": [ + "speedtest", + "ping" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "internet connection", + "uid": "o9mIe_Aik", + "version": 8 +} \ No newline at end of file diff --git a/images/Grafana_Add_Data_Source.png b/images/Grafana_Add_Data_Source.png deleted file mode 100644 index 6204c25..0000000 Binary files a/images/Grafana_Add_Data_Source.png and /dev/null differ diff --git a/images/Import_Dashboard.png b/images/Import_Dashboard.png deleted file mode 100644 index 06824de..0000000 Binary files a/images/Import_Dashboard.png and /dev/null differ diff --git a/images/dashboard.png b/images/dashboard.png index b7339cc..7c19e08 100644 Binary files a/images/dashboard.png and b/images/dashboard.png differ diff --git a/images/github_token.png b/images/github_token.png deleted file mode 100644 index 5ed51b4..0000000 Binary files a/images/github_token.png and /dev/null differ diff --git a/prometheus/pinghosts.yaml b/prometheus/pinghosts.yaml new file mode 100644 index 0000000..0a9b837 --- /dev/null +++ b/prometheus/pinghosts.yaml @@ -0,0 +1,8 @@ +- targets: # url;humanname;routing;switch + - http://google.com;google.com;external;internetbox + - http://github.com;github.com;external;internetbox + - https://blackdata.xam.dk:5001;blackdata.xam.dk;external;internetbox + - http://192.168.1.1;internetbox;local;internetbox + - http://192.168.1.42;blackdata;local;orbirouter-attic + - http://192.168.1.101;orbirouter;local;orbirouter + diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index ae6ffd7..43a94bd 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -28,10 +28,49 @@ scrape_configs: - targets: ['localhost:9090'] - - job_name: 'metrics' + - job_name: 'speedtest' + metrics_path: /metrics + scrape_interval: 15m + scrape_timeout: 60s # running speedtest needs time to complete + + static_configs: + - targets: ['speedtest:9696'] - # Override the global default and scrape targets from this job every 5 seconds. + - job_name: 'ping' + metrics_path: /probe scrape_interval: 5s + params: + module: [http_2xx] # Look for a HTTP 200 response. + file_sd_configs: + - files: + - pinghosts.yaml + relabel_configs: + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #first is the url, thus unique for instance + target_label: instance + replacement: $1 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #second is humanname to use in charts + target_label: humanname + replacement: $2 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #third state whether this is testing external or internal network + target_label: routing + replacement: $3 + - source_labels: [__address__] + regex: '(.*);(.*);(.*);(.*)' #fourth is which switch/router the device is connected to. + target_label: switching + replacement: $4 + - source_labels: [instance] + target_label: __param_target + - target_label: __address__ + replacement: ping:9115 # The blackbox exporter's real hostname:port. + + - job_name: 'nodeexp' + static_configs: + - targets: ['nodeexp:9100'] + - job_name: 'sonos' static_configs: - - targets: ['metrics:9171'] + - targets: ['192.168.1.42:1915'] + \ No newline at end of file