diff --git a/docker-compose.yml b/docker-compose.yml index 71ceca3..c0d4cb9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,8 @@ services: GF_INSTALL_PLUGINS: "grafana-piechart-panel" ports: - "3000:3000" + grafana_config: + build: ./grafana_config selenium_grid_exporter: build: . command: "--scrape-uri http://hub:4444" diff --git a/grafana_config/Dockerfile b/grafana_config/Dockerfile new file mode 100644 index 0000000..3014a19 --- /dev/null +++ b/grafana_config/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.6 + +WORKDIR /grafana_config +COPY . . + +RUN apk add --no-cache curl +RUN chmod +x /grafana_config/wait.sh + +ENTRYPOINT ["/grafana_config/wait.sh"] diff --git a/grafana_config/prometheus_datasource.json b/grafana_config/prometheus_datasource.json new file mode 100644 index 0000000..2eb9297 --- /dev/null +++ b/grafana_config/prometheus_datasource.json @@ -0,0 +1,7 @@ +{ + "name":"prometheus", + "type":"prometheus", + "url":"http://prometheus:9090", + "access":"proxy", + "basicAuth":false +} diff --git a/grafana_config/selenium_grid_dashboard.json b/grafana_config/selenium_grid_dashboard.json new file mode 100644 index 0000000..c71ef1f --- /dev/null +++ b/grafana_config/selenium_grid_dashboard.json @@ -0,0 +1,150 @@ +{ + "dashboard": { + "annotations": { + "list": [] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "hideControls": false, + "id": null, + "links": [], + "rows": [ + { + "collapse": false, + "height": "250px", + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "prometheus", + "fill": 1, + "id": 1, + "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", + "seriesOverrides": [], + "spaceLength": 10, + "span": 12, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "selenium_grid_hub_slotsTotal", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "Total", + "refId": "A", + "step": 2 + }, + { + "expr": "selenium_grid_hub_slotsFree", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "Free", + "refId": "B", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Slots", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] + } + ], + "repeat": null, + "repeatIteration": null, + "repeatRowId": null, + "showTitle": false, + "title": "Dashboard Row", + "titleSize": "h6" + } + ], + "schemaVersion": 14, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-5m", + "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": "", + "title": "Selenium Grid", + "version": 1 + } +} \ No newline at end of file diff --git a/grafana_config/wait.sh b/grafana_config/wait.sh new file mode 100644 index 0000000..4752d3e --- /dev/null +++ b/grafana_config/wait.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +while ! curl --output /dev/null --silent --head --fail http://grafana:3000; do sleep 1 && echo -n .; done; + +curl -v -H "Content-Type: application/json" -X POST -d @prometheus_datasource.json http://grafana:3000/api/datasources + +curl -v -H "Content-Type: application/json" -X POST -d @selenium_grid_dashboard.json http://grafana:3000/api/dashboards/db