summaryrefslogtreecommitdiff
path: root/docs/configuration/service/monitoring.rst
blob: 0e4ddc611af2ccbebf5593d5cd5531ced0719ce6 (plain)
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
##########
Monitoring
##########

VyOS supports monitoring through Telegraf as well as through Prometheus exporters.

********
Telegraf
********

Telegraf is the open source server agent to help you collect metrics, events
and logs from your routers.

The following Telegraf plugins are configurable to export metrics and logs:
 * Azure Data Explorer
 * Prometheus Client
 * Splunk
 * InfluxDB
 * Loki


Azure data explorer
===================
Telegraf output plugin azure-data-explorer_.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer authentication client-id <client-id>

   Authentication application client-id.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer authentication client-secret <client-secret>

   Authentication application client-secret.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer authentication tenant-id <tenant-id>

   Authentication application tenant-id

.. cfgcmd:: set service monitoring telegraf azure-data-explorer database <name>

   Remote database name.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer group-metrics <single-table | table-per-metric>

   Type of metrics grouping when push to Azure Data Explorer. The default is
   ``table-per-metric``.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer table <name>

   Name of the single table Only if set group-metrics single-table.

.. cfgcmd:: set service monitoring telegraf azure-data-explorer url <url>

   Remote URL.


Prometheus client
=================
Telegraf output plugin prometheus-client_
This plugin allows export of Telegraf metrics to Prometheus,
for Prometheus native metrics through exporters see section below.

.. cfgcmd:: set service monitoring telegraf prometheus-client

   Output plugin Prometheus client

.. cfgcmd:: set service monitoring telegraf prometheus-client allow-from <prefix>

   Networks allowed to query this server

.. cfgcmd:: set service monitoring telegraf prometheus-client authentication username <username>

   HTTP basic authentication username

.. cfgcmd:: set service monitoring telegraf prometheus-client authentication password <password>

   HTTP basic authentication username

.. cfgcmd:: set service monitoring telegraf prometheus-client listen-address <address>

   Local IP addresses to listen on

.. cfgcmd:: set service monitoring telegraf prometheus-client metric-version <1 | 2>

   Metris version, the default is ``2``

.. cfgcmd:: set service monitoring telegraf prometheus-client port <port>

   Port number used by connection, default is ``9273``

Example:

.. code-block:: none

  set service monitoring telegraf prometheus-client

.. code-block:: none

  vyos@r14:~$ curl --silent localhost:9273/metrics | egrep -v "#" |  grep cpu_usage_system
  cpu_usage_system{cpu="cpu-total",host="r14"} 0.20040080160320556
  cpu_usage_system{cpu="cpu0",host="r14"} 0.17182130584191915
  cpu_usage_system{cpu="cpu1",host="r14"} 0.22896393817971655


Splunk
======
Telegraf output plugin splunk_ HTTP Event Collector.

.. cfgcmd:: set service monitoring telegraf splunk authentication insecure

   Use TLS but skip host validation

.. cfgcmd:: set service monitoring telegraf splunk authentication token <token>

   Authorization token

.. cfgcmd:: set service monitoring telegraf splunk authentication url <url>

   Remote URL to Splunk collector

Example:

.. code-block:: none

  set service monitoring telegraf splunk authentication insecure
  set service monitoring telegraf splunk authentication token 'xxxxf5b8-xxxx-452a-xxxx-43828911xxxx'
  set service monitoring telegraf splunk url 'https://192.0.2.10:8088/services/collector'


InfluxDB
========
Telegraf output plugin influxdb_ to write metrics to ``InfluxDB`` via HTTP.

.. cfgcmd:: set service monitoring telegraf influxdb authentication organization <organization>

   Authentication organization name

.. cfgcmd:: set service monitoring telegraf influxdb authentication token <token>

   Authentication token

.. cfgcmd:: set service monitoring telegraf bucket <bucket>

   Remote ``InfluxDB`` bucket name

.. cfgcmd:: set service monitoring telegraf influxdb port <port>

   Remote port

.. cfgcmd:: set service monitoring telegraf influxdb url <url>

   Remote URL


Example:

.. code-block:: none

  set service monitoring telegraf influxdb authentication organization 'vyos'
  set service monitoring telegraf influxdb authentication token 'ZAml9Uy5wrhA...=='
  set service monitoring telegraf influxdb bucket 'bucket_vyos'
  set service monitoring telegraf influxdb port '8086'
  set service monitoring telegraf influxdb url 'http://r1.influxdb2.local'


Loki
====

Telegraf can be used to send logs to loki_ using tags as labels.

.. cfgcmd:: set service monitoring telegraf loki port <port>

   Remote Loki port

   Default is 3100

.. cfgcmd:: set service monitoring telegraf loki url <url>

   Remote Loki url

.. cfgcmd:: set service monitoring telegraf loki authentication username <username>
.. cfgcmd:: set service monitoring telegraf loki authentication password <password>

   HTTP basic authentication.

   If either is set both must be set.

.. cfgcmd:: set service monitoring telegraf loki metric-name-label <label>

   Label to use for the metric name when sending metrics.

   If set to an empty string, the label will not be added.
   This is NOT recommended, as it makes it impossible to differentiate
   between multiple metrics.

.. _azure-data-explorer: https://github.com/influxdata/telegraf/tree/master/plugins/outputs/azure_data_explorer
.. _prometheus-client: https://github.com/influxdata/telegraf/tree/master/plugins/outputs/prometheus_client
.. _influxdb: https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb_v2
.. _splunk: https://www.splunk.com/en_us/blog/it/splunk-metrics-via-telegraf.html
.. _loki: https://github.com/influxdata/telegraf/tree/master/plugins/outputs/loki


**********
Prometheus
**********

The following Prometheus exporters are configurable to export metrics:
 * Node Exporter
 * FRR Exporter


Node Exporter
=============
Prometheus node_exporter_ which provides a wide range of hardware and OS metrics.

.. cfgcmd:: set service monitoring prometheus node-exporter listen-address <address>

  Configure the address node_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus node-exporter port <port>

  Configure the port number node_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus node-exporter vrf <name>

  Configure name of the :abbr:`VRF (Virtual Routing and Forwarding)` instance.

.. cfgcmd:: set service monitoring prometheus node-exporter collectors textfile

  Configure textfile collector to export custom metrics read from
  `/run/node_exporter/collector`


FRR Exporter
============
Prometheus frr_exporter_ which provides free range routing metrics.

.. cfgcmd:: set service monitoring prometheus frr-exporter listen-address <address>

  Configure the address frr_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus frr-exporter port <port>

  Configure the port number frr_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus frr-exporter vrf <name>

  Configure name of the :abbr:`VRF (Virtual Routing and Forwarding)` instance.


Blackbox Exporter
=================
Prometheus blackbox_exporter_ which allows probing of endpoints over
HTTP, HTTPS, DNS, TCP, ICMP and gRPC .

.. cfgcmd:: set service monitoring prometheus blackbox-exporter listen-address <address>

  Configure the address blackbox_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus blackbox-exporter port <port>

  Configure the port number blackbox_exporter is listening on.

.. cfgcmd:: set service monitoring prometheus blackbox-exporter vrf <name>

  Configure name of the :abbr:`VRF (Virtual Routing and Forwarding)` instance.

Configuring modules
-------------------
Blackbox exporter can be configured with different modules for probing DNS or ICMP.

DNS module example:

.. code-block:: none

  set service monitoring prometheus blackbox-exporter modules dns name dns4 preferred-ip-protocol ip4
  set service monitoring prometheus blackbox-exporter modules dns name dns4 query-name vyos.io
  set service monitoring prometheus blackbox-exporter modules dns name dns4 query-type A

ICMP module example:

.. code-block:: none

  set service monitoring prometheus blackbox-exporter modules icmp name ping6 preferred-ip-protocol ip6
  set service monitoring prometheus blackbox-exporter modules icmp name ping6 ip-protocol-fallback
  set service monitoring prometheus blackbox-exporter modules icmp name ping6 timeout 3

.. _node_exporter: https://github.com/prometheus/node_exporter
.. _frr_exporter: https://github.com/tynany/frr_exporter
.. _blackbox_exporter: https://github.com/prometheus/blackbox_exporter