2025-01-12 21:00:25 +01:00
|
|
|
# Formatting metrics in main & secondarystat. Supported: "english", "french", "german", "ukrainian", "chinese", "arabic"
|
|
|
|
language: 'english'
|
|
|
|
|
2025-01-12 14:59:32 +01:00
|
|
|
# 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
|
2025-01-12 21:00:25 +01:00
|
|
|
- name: node_cpu_metric_over_80
|
|
|
|
type: query
|
|
|
|
address: 'http://prometheus.local.lan:9090'
|
|
|
|
# Return 1 if cpu rate > 80%
|
|
|
|
query: '(sum(rate(node_cpu_seconds_total{instance="router01.local.lan:9100",job="node",mode!~"idle"}[30s]))*100) > bool 80'
|
|
|
|
timeout: 10
|
2025-01-12 14:59:32 +01:00
|
|
|
- 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
|
2025-01-12 21:00:25 +01:00
|
|
|
- name: router01_net_down_rate_perten
|
|
|
|
type: query
|
2025-01-12 21:15:31 +01:00
|
|
|
address: 'http://prometheus.local.lan:9090'
|
2025-01-12 21:00:25 +01:00
|
|
|
query: 'rate(node_network_receive_bytes_total{device="igb0", instance="router01.local.lan:9100", job="node"}[30s])/62500000*10'
|
|
|
|
timeout: 10
|
2025-01-12 14:59:32 +01:00
|
|
|
|
|
|
|
# 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
|
2025-01-12 21:00:25 +01:00
|
|
|
#
|
|
|
|
# Dynamic fields :
|
|
|
|
# nodes:
|
|
|
|
# - mainstat : use mainstatquery and mainstatformat. mainstatquery should return a metric, mainstatformat is a printf format specifier.
|
|
|
|
# - secondarystat : use secondarystatquery and secondarystatformat. same as mainstat(query|format).
|
|
|
|
# - hightlighted : use highlightedquery. if result return > 0, item will be highligthed.
|
|
|
|
# edges:
|
|
|
|
# - same list as nodes.
|
|
|
|
# - thickness: use thicknessquery.
|
2025-01-12 14:59:32 +01:00
|
|
|
graphs:
|
|
|
|
- name: internet
|
|
|
|
nodes:
|
2025-01-12 21:00:25 +01:00
|
|
|
- name: host01
|
|
|
|
id: host01
|
|
|
|
title: host01
|
|
|
|
subtitle: "A workstation"
|
|
|
|
color: "green"
|
|
|
|
# icon come from https://developers.grafana.com/ui/latest/index.html?path=/story/docs-overview-icon--icons-overview
|
|
|
|
icon: "user"
|
2025-01-12 14:59:32 +01:00
|
|
|
- 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'
|
2025-01-12 21:00:25 +01:00
|
|
|
# highlight router if cpu > 80%
|
|
|
|
highlightedquery: '{{ node_cpu_metric_over_80 }}'
|
|
|
|
- name: internet
|
|
|
|
id: internet
|
|
|
|
title: "internet"
|
|
|
|
subtitle: "The internets"
|
|
|
|
color: "grey"
|
|
|
|
icon: "globe"
|
2025-01-12 14:59:32 +01:00
|
|
|
edges:
|
|
|
|
- id: edge0
|
2025-01-12 21:00:25 +01:00
|
|
|
source: host01
|
2025-01-12 14:59:32 +01:00
|
|
|
target: router01
|
2025-01-12 21:00:25 +01:00
|
|
|
mainstatquery: '{{ router01_lan_down_rate }}'
|
2025-01-12 21:10:59 +01:00
|
|
|
mainstatformat: 'up %0.0f Bps'
|
2025-01-12 21:00:25 +01:00
|
|
|
secondarystatquery: '{{ router01_lan_up_rate }}'
|
|
|
|
secondarystatformat: 'down %0.0f Bps'
|
2025-01-12 14:59:32 +01:00
|
|
|
- id: edge1
|
|
|
|
source: router01
|
|
|
|
target: host01
|
|
|
|
mainstatquery: '{{ router01_lan_down_rate }}'
|
2025-01-12 21:10:59 +01:00
|
|
|
mainstatformat: 'up %0.0f Bps'
|
2025-01-12 14:59:32 +01:00
|
|
|
secondarystatquery: '{{ router01_lan_up_rate }}'
|
2025-01-12 21:00:25 +01:00
|
|
|
secondarystatformat: 'down %0.0f Bps'
|
|
|
|
thicknessquery: '{{ router01_net_down_rate_perten }}'
|
|
|
|
- id: edge2
|
|
|
|
source: router01
|
|
|
|
target: internet
|
|
|
|
mainstatquery: '{{ router01_net_up_rate }}'
|
2025-01-12 21:10:59 +01:00
|
|
|
mainstatformat: 'up %0.0f Bps'
|
2025-01-12 21:00:25 +01:00
|
|
|
secondarystatquery: '{{ router01_net_down_rate }}'
|
|
|
|
secondarystatformat: 'down %0.0f Bps'
|
2025-01-12 14:59:32 +01:00
|
|
|
- id: edge3
|
2025-01-12 21:00:25 +01:00
|
|
|
source: internet
|
2025-01-12 14:59:32 +01:00
|
|
|
target: router01
|
2025-01-12 21:00:25 +01:00
|
|
|
mainstatquery: '{{ router01_net_up_rate }}'
|
2025-01-12 21:10:59 +01:00
|
|
|
mainstatformat: 'up %0.0f Bps'
|
2025-01-12 21:00:25 +01:00
|
|
|
secondarystatquery: '{{ router01_net_down_rate }}'
|
|
|
|
secondarystatformat: 'down %0.0f Bps'
|
|
|
|
thicknessquery: '{{ router01_net_down_rate_perten }}'
|
2025-01-12 14:59:32 +01:00
|
|
|
|