summaryrefslogtreecommitdiffstats
path: root/upstream/debian-bookworm/man8/sadc.8
blob: a2c6ef612d8a3847a2c8e21353c5edc4e23bbb31 (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
.\" sadc manual page - (C) 1999-2020 Sebastien Godard (sysstat <at> orange.fr)
.TH SADC 8 "JULY 2020" Linux "Linux User's Manual" \-*\- nroff \-*\-
.SH NAME
sadc \- System activity data collector.

.SH SYNOPSIS
.B /usr/lib/sysstat/sadc [ \-C
.I comment
.BI "] [ \-D ] [ \-F ] [ \-f ] [ \-L ] [ \-V ] [ \-S { " "keyword" "[,...] | ALL | XALL } ] ["
.IB "interval " "[ " "count " "] ] [ " "outfile " "]"

.SH DESCRIPTION
.RB "The " "sadc"
command samples system data a specified number of times
.RI "(" "count" ") at a specified interval measured in seconds (" "interval" ")."
It writes in binary format to the specified
.IR "outfile " "or to standard output. If " "outfile"
.RB "is set to " "\-" ", then " "sadc"
uses the standard system activity daily data file (see below).
In this case, if the file already exists,
.B sadc
will overwrite it if it is from a previous month. By default
.B sadc
collects most of the data available from the kernel.
But there are also optional metrics, for which the
relevant options must be explicitly passed to
.BR "sadc " "to be collected (see option " "\-S " "below)."
.PP
The standard system activity daily data file is named
.IR "saDD " "unless option"
.B \-D
is used, in which case its name is
.IR "saYYYYMMDD" ", where " "YYYY " "stands for the current year, " "MM " "for the current month and " "DD"
for the current day. By default it is located in the
.I /var/log/sysstat
directory. Yet it is possible to specify an alternate location for
it: If
.I outfile
is a directory (instead of a plain file) then it will be considered
as the directory where the standard system activity daily data file
will be saved.
.PP
.RI "When the " "count"
parameter is not specified,
.B sadc
writes its data endlessly. When both
.IR "interval " "and " "count"
are not specified, and option
.B \-C
is not used, a dummy record, which is used at system startup to mark
the time when the counter restarts from 0, will be written.
For example, one of the system startup script may write the restart mark to
the daily data file by the command entry:

.B /usr/lib/sysstat/sadc \-

.RB "The " "sadc " "command is intended to be used as a backend to the " "sar " "command."
.PP
.RB "Note: The " "sadc"
command only reports on local activities.

.SH OPTIONS
.TP
.BI "\-C " "comment"
When neither the
.IR "interval " "nor the " "count"
parameters are specified, this option tells
.B sadc
to write a dummy record containing the specified
.I comment
string. This comment can then be displayed with option
.BR "\-C " "of " "sar" "."
.TP
.B \-D
.RI "Use " "saYYYYMMDD " "instead of " "saDD"
as the standard system activity daily data file name.
.TP
.B \-F
.RI "The creation of " "outfile"
will be forced. If the file already exists and has a format unknown to
.B sadc
then it will be truncated. This may be useful for daily data files
created by an older version of
.B sadc
and whose format is no longer compatible with current one.
.TP
.B \-f
fdatasync() will be used to ensure data is written to disk. This differs
from the normal operation in that a sudden system reset is less likely to
result in the
.I saDD
datafiles being corrupted. However, this is at the
expense of performance within the
.B sadc
process as forward progress will be
blocked while data is written to underlying disk instead of just to cache.
.TP
.B \-L
.B sadc
will try to get an exclusive lock on the
.I outfile
before writing to it or truncating it. Failure to get the lock is fatal,
except in the case of trying to write a normal (i.e. not a dummy and not
a header) record to an existing file, in which case
.B sadc
will try again at the next interval. Usually, the only reason a lock
would fail would be if another
.BR "sadc " "process were also writing to the file. This can happen when " "cron"
is used to launch
.BR "sadc" ". If the system is under heavy load, an old " "sadc"
might still be running when
.B cron
starts a new one. Without locking, this situation can result in a corrupted system
activity file.
.TP
.BI "\-S { " "keyword" "[,...] | ALL | XALL }"
Possible keywords are
.BR "DISK" ", " "INT" ", " "IPV6" ", " "POWER" ", " "SNMP" ", " "XDISK" ", " "ALL " "and " "XALL" "."
.br
Specify which optional activities should be collected by
.BR "sadc" "."
Some activities are optional to prevent data files from growing too large. The
.BR "DISK " "keyword indicates that " "sadc"
should collect data for block devices. The
.BR "INT " "keyword indicates that " "sadc"
should collect data for system interrupts. The
.BR "IPV6 " "keyword indicates that IPv6 statistics should be collected by " "sadc" ". The"
.BR "POWER " "keyword indicates that " "sadc"
should collect power management statistics. The
.BR "SNMP " "keyword indicates that SNMP statistics should be collected by " "sadc" ". The"
.BR "ALL " "keyword is equivalent to specifying all the keywords above and therefore"
all previous activities are collected.
.IP
.RB "The " "XDISK " "keyword is an extension to the " "DISK"
one and indicates that partitions and filesystems statistics should be collected by
.B sadc
in addition to disk statistics. This option works only with kernels 2.6.25
and later. The
.B XALL
keyword is equivalent to specifying all the keywords above (including
keyword extensions) and therefore all possible activities are collected.
.IP
Important note: The activities (including optional ones) saved in an existing
data file prevail over those selected with option
.BR "\-S" "."
As a consequence, appending data to an existing data file will result in option
.B \-S
being ignored.
.TP
.B \-V
Print version number then exit.

.SH ENVIRONMENT
.RB "The " "sadc"
command takes into account the following environment variable:
.TP
.B S_TIME_DEF_TIME
If this variable exists and its value is
.BR "UTC " "then " "sadc"
will save its data in UTC time.
.B sadc
will also use UTC time instead of local time to determine the current
daily data file located in the
.IR /var/log/sysstat
directory.

.SH EXAMPLES
.TP
.B /usr/lib/sysstat/sadc 1 10 /tmp/datafile
Write 10 records of one second intervals to the
.IR "/tmp/datafile " "binary file."
.TP
.B /usr/lib/sysstat/sadc \-C """Backup Start"" /tmp/datafile
Insert the comment "Backup Start" into the file
.IR "/tmp/datafile" "."

.SH BUGS
.RI "The " "/proc"
filesystem must be mounted for the
.BR "sadc " "command to work."
.PP
All the statistics are not necessarily available, depending on the kernel version used.
.B sadc
assumes that you are using at least a 2.6 kernel.

.SH FILES
.I /var/log/sysstat/saDD
.br
.I /var/log/sysstat/saYYYYMMDD
.RS
The standard system activity daily data files and their default location.
.IR "YYYY " "stands for the current year, " "MM " "for the current month and " "DD"
for the current day.
.RE
.IR "/proc " "and " "/sys " "contain various files with system statistics."

.SH AUTHOR
Sebastien Godard (sysstat <at> orange.fr)

.SH SEE ALSO
.BR "sar" "(1), " "sa1" "(8), " "sa2" "(8), " "sadf" "(1), " "sysstat" "(5)"
.PP
.I https://github.com/sysstat/sysstat
.br
.I http://pagesperso\-orange.fr/sebastien.godard/