nodegopher/config.yaml.sample

131 lines
5.5 KiB
Plaintext

# Formatting metrics in main & secondarystat. Supported: "english", "french", "german", "ukrainian", "chinese", "arabic"
language: 'english'
# 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: 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
- 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
- name: router01_net_down_rate_perten
type: query
address: 'http://prometheus.moon.lan:9090'
query: 'rate(node_network_receive_bytes_total{device="igb0", instance="router01.local.lan:9100", job="node"}[30s])/62500000*10'
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
#
# 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.
graphs:
- name: internet
nodes:
- 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"
- 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'
# highlight router if cpu > 80%
highlightedquery: '{{ node_cpu_metric_over_80 }}'
- name: internet
id: internet
title: "internet"
subtitle: "The internets"
color: "grey"
icon: "globe"
edges:
- id: edge0
source: host01
target: router01
mainstatquery: '{{ router01_lan_down_rate }}'
mainstatformat: 'up %0.0f bps'
secondarystatquery: '{{ router01_lan_up_rate }}'
secondarystatformat: 'down %0.0f Bps'
- id: edge1
source: router01
target: host01
mainstatquery: '{{ router01_lan_down_rate }}'
mainstatformat: 'up %0.0f bps'
secondarystatquery: '{{ router01_lan_up_rate }}'
secondarystatformat: 'down %0.0f Bps'
thicknessquery: '{{ router01_net_down_rate_perten }}'
- id: edge2
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: edge3
source: internet
target: router01
mainstatquery: '{{ router01_net_up_rate }}'
mainstatformat: 'up %0.0f bps'
secondarystatquery: '{{ router01_net_down_rate }}'
secondarystatformat: 'down %0.0f Bps'
thicknessquery: '{{ router01_net_down_rate_perten }}'