-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite.example.yml
More file actions
182 lines (168 loc) · 7.6 KB
/
Copy pathsite.example.yml
File metadata and controls
182 lines (168 loc) · 7.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# A worked config for --config. Draws every graph below over MRTG's four
# timescales, writes the pages that present them, and redraws on a timer.
#
# prometheus-render --config site.example.yml
source:
url: http://localhost:9090
timeout: 30s
# VictoriaMetrics: http://vmselect:8481/select/0/prometheus
# user: alice:secret
# headers:
# X-Scope-OrgID: tenant-a
# insecure: false
# How many queries may be in flight at once. Drawing fans out over every
# graph, region and timescale together, and without a bound that arrives at
# the source as one burst.
max_queries: 8
# How often this source scrapes -- prometheus.yml calls it scrape_interval.
# It is what $step below is measured against: rate() needs two samples to
# report anything, so no window may be shorter than twice this, and the
# finest timescale takes its peaks there. Omit it and none of that applies.
resolution: 15s
# How many points this source will walk for one subquery per series --
# VictoriaMetrics spells it -search.maxPointsSubqueryPerTimeseries, and
# 100000 is its default. A peak step fine enough to pass it is refused while
# this file is read rather than failing hours later on a graph nobody is
# watching. Raising it here is only half of it: raise it at the source too.
#
# Worth raising to peak at the source's resolution over a long timescale,
# where the ladder runs out of room. What crosses the wire is one point per
# plot column either way -- the cost is the source walking the samples.
# max_subquery_points: 1200000
output:
dir: site
title: Network
# Serve the pages as well as writing them. Leave empty to only write the
# files, for nginx or any other static server to pick up. Nothing served
# accepts a query: what is published is what is drawn below.
listen: ":8080"
# Redraw on this interval. 0 draws once and exits, which is what cron wants.
interval: 5m
# Images drawn at once. 0 means one worker per CPU.
workers: 0
# Splitting the site by a label makes it readable both ways round: everything
# about one place, or one thing across every place. Remove this block for a
# single flat list of graphs.
regions:
# The label to split on. It also names the placeholder the queries use, so
# splitting by "region" means writing $region below.
label: region
# Restrict discovery to these series. Without it, every value of the label
# is used.
match: '{job="nginx"}'
# What each region is called. The name is what appears on the pages, in the
# URLs and on the drawings themselves; the label value stays in the query,
# where the source knows it. A value not listed keeps its own name.
#
# Because it becomes a path segment, a name is letters, digits, dot, dash or
# underscore -- anything else is refused at load rather than quietly turned
# into something else in the URL.
titles:
tnn: core-tnn1
tyo: core-tyo1
# Inherited by every graph below; any graph may override any of it.
defaults:
theme: mrtg
# The page carries a light/dark switch. Both are drawn from the same
# samples, so the second palette costs no extra query.
dark_theme: dark
width: 500
height: 150
area: first
zoom: 2
tz: Asia/Taipei
# MRTG's peak traces: a second line per series showing the highest value in
# each bucket rather than the mean, drawn behind the averages so it shows
# only where it rises above them. The page offers it as a button.
peak: true
# Each timescale peaks at the resolution of the one below it, so the yearly
# graph peaks at the monthly graph's, and the finest one peaks at two scrapes
# of source.resolution. Set peak_step on a range to override.
# MRTG's four timescales. Omit this key to get exactly these.
#
# A step is also what $step expands to in the queries below, so one line of
# config is read at the resolution it is drawn at: the daily graph asks for
# rate(x[5m]) where the yearly one asks for rate(x[1d]). A window written out
# as a constant instead would flatten all four -- a five-second burst read
# through rate(x[5m]) arrives sixty times smaller than it was.
#
# A step is also how often the timescale is redrawn, since one plot column is
# one step wide: without every below, the yearly graph is left alone for a day
# at a time rather than queried every five minutes for a picture whose newest
# column does not move until tomorrow. every says otherwise -- here, four
# looks a day at the one still filling in. It is rounded up to a whole
# multiple of output.interval, because a pass is the only moment anything is
# redrawn.
ranges:
- {name: 1d, title: "Daily (5 min average)", from: -1d, step: 5m}
- {name: 1w, title: "Weekly (30 min average)", from: -7d, step: 30m}
- {name: 1m, title: "Monthly (2 hour average)", from: -30d, step: 2h}
- {name: 1y, title: "Yearly (1 day average)", from: -365d, step: 1d, every: 6h}
graphs:
# name is used for the page and the image directory, so keep it path-safe.
- name: traffic
title: Traffic
vtitle: Mbps
series:
- expr: sum(rate(nginx_http_in_bytes_total{region="$region"}[$step])) * 8 / 1e6
legend: RX
- expr: sum(rate(nginx_http_bytes_total{region="$region"}[$step])) * 8 / 1e6
legend: TX
- name: pps
title: Packets
vtitle: packets/sec
series:
- expr: sum(rate(node_network_receive_packets_total{region="$region"}[$step]))
legend: RX
- expr: sum(rate(node_network_transmit_packets_total{region="$region"}[$step]))
legend: TX
- name: request
title: Requests
vtitle: req/sec
area: none
y_min: 0
# The graph people leave open, so every timescale of it refreshes on each
# pass instead of once per column. Keyed by range name, so one graph can
# say this without restating the whole ladder above.
every: {1w: 5m, 1m: 5m, 1y: 5m}
series:
- expr: sum(rate(nginx_http_requests_total{region="$region"}[$step]))
legend: requests
# The peak ladder runs out of budget at the long end: a year of
# ten-second samples is three million points per series, so the yearly
# graph peaks at the monthly graph's step and a short burst arrives
# flattened by it. A recording rule takes that maximum once, at the
# source's own resolution, and this reads it back whole:
#
# record: region:nginx_http_requests:peak30s
# expr: max_over_time(
# (sum by (region) (rate(nginx_http_requests_total[30s])))[5m:30s])
#
# $step is the bucket here, not the samples inside it -- what the rule
# holds is already a maximum, and a subquery over it would step past
# the maxima it exists to keep. peak_ranges leaves the fine end on the
# ladder, where it already reads at the source's own resolution.
peak_expr: max_over_time(region:nginx_http_requests:peak30s{region="$region"}[$step])
peak_ranges: [1w, 1m, 1y]
# A graph that exists in one place only. Without this it would be drawn for
# every region, and the ones with nothing to show would be left off the
# pages anyway -- but saying so avoids the queries.
- name: sensor
title: Sensor lag
vtitle: seconds
peak: false
y_min: 0
only_regions: [tnn] # the label value, or the name above
series:
- expr: palert_data_lag_seconds
legend: lag
# A graph that is not split at all: one drawing covering everywhere.
- name: total
title: All regions
vtitle: Mbps
global: true
series:
- expr: sum(rate(nginx_http_in_bytes_total[$step])) * 8 / 1e6
legend: RX
- expr: sum(rate(nginx_http_bytes_total[$step])) * 8 / 1e6
legend: TX