xref: /freebsd/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
1.\" Copyright (c) 2016 Nuxi, https://nuxi.nl/
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22.\" SUCH DAMAGE.
23.\"
24.\" $FreeBSD$
25.Dd October 7, 2021
26.Dt PROMETHEUS_SYSCTL_EXPORTER 8
27.Os
28.Sh NAME
29.Nm prometheus_sysctl_exporter
30.Nd print kernel state as Prometheus metrics
31.Sh SYNOPSIS
32.Nm prometheus_sysctl_exporter
33.Op Fl dgh
34.Op Fl e Ar pattern
35.Op Fl i Ar pattern
36.Op Ar prefix ...
37.Sh DESCRIPTION
38Prometheus is a monitoring system that gathers metrics from its targets
39by fetching them through HTTP GET requests.
40Metrics are identified by a name and an optional set of labels.
41Sample values are required to be numerical.
42.Pp
43The
44.Nm
45utility prints the values of sysctl nodes to standard output,
46formatted such that they can be scraped by Prometheus directly.
47By default,
48it prints metrics for all numerically representable nodes in the sysctl
49namespace.
50It is also possible to limit output to a smaller number of metrics by
51specifying one or more prefixes as arguments.
52.Pp
53Metrics printed by this utility are named
54.Ql sysctl_ ,
55followed by the name of the sysctl node having its
56.Ql .\&
57separators replaced by
58.Ql _ .
59Components on which it is desirable to aggregate (e.g.,
60names of devices) are omitted from the metric's name,
61but are appended as labels instead.
62.Pp
63There are two different methods for exporting the output of
64.Nm
65to Prometheus.
66The first method is to periodically invoke this utility through
67.Xr cron 8
68and store its output in a textfile.
69The metrics in this textfile can then be served over HTTP using the
70Prometheus node exporter's textfile collector.
71The second method is to run this utility through
72.Xr inetd 8 .
73TCP port 9124 has been allocated for this purpose.
74.Pp
75The following options are available:
76.Bl -tag -width indent
77.It Fl d
78Print descriptions of metrics when available.
79.It Fl e Ar pattern
80Same as
81.Fl i ,
82except exclude metrics that match
83.Ar pattern .
84.It Fl g
85Gzip compresses the HTTP response body.
86.It Fl h
87Precede the output with a HTTP response header.
88This flag is required when running this utility through
89.Xr inetd 8 .
90.It Fl i Ar pattern
91If specified, include metrics that match
92.Ar pattern .
93The format of
94.Ar pattern
95is to be a regular expression as described in
96.Xr re_format 7 .
97The provided regular expression is tested against the Prometheus
98metric name.
99.El
100.Sh SEE ALSO
101.Xr cron 8 ,
102.Xr inetd 8 ,
103.Xr sysctl 8 ,
104.Xr SYSCTL_ADD_NODE_WITH_LABEL 9
105.Pp
106Prometheus project:
107.Pa https://prometheus.io/ .
108.Pp
109Prometheus exposition formats:
110.Pa https://prometheus.io/docs/instrumenting/exposition_formats/ .
111.Pp
112Prometheus node exporter:
113.Pa https://github.com/prometheus/node_exporter .
114.Pp
115Prometheus default port allocations:
116.Pa https://github.com/prometheus/prometheus/wiki/Default-port-allocations .
117.Sh HISTORY
118.Nm
119first appeared in
120.Fx 12.0 .
121.Sh AUTHORS
122.An Nuxi : Pa https://nuxi.nl/ .
123