104 lines
4.2 KiB
Plaintext
104 lines
4.2 KiB
Plaintext
|
# datasource describe a way to get prometheus metrics.
|
||
|
# Properties :
|
||
|
# - name: name of the query. To be used in edges or nodes mainstatquery or secondarystatquery. Result will be output in mainstat, or secondarystat.
|
||
|
# - address: the address of prometheus.
|
||
|
# - query: prometheus query. Same as typed in prometheus graph page.
|
||
|
# - type: type of query. "query" will get instant value, "query_range" will get all samples for the grafana period. Result will be averaged.
|
||
|
# - timeout: query timeout in seconds.
|
||
|
datasources:
|
||
|
- name: prom_samples_per_sec
|
||
|
type: query
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'rate(prometheus_tsdb_head_samples_appended_total{type="float"}[10m])'
|
||
|
timeout: 10
|
||
|
- name: node_cpu_metric
|
||
|
# Simple query, return an instant metric
|
||
|
type: query
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'sum(rate(node_cpu_seconds_total{instance="router01.local.lan:9100",job="node",mode!~"idle"}[30s]))*100'
|
||
|
timeout: 10
|
||
|
- name: router01_net_down_rate
|
||
|
# Range query. Return all metrics from a time range. Result will be averaged from these metrics. Time range will be provided by Grafana.
|
||
|
type: query_range
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'rate(node_network_receive_bytes_total{device="igb0", instance="router01.local.lan:9100", job="node"}[30s])'
|
||
|
timeout: 10
|
||
|
- name: router01_net_up_rate
|
||
|
type: query_range
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'rate(node_network_transmit_bytes_total{device="igb0", instance="router01.local.lan:9100", job="node"}[30s])'
|
||
|
timeout: 10
|
||
|
- name: router01_lan_down_rate
|
||
|
type: query_range
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'rate(node_network_receive_bytes_total{device="ix3", instance="router01.local.lan:9100", job="node"}[30s])'
|
||
|
timeout: 10
|
||
|
- name: router01_lan_up_rate
|
||
|
type: query_range
|
||
|
address: 'http://prometheus.local.lan:9090'
|
||
|
query: 'rate(node_network_transmit_bytes_total{device="ix3", instance="router01.local.lan:9100", job="node"}[30s])'
|
||
|
timeout: 10
|
||
|
|
||
|
# graphs identifies context for a nodegraph. You can have many contexts, and your grafana query will mention this context name.
|
||
|
# For this example named "internet", grafana URL will be :
|
||
|
# Edges: http://nodegopher.local.lan:8080/internet/edges?from=$__from&to=$__to&interval=$__interval
|
||
|
# Nodes: http://nodegopher.local.lan:8080/internet/nodes?from=$__from&to=$__to&interval=$__interval
|
||
|
# Properties :
|
||
|
# - name: name of the context
|
||
|
# - nodes: list of nodegraph nodes
|
||
|
# - edges: list of nodegraph edges
|
||
|
graphs:
|
||
|
- name: internet
|
||
|
nodes:
|
||
|
- name: internet
|
||
|
id: internet
|
||
|
title: "internet"
|
||
|
subtitle: "The internets"
|
||
|
color: "grey"
|
||
|
# icons come from https://developers.grafana.com/ui/latest/index.html?path=/story/docs-overview-icon--icons-overview
|
||
|
icon: "globe"
|
||
|
- name: router01
|
||
|
id: router01
|
||
|
title: router01
|
||
|
subtitle: "A router"
|
||
|
color: "blue"
|
||
|
mainstatquery: '{{ node_cpu_metric }}'
|
||
|
# Use %% if you want to display '%' in you metric label
|
||
|
mainstatformat: '%0.2f%% cpu'
|
||
|
- name: host01
|
||
|
id: host01
|
||
|
title: host01
|
||
|
subtitle: "A workstation"
|
||
|
color: "green"
|
||
|
icon: "user"
|
||
|
edges:
|
||
|
- id: edge0
|
||
|
source: internet
|
||
|
target: router01
|
||
|
mainstatquery: '{{ router01_net_up_rate }}'
|
||
|
mainstatformat: 'up %0.0f bps'
|
||
|
secondarystatquery: '{{ router01_net_down_rate }}'
|
||
|
secondarystatformat: 'down %0.0f bps'
|
||
|
- id: edge1
|
||
|
source: router01
|
||
|
target: internet
|
||
|
mainstatquery: '{{ router01_net_up_rate }}'
|
||
|
mainstatformat: 'up %0.0f bps'
|
||
|
secondarystatquery: '{{ router01_net_down_rate }}'
|
||
|
secondarystatformat: 'down %0.0f bps'
|
||
|
- id: edge2
|
||
|
source: router01
|
||
|
target: host01
|
||
|
mainstatquery: '{{ router01_lan_down_rate }}'
|
||
|
mainstatformat: 'up %0.0f bps'
|
||
|
secondarystatquery: '{{ router01_lan_up_rate }}'
|
||
|
secondarystatformat: 'down %0.0f bps'
|
||
|
- id: edge3
|
||
|
source: host01
|
||
|
target: router01
|
||
|
mainstatquery: '{{ router01_lan_down_rate }}'
|
||
|
mainstatformat: 'up %0.0f bps'
|
||
|
secondarystatquery: '{{ router01_lan_up_rate }}'
|
||
|
secondarystatformat: 'down %0.0f bps'
|
||
|
|