Debian Codegraph @

upstream/debian-unstable/man8/sadc.8

raw
1 .\" sadc manual page - (C) 1999-2020 Sebastien Godard (sysstat <at> orange.fr)
2 .TH SADC 8 "AUGUST 2023" Linux "Linux User's Manual" -*- nroff -*-
3 .SH NAME
4 sadc \- System activity data collector.
5
6 .SH SYNOPSIS
7 .B /usr/libexec/sysstat/sadc [ \-C
8 .I comment
9 .BI "] [ \-D ] [ \-F ] [ \-f ] [ \-L ] [ \-V ] [ \-S { " "keyword" "[,...] | ALL | XALL } ] ["
10 .IB "interval " "[ " "count " "] ] [ " "outfile " "]"
11
12 .SH DESCRIPTION
13 .RB "The " "sadc"
14 command samples system data a specified number of times
15 .RI "(" "count" ") at a specified interval measured in seconds (" "interval" ")."
16 It writes in binary format to the specified
17 .IR "outfile " "or to standard output. If " "outfile"
18 .RB "is set to " "\-" ", then " "sadc"
19 uses the standard system activity daily data file (see below).
20 In this case, if the file already exists,
21 .B sadc
22 will overwrite it if it is from a previous month. By default
23 .B sadc
24 collects most of the data available from the kernel.
25 But there are also optional metrics, for which the
26 relevant options must be explicitly passed to
27 .BR "sadc " "to be collected (see option " "\-S " "below)."
28 .PP
29 The standard system activity daily data file is named
30 .IR "saDD " "unless option"
31 .B \-D
32 is used, in which case its name is
33 .IR "saYYYYMMDD" ", where " "YYYY " "stands for the current year, " "MM " "for the current month and " "DD"
34 for the current day. By default it is located in the
35 .I /var/log/sysstat
36 directory. Yet it is possible to specify an alternate location for
37 it: If
38 .I outfile
39 is a directory (instead of a plain file) then it will be considered
40 as the directory where the standard system activity daily data file
41 will be saved.
42 .PP
43 .RI "When the " "count"
44 parameter is not specified,
45 .B sadc
46 writes its data endlessly. When both
47 .IR "interval " "and " "count"
48 are not specified, and option
49 .B \-C
50 is not used, a dummy record, which is used at system startup to mark
51 the time when the counter restarts from 0, will be written.
52 For example, one of the system startup script may write the restart mark to
53 the daily data file by the command entry:
54
55 .B /usr/libexec/sysstat/sadc \-
56
57 .RB "The " "sadc " "command is intended to be used as a backend to the " "sar " "command."
58 .PP
59 .RB "Note: The " "sadc"
60 command only reports on local activities.
61
62 .SH OPTIONS
63 .TP
64 .BI "\-C " "comment"
65 When neither the
66 .IR "interval " "nor the " "count"
67 parameters are specified, this option tells
68 .B sadc
69 to write a dummy record containing the specified
70 .I comment
71 string. This comment can then be displayed with option
72 .BR "\-C " "of " "sar" "."
73 .TP
74 .B \-D
75 .RI "Use " "saYYYYMMDD " "instead of " "saDD"
76 as the standard system activity daily data file name.
77 .TP
78 .B \-F
79 .RI "The creation of " "outfile"
80 will be forced. If the file already exists and has a format unknown to
81 .B sadc
82 then it will be truncated. This may be useful for daily data files
83 created by an older version of
84 .B sadc
85 and whose format is no longer compatible with current one.
86 .TP
87 .B \-f
88 fdatasync() will be used to ensure data is written to disk. This differs
89 from the normal operation in that a sudden system reset is less likely to
90 result in the
91 .I saDD
92 datafiles being corrupted. However, this is at the
93 expense of performance within the
94 .B sadc
95 process as forward progress will be
96 blocked while data is written to underlying disk instead of just to cache.
97 .TP
98 .B \-L
99 .B sadc
100 will try to get an exclusive lock on the
101 .I outfile
102 before writing to it or truncating it. Failure to get the lock is fatal,
103 except in the case of trying to write a normal (i.e. not a dummy and not
104 a header) record to an existing file, in which case
105 .B sadc
106 will try again at the next interval. Usually, the only reason a lock
107 would fail would be if another
108 .BR "sadc " "process were also writing to the file. This can happen when " "cron"
109 is used to launch
110 .BR "sadc" ". If the system is under heavy load, an old " "sadc"
111 might still be running when
112 .B cron
113 starts a new one. Without locking, this situation can result in a corrupted system
114 activity file.
115 .TP
116 .BI "\-S { " "keyword" "[,...] | ALL | XALL }"
117 Possible keywords are
118 .BR "DISK" ", " "INT" ", " "IPV6" ", " "POWER" ", " "SNMP" ", " "XDISK" ", " "ALL " "and " "XALL" "."
119 .br
120 Specify which optional activities should be collected by
121 .BR "sadc" "."
122 Some activities are optional to prevent data files from growing too large. The
123 .BR "DISK " "keyword indicates that " "sadc"
124 should collect data for block devices. The
125 .BR "INT " "keyword indicates that " "sadc"
126 should collect data for system interrupts. The
127 .BR "IPV6 " "keyword indicates that IPv6 statistics should be collected by " "sadc" ". The"
128 .BR "POWER " "keyword indicates that " "sadc"
129 should collect power management statistics. The
130 .BR "SNMP " "keyword indicates that SNMP statistics should be collected by " "sadc" ". The"
131 .BR "ALL " "keyword is equivalent to specifying all the keywords above and therefore"
132 all previous activities are collected.
133 .IP
134 .RB "The " "XDISK " "keyword is an extension to the " "DISK"
135 one and indicates that partitions and filesystems statistics should be collected by
136 .B sadc
137 in addition to disk statistics. This option works only with kernels 2.6.25
138 and later. The
139 .B XALL
140 keyword is equivalent to specifying all the keywords above (including
141 keyword extensions) and therefore all possible activities are collected.
142 .IP
143 Important note: The activities (including optional ones) saved in an existing
144 data file prevail over those selected with option
145 .BR "\-S" "."
146 As a consequence, appending data to an existing data file will result in option
147 .B \-S
148 being ignored.
149 .TP
150 .B \-V
151 Print version number then exit.
152
153 .SH ENVIRONMENT
154 .RB "The " "sadc"
155 command takes into account the following environment variable:
156 .TP
157 .B S_TIME_DEF_TIME
158 If this variable exists and its value is
159 .BR "UTC " "then " "sadc"
160 will save its data in UTC time.
161 .B sadc
162 will also use UTC time instead of local time to determine the current
163 daily data file located in the
164 .IR /var/log/sysstat
165 directory.
166
167 .SH EXAMPLES
168 .TP
169 .B /usr/libexec/sysstat/sadc 1 10 /tmp/datafile
170 Write 10 records of one second intervals to the
171 .IR "/tmp/datafile " "binary file."
172 .TP
173 .B /usr/libexec/sysstat/sadc \-C """Backup Start"" /tmp/datafile
174 Insert the comment "Backup Start" into the file
175 .IR "/tmp/datafile" "."
176
177 .SH BUGS
178 .RI "The " "/proc"
179 filesystem must be mounted for the
180 .BR "sadc " "command to work."
181 .PP
182 All the statistics are not necessarily available, depending on the kernel version used.
183 .B sadc
184 assumes that you are using at least a 2.6 kernel.
185
186 .SH FILES
187 .I /var/log/sysstat/saDD
188 .br
189 .I /var/log/sysstat/saYYYYMMDD
190 .RS
191 The standard system activity daily data files and their default location.
192 .IR "YYYY " "stands for the current year, " "MM " "for the current month and " "DD"
193 for the current day.
194 .RE
195 .IR "/proc " "and " "/sys " "contain various files with system statistics."
196
197 .SH AUTHOR
198 Sebastien Godard (sysstat <at> orange.fr)
199
200 .SH SEE ALSO
201 .BR "sar" "(1), " "sa1" "(8), " "sa2" "(8), " "sadf" "(1), " "sysstat" "(5)"
202 .PP
203 .I https://github.com/sysstat/sysstat
204 .br
205 .I https://sysstat.github.io/