updated monitoring repo with latest Grafana provisioning tools for the datasource and dashboard

Signed-off-by: Brian Christner <brian.christner@gmail.com>
This commit is contained in:
Brian Christner 2018-03-08 10:21:08 +01:00
parent 4048c010b6
commit 912d8378b6
No known key found for this signature in database
GPG key ID: ECA21DC2A2758F38
6 changed files with 661 additions and 7 deletions

View file

@ -45,15 +45,12 @@ The Grafana Dashboard is now accessible via: `http://<Host IP Address>:3000` for
username - admin
password - foobar (Password is stored in the `config.monitoring` env file)
## Post Configuration
Now we need to create the Prometheus Datasource in order to connect Grafana to Prometheues
* Click the `Grafana` Menu at the top left corner (looks like a fireball)
* Click `Data Sources`
* Click the green button `Add Data Source`.
The DataSource and Dashboard for Grafana are automatically provisioned. You can still install the dashboaed manually if you choose below.
<center><img src="https://github.com/vegasbrianc/github-monitoring/blob/master/images/Grafana_Add_Data_Source.png" width="400" heighth="400"></center>
## Install Dashboard
## 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
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.

View file

@ -34,8 +34,9 @@ services:
- 3000:3000
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
env_file:
- config.monitoring
- ./grafana/config.monitoring
networks:
- back-tier
- front-tier

View file

@ -0,0 +1,2 @@
GF_SECURITY_ADMIN_PASSWORD=foobar
GF_USERS_ALLOW_SIGN_UP=false

View file

@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/provisioning/dashboards

View file

@ -0,0 +1,593 @@
{
"__inputs": [
{
"name": "DS_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": "${DS_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": "${DS_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": "${DS_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": "${DS_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": "${DS_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": "${DS_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"
}

View file

@ -0,0 +1,50 @@
# config file version
apiVersion: 1
# list of datasources that should be deleted from the database
deleteDatasources:
- name: Prometheus
orgId: 1
# list of datasources to insert/update depending
# whats available in the database
datasources:
# <string, required> name of the datasource. Required
- name: Prometheus
# <string, required> datasource type. Required
type: prometheus
# <string, required> access mode. direct or proxy. Required
access: proxy
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string> url
url: http://prometheus:9090
# <string> database password, if used
password:
# <string> database user, if used
user:
# <string> database name, if used
database:
# <bool> enable/disable basic auth
basicAuth: true
# <string> basic auth username
basicAuthUser: admin
# <string> basic auth password
basicAuthPassword: foobar
# <bool> enable/disable with credentials headers
withCredentials:
# <bool> mark as default datasource. Max one per org
isDefault:
# <map> fields that will be converted to json and stored in json_data
jsonData:
graphiteVersion: "1.1"
tlsAuth: false
tlsAuthWithCACert: false
# <string> json object of data that will be encrypted.
secureJsonData:
tlsCACert: "..."
tlsClientCert: "..."
tlsClientKey: "..."
version: 1
# <bool> allow users to edit datasources from the UI.
editable: true