-
Notifications
You must be signed in to change notification settings - Fork 0
/
fstatmex.8
239 lines (206 loc) · 6.6 KB
/
fstatmex.8
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
.TH fstatmex 8 "2021-06-08"
.SH "NAME"
fstatmex \- a directory scanner with prometheus format export support.
.SH "SYNOPSIS"
.nh
.na
.HP
.B fstatmex
[\fB\-ACLSVZchms\fR]
[\fB\-a\ \fIip\fR]
[\fB\-l\ \fIlabel=value\fR]
[\fB\-p\ \fIport\fR]
[\fB\-o\ \fIfile\fR]
[\fB\-v\ DEBUG\fR|\fBINFO\fR|\fBWARN\fR|\fBERROR\fR|\fBFATAL\fR]
dir ...
.ad
.hy
.SH "DESCRIPTION"
.B fstatmex
is simple directory scanner with the primary goal to find sparse files.
However, since it goes through the whole directory tree and stats every entry,
it got enhanced to be able to collect file sizes, file/directory/link counts
and optionally determine the size of the holes in sparse files and export all
the data in prometheus histogram format (see [i]), so one may use simple
as well as tools like Grafana [2], Netdata [3], or Zabbix [4] to analyze
bigger directory trees much easier.
The scanner traverses the given directories one-by-one in directory entry
order, i.e. usually neither dictionary nor a timely order. If metrics (see
option -m) are enabled, files, links, directories and related sparse sizes
are collected directory wise and per default the \fBdir\fR label of the
related metrics set to its name. If the given or default tree depth has
been reached, any entries beneath this directory are handled as the would
be direct entries of this directory and thus not counted separately. So one
can control the detail level, how much metrics get created, which has a
direct impact on the memory usage of \fBfstatmex\fR.
.SH "OPTIONS"
The following options are supported by \fBfstatmex\fR, but metric related ones
get silently ignored unless metrics are enabled (see option -m):
.TP 4
.B \-A
.PD 0
.TP
.B \-\-anonym
Label metrics not with the related directory path, but with a simple counter
so that example for /export/home/** no user names or other information gets
exposed to the timeseries database or analyzer.
.TP
.B \-C
.PD 0
.TP
.B \-\-hole-check
Check for sparse files and print a info to stdout for each file found.
.TP
.B \-L
.PD 0
.TP
.B \-\-no\-scrapetime
Disable the overall scrapetime metrics (libprom collector), i.e. the time
elapsed when scraping all the required data. One needs also disable
collecting scrapetimes of all other collectors before this option
gets honored.
.TP
.B \-S
.PD 0
.TP
.B \-\-no\-scrapetime\-all
Disable recording the scrapetime of each collector separately. There is
one collector named \fBdefault\fR, which collects HTTP request/response
and scanner statistics, the optional \fBprocess\fR collector, which records
metrics about the \fBfstatmex\fR process itself, and finally the \fBlibprom\fR
collector, which just records the time it took to collect and prom-format the
data of all the collectors mentioned before.
.TP
.B \-V
.PD 0
.TP
.B \-\-version
Show the current \fBfstatmex\fR version and exit.
.TP
.B \-Z
.PD 0
.TP
.B \-\-hole-size
Analyze sparse files found wrt. to the number of holes and their total size.
This implies option \fB-C\fR.
.TP
.BI \-a " IP"
.PD 0
.TP
.BI \-\-addr= IP
Bind the HTTP server to the given \fIIP\fR address, only. Per default
it binds to 0.0.0.0, i.e. all IPs configured on this host/zone/container.
If you want to enable IPv6, just specify an IPv6 address here (\fB::\fR
is the same for IPv6 as 0.0.0.0 for IPv4).
.TP
.B \-c
.PD 0
.TP
.B \-\-compact
Sending a HELP and TYPE comment alias description about a metric is
according to the Prometheus exposition format [1] optional. With this
option they will be ommitted in the HTTP response and thus it saves
bandwith and processing time.
.TP
.BI \-d\ num
.PD 0
.TP
.BI \-\-depth= num
The depth of detail. Any directory entry with a depth greater than \fInum\fR
gets handled/accounted as would it belong to its predecessor with the given
depth. E.g. if the starting directory is /var/tmp and depth == 2, then
all directory entries of /var/tmp/metric would be counted to metrics
with the label \fBdir="\fRmetrics\fB"\fR, but all entries in and
beneath /var/tmp/metrics/test (i.e. /var/tmp/metrics/test/* and
/var/tmp/metrics/test/**/*) would be pushed to the metrics with
label \fBdir="\fRmetrics/test\fB"\fR. Default: \fB4\fR
.TP
.B \-h
.PD 0
.TP
.B \-\-help
Print a short help summary to the standard output and exit.
.TP
.BI \-l\ key = value
.PD 0
.TP
.BI \-\-label\ key = value
Add to each metric the given \fIkey\fB=\fIvalue\fR label. This might make it
easier to distinguish data for different runs or to delete them, when the
are not needed anymore.
.TP
.B \-m
.PD 0
.TP
.B \-\-metrics
Enable metrics and the HTTP server to expose them. The scanner will wait
for two metrics request (per default e.g. http://localhost:8080/metrics)
before the scanner starts running. This way one can be sure that metric
collectors like VictoriaMetrics Agent etc. do not miss any data. For the
same reason \fBfstatmex\fR waits 5 minutes after the the scanner has finished
its work before it terminates.
.TP
.BI \-o " file"
.PD 0
.TP
.BI \-\-logfile= file
Log all messages to the given \fIfile\fR when the main process is running.
.TP
.BI \-p " num"
.PD 0
.TP
.BI \-\-port= num
Bind to port \fInum\fR and listen there for HTTP requests. Note that a port
below 1024 usually requires additional privileges. Default: 8080.
.TP
.B \-s
.PD 0
.TP
.B \-\-show-specials
Use this option to print the filenames of special entries, i.e. neither
file, directory, or link, which are collected in the \fBfstatmex_misc\fR metrics,
to stdout.
.TP
.BI \-v " level"
.PD 0
.TP
.BI \-\-verbosity= level
Set the message verbosity to the given \fIlevel\fR. Accepted tokens are
\fBDEBUG\fR, \fBINFO\fR, \fBWARN\fR, \fBERROR\fR, \fBFATAL\fR and for
convenience \fB1\fR..\fB5\fR respectively.
.SH "EXIT STATUS"
.TP 4
.B 0
on success.
.TP
.B 1
if an unexpected error occurred during the start (other problem).
.TP
.B 96
if an invalid option or option value got passed (config problem).
.TP
.B 100
if the logfile is not writable or port access is not allowed (permission problem).
.SH "ENVIRONMENT"
.TP 4
.B PROM_LOG_LEVEL
If no verbosity level got specified via option \fB-v\ \fI...\fR, this
environment variable gets checked for a verbosity value. If there is a
valid one, the verbosity level gets set accordingly, otherwise \fBINFO\fR
level will be used.
.SH "BUGS"
https://github.com/jelmd/fstatmex is the official source code repository
for \fBfstatmex\fR. If you need some new features, or metrics, or bug fixes,
please feel free to create an issue there using
https://github.com/jelmd/fstatmex/issues .
.SH "AUTHORS"
Jens Elkner
.SH "SEE ALSO"
[1]\ https://prometheus.io/docs/instrumenting/exposition_formats/
.br
[2]\ https://grafana.com/
.br
[3]\ https://www.netdata.cloud/
.br
[4]\ https://www.zabbix.com/
.\" # vim: ts=4 sw=4 filetype=nroff