| 1 |
.\" sadf manual page - (C) 1999-2023 Sebastien Godard (sysstat <at> orange.fr) |
| 2 |
.TH SADF 1 "AUGUST 2023" Linux "Linux User's Manual" -*- nroff -*- |
| 3 |
.SH NAME |
| 4 |
sadf \- Display data collected by sar in multiple formats. |
| 5 |
|
| 6 |
.SH SYNOPSIS |
| 7 |
.B sadf [ \-C ] [ \-c | \-d | \-g | \-j | \-l | \-p | \-r | \-x ] [ \-H ] [ \-h ] [ \-T | \-t | \-U ] [ \-V ] [ \-O |
| 8 |
.IB "opts " "[,...] ] [ \-P { " "cpu_list " "| ALL } ] [ \-s [ " |
| 9 |
.IB "start_time " "] ] ] [ \-e [ " "end_time " "] ] ]" |
| 10 |
.BI "[ \-\-dev=" "dev_list " "] [ \-\-fs=" "fs_list " "] [ \-\-iface=" "iface_list" "] [ \-\-int=" "int_list " "] [ \-\-" |
| 11 |
.IB "sar_options " "] [ " "interval " "[ " "count " "] ] [ " "datafile " "| " "\-[0\-9]+ " "]" |
| 12 |
|
| 13 |
.SH DESCRIPTION |
| 14 |
.RB "The " "sadf" |
| 15 |
command is used for displaying the contents of data files created by the |
| 16 |
.BR "sar" "(1) command. But unlike " "sar" ", " "sadf" |
| 17 |
can write its data in many different formats (CSV, XML, etc.) |
| 18 |
The default format is one that can |
| 19 |
easily be handled by pattern processing commands like |
| 20 |
.BR "awk " "(see option " "\-p" "). The " "sadf" |
| 21 |
command can also be used to draw graphs for the various activities collected by |
| 22 |
.B sar |
| 23 |
and display them as SVG (Scalable Vector Graphics) graphics in your web browser |
| 24 |
(see option |
| 25 |
.BR "\-g" ")." |
| 26 |
.PP |
| 27 |
.RB "The " "sadf" |
| 28 |
command extracts and writes to standard output records saved in the |
| 29 |
.I datafile |
| 30 |
file. This file must have been created by a version of |
| 31 |
.BR "sar " "which is compatible with that of " "sadf" ". If" |
| 32 |
.I datafile |
| 33 |
.RB "is omitted, " "sadf" |
| 34 |
uses the standard system activity daily data file. |
| 35 |
It is also possible to enter |
| 36 |
.BR "\-1" ", " "\-2 " "etc. as an argument to " "sadf" |
| 37 |
to display data of that days ago. For example, |
| 38 |
.B \-1 |
| 39 |
will point at the standard system activity file of yesterday. |
| 40 |
.PP |
| 41 |
The standard system activity daily data file is named |
| 42 |
.IR "saDD " "or " "saYYYYMMDD" ", where" |
| 43 |
.IR "YYYY " "stands for the current year, " "MM " "for the current month and " "DD" |
| 44 |
for the current day. |
| 45 |
.B sadf |
| 46 |
will look for the most recent of |
| 47 |
.IR "saDD " "and " "saYYYYMMDD" "," |
| 48 |
and use it. By default it is located in the |
| 49 |
.I /var/log/sysstat |
| 50 |
directory. Yet it is possible to specify an alternate location for it: If |
| 51 |
.I datafile |
| 52 |
is a directory (instead of a plain file) then it will be considered as |
| 53 |
the directory where the standard system activity daily data file is located. |
| 54 |
.PP |
| 55 |
.RI "The " "interval " "and " "count " "parameters are used to tell" |
| 56 |
.BR "sadf " "to select" |
| 57 |
.IR "count " "records at " "interval " "seconds apart. If the " "count" |
| 58 |
parameter is not set, then all the records saved in the data file will be displayed. |
| 59 |
.PP |
| 60 |
All the activity flags of |
| 61 |
.B sar |
| 62 |
may be entered on the command line to indicate which |
| 63 |
activities are to be reported. Before specifying them, put a pair of dashes |
| 64 |
.RB "(" "\-\-" ")" |
| 65 |
on the command line in order not to confuse the flags with those of |
| 66 |
.B sadf. |
| 67 |
Not specifying any flags selects only CPU activity. |
| 68 |
|
| 69 |
.SH OPTIONS |
| 70 |
.TP |
| 71 |
.B \-C |
| 72 |
.RB "Tell " "sadf " "to display comments present in file." |
| 73 |
.TP |
| 74 |
.B \-c |
| 75 |
Convert an old system activity binary datafile (version 9.1.6 and later) |
| 76 |
to current up-to-date format. Use the following syntax: |
| 77 |
|
| 78 |
.BI "sadf \-c " "old_datafile " "> " "new_datafile" |
| 79 |
|
| 80 |
Conversion can be controlled using option |
| 81 |
.BR "\-O " "(see below)." |
| 82 |
.TP |
| 83 |
.B \-d |
| 84 |
Print the contents of the data file in a format that can easily |
| 85 |
be ingested by a relational database system. The output consists |
| 86 |
of fields separated by a semicolon. Each record contains |
| 87 |
the hostname of the host where the file was created, the interval value |
| 88 |
(or \-1 if not applicable), the timestamp in a form easily acceptable by |
| 89 |
most databases, and additional semicolon separated data fields as specified by |
| 90 |
.IR "sar_options " "command line options." |
| 91 |
Note that timestamp output can be controlled by options |
| 92 |
.BR "\-T" ", " "\-t " "and " "\-U" "." |
| 93 |
.TP |
| 94 |
.BI "\-\-dev=" "dev_list" |
| 95 |
Specify the block devices for which statistics are to be displayed by |
| 96 |
.BR "sadf" "." |
| 97 |
.I dev_list |
| 98 |
is a list of comma-separated device names. Useful with option |
| 99 |
.BR "\-d " "from " "sar" "." |
| 100 |
.RE |
| 101 |
.PP |
| 102 |
.BI "\-e [ " "hh" ":" "mm" "[:" "ss" "] ]" |
| 103 |
.br |
| 104 |
.BI "\-e [ " "seconds_since_the_epoch " "]" |
| 105 |
.RS |
| 106 |
Set the ending time of the report. The default ending |
| 107 |
time is 18:00:00. Hours must be given in 24-hour format, or as the number of seconds |
| 108 |
since the epoch (given as a 10 digit number). |
| 109 |
.RE |
| 110 |
.TP |
| 111 |
.BI "\-\-fs=" "fs_list" |
| 112 |
Specify the filesystems for which statistics are to be displayed by |
| 113 |
.BR "sadf" "." |
| 114 |
.I fs_list |
| 115 |
is a list of comma-separated filesystem names or mountpoints. Useful with option |
| 116 |
.BR "\-F " "from " "sar" "." |
| 117 |
.TP |
| 118 |
.B \-g |
| 119 |
Print the contents of the data file in SVG (Scalable Vector Graphics) format. |
| 120 |
This option enables you to display some fancy graphs in your web browser. |
| 121 |
Use the following syntax: |
| 122 |
|
| 123 |
.BI "sadf \-g " "your_datafile " "[ \-\- " "sar_options " "] > " "output.svg" |
| 124 |
|
| 125 |
and open the resulting SVG file in your favorite web browser. |
| 126 |
Output can be controlled using option |
| 127 |
.BR "\-O " "(see below)." |
| 128 |
.TP |
| 129 |
.B \-H |
| 130 |
Display only the header of the report (when applicable). If no format has |
| 131 |
been specified, then the header data (metadata) of the data file are displayed. |
| 132 |
.TP |
| 133 |
.B \-h |
| 134 |
When used in conjunction with option |
| 135 |
.BR "\-d" ", all activities will be displayed horizontally on a single line." |
| 136 |
.TP |
| 137 |
.BI "\-\-iface=" "iface_list" |
| 138 |
Specify the network interfaces for which statistics are to be displayed by |
| 139 |
.BR "sadf" "." |
| 140 |
.I iface_list |
| 141 |
is a list of comma-separated interface names. Useful with options |
| 142 |
.BR "\-n DEV " "and " "\-n EDEV " "from " "sar" "." |
| 143 |
.TP |
| 144 |
.BI "\-\-int=" "int_list" |
| 145 |
Specify the interrupts names for which statistics are to be displayed by |
| 146 |
.BR "sadf" "." |
| 147 |
.I int_list |
| 148 |
is a list of comma-separated values or range of values (e.g., |
| 149 |
.BR "0\-16,35,40\-" "). Useful with option " "\-I " "from " "sar" "." |
| 150 |
.TP |
| 151 |
.B \-j |
| 152 |
Print the contents of the data file in JSON (JavaScript Object Notation) |
| 153 |
format. Timestamps can be controlled by options |
| 154 |
.BR "\-T " "and " "\-t" "." |
| 155 |
.TP |
| 156 |
.B \-l |
| 157 |
Export the contents of the data file to a PCP (Performance Co-Pilot) archive. |
| 158 |
The name of the archive can be specified using the keyword |
| 159 |
.BR "pcparchive= " "with option " "\-O" "." |
| 160 |
.TP |
| 161 |
.BI "\-O " "opts" "[,...]" |
| 162 |
Use the specified options to control the output of |
| 163 |
.BR "sadf" "." |
| 164 |
The following options are used to control SVG output displayed by |
| 165 |
.BR "sadf \-g" ":" |
| 166 |
.RS |
| 167 |
.IP autoscale |
| 168 |
Draw all the graphs of a given view as large as possible based on current |
| 169 |
view's scale. To do this, a factor (10, 100, 1000...) is used to |
| 170 |
enlarge the graph drawing. |
| 171 |
This option may be interesting when several graphs are drawn on the same |
| 172 |
view, some with only very small values, and others with high ones, |
| 173 |
the latter making the former hardly visible. |
| 174 |
.IP bwcol |
| 175 |
Use a black and white palette to draw the graphs. |
| 176 |
.IP customcol |
| 177 |
Use a customizable color palette instead of the default one to draw |
| 178 |
the graphs. See environment variable |
| 179 |
.B S_COLORS_PALETTE |
| 180 |
below to know how to customize that palette. |
| 181 |
.IP debug |
| 182 |
Add helpful comments in SVG output file. |
| 183 |
.TP |
| 184 |
.RI "height=" "value" |
| 185 |
Set SVG canvas height to |
| 186 |
.IR "value" "." |
| 187 |
.IP oneday |
| 188 |
Display graphs data over a period of 24 hours. Note that hours are still |
| 189 |
printed in UTC by default: You should use option |
| 190 |
.BR "\-T " "to print them in local time" |
| 191 |
and get a time window starting from midnight. |
| 192 |
.IP packed |
| 193 |
Group all views from the same activity (and for the same device) on the same row. |
| 194 |
.IP showidle |
| 195 |
Also display %idle state in graphs for CPU statistics. |
| 196 |
.IP showinfo |
| 197 |
Display additional information (such as the date and the host name) on each view. |
| 198 |
.IP showtoc |
| 199 |
Add a table of contents at the beginning of the SVG output, consisting of links |
| 200 |
pointing at the first graph of each activity. |
| 201 |
.IP skipempty |
| 202 |
Do not display views where all graphs have only zero values. |
| 203 |
.RE |
| 204 |
.IP |
| 205 |
The following option may be used when converting an old system activity binary datafile |
| 206 |
to current up-to-date format: |
| 207 |
.RS |
| 208 |
.TP |
| 209 |
.RI "hz=" "value" |
| 210 |
Specify the number of ticks per second for the machine where the old datafile has been created. |
| 211 |
.RE |
| 212 |
.IP |
| 213 |
The following option may be used when data are exported to a PCP archive: |
| 214 |
.RS |
| 215 |
.TP |
| 216 |
.RI "pcparchive=" "name" |
| 217 |
Specify the name of the PCP archive to create. |
| 218 |
.RE |
| 219 |
.IP |
| 220 |
The following option is used to control raw output displayed by |
| 221 |
.BR "sadf \-r" ":" |
| 222 |
.RS |
| 223 |
.IP debug |
| 224 |
Display additional information, mainly useful for debugging purpose. |
| 225 |
.RE |
| 226 |
.TP |
| 227 |
.BI "\-P { " "cpu_list " "| ALL }" |
| 228 |
.RB "Tell " "sadf" |
| 229 |
that processor dependent statistics are to be reported only for the |
| 230 |
specified processor or processors. |
| 231 |
.I cpu_list |
| 232 |
is a list of comma-separated values or range of values (e.g., |
| 233 |
.BR "0,2,4\-7,12\-" ")." |
| 234 |
Note that processor 0 is the first processor, and processor |
| 235 |
.BR "all " "is the global average among all processors. Specifying the " "ALL" |
| 236 |
keyword reports statistics for each individual processor, and globally for |
| 237 |
all processors. |
| 238 |
.TP |
| 239 |
.B \-p |
| 240 |
Print the contents of the data file in a format that can |
| 241 |
easily be handled by pattern processing commands like |
| 242 |
.BR "awk" "." |
| 243 |
The output consists of fields separated by a tab. Each record contains the |
| 244 |
hostname of the host where the file was created, the interval value |
| 245 |
(or \-1 if not applicable), the timestamp, the device name (or \- if not applicable), |
| 246 |
the field name and its value. |
| 247 |
Note that timestamp output can be controlled by options |
| 248 |
.BR "\-T" ", " "\-t " "and " "\-U" "." |
| 249 |
.TP |
| 250 |
.B \-r |
| 251 |
Print the raw contents of the data file. With this format, the values for |
| 252 |
all the counters are displayed as read from the kernel, which means e.g., that |
| 253 |
no average values are calculated over the elapsed time interval. |
| 254 |
Output can be controlled using option |
| 255 |
.BR "\-O " "(see above)." |
| 256 |
.PP |
| 257 |
.BI "\-s [ " "hh" ":" "mm" "[:" "ss" "] ]" |
| 258 |
.br |
| 259 |
.BI "\-s [ " "seconds_since_the_epoch " "]" |
| 260 |
.RS |
| 261 |
Set the starting time of the data, causing the |
| 262 |
.B sadf |
| 263 |
command to extract records time-tagged at, or following, the time |
| 264 |
specified. The default starting time is 08:00:00. |
| 265 |
Hours must be given in 24-hour format, or as the number of seconds |
| 266 |
since the epoch (given as a 10 digit number). |
| 267 |
.RE |
| 268 |
.TP |
| 269 |
.B \-T |
| 270 |
Display timestamp in local time instead of UTC (Coordinated Universal Time). |
| 271 |
.TP |
| 272 |
.B \-t |
| 273 |
Display timestamp in the original local time of the data file creator |
| 274 |
instead of UTC (Coordinated Universal Time). |
| 275 |
.TP |
| 276 |
.B \-U |
| 277 |
Display timestamp (UTC - Coordinated Universal Time) in seconds from the epoch. |
| 278 |
.TP |
| 279 |
.B \-V |
| 280 |
Print version number then exit. |
| 281 |
.TP |
| 282 |
.B \-x |
| 283 |
Print the contents of the data file in XML format. |
| 284 |
Timestamps can be controlled by options |
| 285 |
.BR "\-T " "and " "\-t" "." |
| 286 |
The corresponding DTD (Document Type Definition) and XML Schema are included |
| 287 |
in the sysstat source package. They are also available at |
| 288 |
.IR "https://sysstat.github.io/" "." |
| 289 |
|
| 290 |
.SH ENVIRONMENT |
| 291 |
.RB "The " "sadf" |
| 292 |
command takes into account the following environment variables: |
| 293 |
.TP |
| 294 |
.B S_COLORS_PALETTE |
| 295 |
Specify the colors used by |
| 296 |
.B sadf \-g |
| 297 |
to render the SVG output. This environment variable is taken into account |
| 298 |
only when the custom color palette has been selected with the option |
| 299 |
.BR "customcol " "(see option " "\-O" ")." |
| 300 |
Its value is a colon-separated list of capabilities associated |
| 301 |
with six-digit, three-byte |
| 302 |
hexadecimal numbers (hex triplets) representing colors that defaults to |
| 303 |
|
| 304 |
.B 0=000000:1=1a1aff:2=1affb2:3=b21aff: |
| 305 |
.br |
| 306 |
.B 4=1ab2ff:5=ff1a1a:6=ffb31a:7=b2ff1a: |
| 307 |
.br |
| 308 |
.B 8=efefef:9=000000:A=1a1aff:B=1affb2: |
| 309 |
.br |
| 310 |
.B C=b21aff:D=1ab2ff:E=ff1a1a:F=ffb31a: |
| 311 |
.br |
| 312 |
.B G=bebebe:H=000000:I=000000:K=ffffff: |
| 313 |
.br |
| 314 |
.B L=000000:T=000000:W=000000:X=000000 |
| 315 |
|
| 316 |
Capabilities consisting of a hexadecimal digit |
| 317 |
.RB "(" "0 " "through " "F" ") are used to specify" |
| 318 |
the first sixteen colors in the palette (these colors are used to draw the graphs), |
| 319 |
e.g., 3=ffffff would indicate that the third color in the palette is white (0xffffff). |
| 320 |
.br |
| 321 |
Other capabilities are: |
| 322 |
.RS |
| 323 |
.TP |
| 324 |
.B G= |
| 325 |
Specify the color used to draw the grid lines. |
| 326 |
.TP |
| 327 |
.B H= |
| 328 |
Specify the color used to display the report header. |
| 329 |
.TP |
| 330 |
.B I= |
| 331 |
Specify the color used to display additional information (e.g., date, hostname...) |
| 332 |
.TP |
| 333 |
.B K= |
| 334 |
Specify the color used for the graphs background. |
| 335 |
.TP |
| 336 |
.B L= |
| 337 |
Specify the default color (which is for example used to display the table of contents). |
| 338 |
.TP |
| 339 |
.B T= |
| 340 |
Specify the color used to display the graphs title. |
| 341 |
.TP |
| 342 |
.B W= |
| 343 |
Specify the color used to display warning and error messages. |
| 344 |
.TP |
| 345 |
.B X= |
| 346 |
Specify the color used to draw the axes and display the graduations. |
| 347 |
.RE |
| 348 |
.TP |
| 349 |
.B S_TIME_DEF_TIME |
| 350 |
If this variable exists and its value is |
| 351 |
.BR "UTC " "then " "sadf" |
| 352 |
will use UTC time instead of local time to determine the current daily data |
| 353 |
file located in the |
| 354 |
.IR /var/log/sysstat |
| 355 |
directory. |
| 356 |
|
| 357 |
.SH EXAMPLES |
| 358 |
.TP |
| 359 |
.B sadf \-d /var/log/sysstat/sa21 \-\- \-r \-n DEV |
| 360 |
Extract memory and network statistics from system activity file |
| 361 |
.IR "sa21" "," |
| 362 |
and display them in a format that can be ingested by a database. |
| 363 |
.TP |
| 364 |
.B sadf \-p \-P 1 |
| 365 |
Extract CPU statistics for processor 1 (the second processor) from current |
| 366 |
daily data file, and display them in a format that can easily be handled |
| 367 |
by a pattern processing command. |
| 368 |
|
| 369 |
.SH BUGS |
| 370 |
SVG output (as created by option |
| 371 |
.BR "\-g" ")" |
| 372 |
is fully compliant with SVG 1.1 standard. |
| 373 |
Graphics have been successfully displayed in various web browsers, including |
| 374 |
Firefox, Chrome and Opera. Yet SVG rendering is broken on Microsoft browsers |
| 375 |
(tested on Internet Explorer 11 and Edge 13.1): So please don't use them. |
| 376 |
|
| 377 |
.SH FILES |
| 378 |
.I /var/log/sysstat/saDD |
| 379 |
.br |
| 380 |
.I /var/log/sysstat/saYYYYMMDD |
| 381 |
.RS |
| 382 |
The standard system activity daily data files and their default location. |
| 383 |
.IR "YYYY " "stands for the current year, " "MM " "for the current month and " "DD" |
| 384 |
for the current day. |
| 385 |
.RE |
| 386 |
|
| 387 |
.SH AUTHOR |
| 388 |
Sebastien Godard (sysstat <at> orange.fr) |
| 389 |
|
| 390 |
.SH SEE ALSO |
| 391 |
.BR "sar" "(1), " "sadc" "(8), " "sa1" "(8), " "sa2" "(8), " "sysstat" "(5)" |
| 392 |
.PP |
| 393 |
.I https://github.com/sysstat/sysstat |
| 394 |
.br |
| 395 |
.I https://sysstat.github.io/ |