uncommitted grafana code

This commit is contained in:
Ryan Cavicchioni 2020-06-12 16:32:02 -05:00
parent 91d2fcbf27
commit 277a1bc569
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
4 changed files with 1167 additions and 133 deletions

View File

@ -28,6 +28,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "s",
"gauge": {
"maxValue": 100,
@ -59,7 +65,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -158,6 +163,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "s",
"gauge": {
"maxValue": 100,
@ -189,7 +200,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -288,6 +298,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "bps",
"gauge": {
"maxValue": 100,
@ -319,7 +335,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -430,6 +445,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "bps",
"gauge": {
"maxValue": 100,
@ -461,7 +482,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -572,6 +592,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "celsius",
"gauge": {
"maxValue": 100,
@ -603,7 +629,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -696,6 +721,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "fahrenheit",
"gauge": {
"maxValue": 100,
@ -727,7 +758,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -809,6 +839,335 @@
],
"valueName": "current"
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {},
"decimals": 1,
"mappings": [
{
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "fahrenheit"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 4
},
"hiddenSeries": false,
"id": 37,
"interval": null,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"maxDataPoints": 100,
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "7.0.0",
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "snmp",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"temperature\") * 9/5 + 32 FROM \"snmp\" WHERE (\"agent_host\" = '172.16.100.3') AND $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"temperature"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "agent_host",
"operator": "=",
"value": "172.16.100.3"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Switch Temperature (F)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:510",
"format": "fahrenheit",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:511",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {},
"decimals": 1,
"mappings": [
{
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "fahrenheit"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 4
},
"hiddenSeries": false,
"id": 38,
"interval": null,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"maxDataPoints": 100,
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "7.0.0",
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "snmp",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT max(\"temperature\") FROM \"snmp\" WHERE (\"agent_host\" = '172.16.100.3') AND $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"temperature"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "agent_host",
"operator": "=",
"value": "172.16.100.3"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Switch Temperature (C)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:453",
"format": "celsius",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:454",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"alert": {
"alertRuleTags": {},
@ -850,13 +1209,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 4
"y": 12
},
"hiddenSeries": false,
"id": 14,
@ -1150,13 +1515,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 4
"y": 12
},
"hiddenSeries": false,
"id": 29,
@ -1424,13 +1795,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 12
"y": 20
},
"hiddenSeries": false,
"id": 35,
@ -1681,13 +2058,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 12
"y": 20
},
"hiddenSeries": false,
"id": 36,
@ -1946,13 +2329,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 20
"y": 28
},
"hiddenSeries": false,
"id": 16,
@ -2191,13 +2580,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 20
"y": 28
},
"hiddenSeries": false,
"id": 30,
@ -2436,13 +2831,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 28
"y": 36
},
"hiddenSeries": false,
"id": 31,
@ -2681,13 +3082,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 28
"y": 36
},
"hiddenSeries": false,
"id": 32,
@ -2926,13 +3333,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 36
"y": 44
},
"hiddenSeries": false,
"id": 5,
@ -3115,13 +3528,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 36
"y": 44
},
"hiddenSeries": false,
"id": 10,
@ -3304,13 +3723,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 44
"y": 52
},
"hiddenSeries": false,
"id": 9,
@ -3493,13 +3918,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 44
"y": 52
},
"hiddenSeries": false,
"id": 11,
@ -3682,13 +4113,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 52
"y": 60
},
"hiddenSeries": false,
"id": 12,
@ -3871,13 +4308,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 52
"y": 60
},
"hiddenSeries": false,
"id": 33,
@ -4060,13 +4503,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 60
"y": 68
},
"hiddenSeries": false,
"id": 23,
@ -4243,13 +4692,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 60
"y": 68
},
"hiddenSeries": false,
"id": 18,
@ -4434,13 +4889,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 68
"y": 76
},
"hiddenSeries": false,
"id": 26,
@ -4617,13 +5078,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 68
"y": 76
},
"hiddenSeries": false,
"id": 24,
@ -4800,13 +5267,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 76
"y": 84
},
"hiddenSeries": false,
"id": 25,
@ -4983,13 +5456,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 76
"y": 84
},
"hiddenSeries": false,
"id": 27,
@ -5166,13 +5645,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 84
"y": 92
},
"hiddenSeries": false,
"id": 20,
@ -5349,13 +5834,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 84
"y": 92
},
"hiddenSeries": false,
"id": 21,
@ -5528,7 +6019,7 @@
}
],
"refresh": "5s",
"schemaVersion": 21,
"schemaVersion": 25,
"style": "dark",
"tags": [],
"templating": {
@ -5540,7 +6031,6 @@
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
@ -5555,5 +6045,5 @@
"timezone": "",
"title": "Home Networking",
"uid": "N0X50kOWk",
"version": 5
"version": 6
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ grafana_service_enabled: yes
grafana_etc_path: /etc/grafana
grafana_config_path: "{{ grafana_etc_path }}/grafana.ini"
grafana_provisioning_path: /etc/grafana/provisioning
grafana_domain: "stats.{{ ansible_domain }}"
grafana_port: 3002
@ -21,3 +22,38 @@ grafana_config:
root_url: "https://{{ grafana_domain }}"
http_addr: localhost
http_port: "{{ grafana_port }}"
grafana_ssl_enabled: yes
grafana_ssl_certificate: "/etc/letsencrypt/live/{{ grafana_domain }}/fullchain.pem"
grafana_ssl_certificate_key: "/etc/letsencrypt/live/{{ grafana_domain }}/privkey.pem"
#grafana_ssl_dhparam: "/etc/letsencrypt/ssl-dhparams.pem"
grafana_datasources:
apiVersion: 1
datasources:
- name: influxdb
type: influxdb
access: proxy
url: http://localhost:8086
database: telegraf
isDefault: yes
version: 1
grafana_dashboards:
apiVersion: 1
providers:
- name: ansible
folder: Built-in
type: file
options:
path: /var/lib/grafana/dashboards
grafana_dashboard_files:
- connectivity.json
- home-networking.json
- iptables.json
- nginx.json
- processes.json
- switching.json
- system.json
- ups.json

View File

@ -44,6 +44,39 @@
mode: 0640
notify: restart grafana
- name: provision datasources
copy:
dest: "{{ grafana_provisioning_path }}/datasources/datasource.yaml"
content: "{{ grafana_datasources | to_nice_yaml }}"
owner: root
group: "{{ grafana_group }}"
mode: 0640
- name: create dashboard directory
file:
path: /var/lib/grafana/dashboards
state: directory
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: 0755
- name: provision dashboards
copy:
dest: "{{ grafana_provisioning_path }}/dashboards/dashboards.yaml"
content: "{{ grafana_dashboards | to_nice_yaml }}"
owner: root
group: "{{ grafana_group }}"
mode: 0640
- name: upload user dashboards
copy:
src: "files/grafana/dashboards/{{ item }}"
dest: "/var/lib/grafana/dashboards/{{ item | basename }}"
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: 0644
loop: "{{ grafana_dashboard_files | default([]) }}"
- name: manage service
service:
name: "{{ grafana_service_name }}"