about summary refs log tree commit diff
path: root/Completion/Linux/Command/_sysstat
blob: e976b470549d7f7a88304e7ea25aef280fd5a0f7 (plain) (blame)
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
#compdef mpstat cifsiostat isag sadf sar pidstat
# -V can appear with other options, so (- *) isn't needed.
#TODO:
# sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat.

_mpstat() {
  _arguments : \
    '-A[equivalent to -u -I ALL -P ALL]' \
    '-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
    '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
    '-u[report CPU utilization]' \
    '-V[print version number]' \
    '1: : _guard "^-*" interval' \
    '2: : _guard "^-*" count'
}

_cifsiostat() {
  _arguments : \
    '-h[human readable]' \
    '(-m)-k[display statistics in kB/s]' \
    '(-k)-m[display statistics in MB/s]' \
    '-t[print timestamp for each report]' \
    '-V[print version number]' \
    '1: : _guard "^-*" interval' \
    '2: : _guard "^-*" count'
}

_isag() {
  _arguments : \
    '-p[specify path to daily data files]:path:_files -/' \
    '-c[specify configuration file]:configuration file:_files' \
    '-ght[specify height of the chart]:height' \
    '-gwd[specify width of the chart]:width'
}

_sadf() {
  local ret=1
  # any options after `--' are for sar(1)
  if ! (( CURRENT > $words[(i)--] )); then
    _arguments : \
      '-C[display comments in file]' \
      '(-j -p -x)-d[output file in SQL format]' \
      '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
      '-H[display only the header of the report]' \
      '(-j -p -x)-h[print on a single line when used with -d]' \
      '(-d -p -x)-j[output file in JSON]' \
      '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
      '(-j -x -d)-p[print in format parsable by tools like awk]' \
      '-s[set starting time of report]:starting time (HH\:MM\:SS)"' \
      '(-t -U)-T[display timestamp in local time]' \
      '(-T -U)-t[display timestamp in file\''s original localtime]' \
      '(-t -T)-U[display in seconds since epoch (UTC)]' \
      '-V[print version number]' \
      '(-j -d -p)-x[output file in XML]' \
      '1: : _guard "^-*" interval' \
      '2: : _guard "^-*" count' \
      '3:data file:_files' && ret=0
  else
    _arguments : '*::sar: _sar' && ret=0
  fi
  return ret
}

_sar() {
  _arguments : \
    '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \
    '-B[report paging statistics]' \
    '-b[report I/O and transfer rate statistics]' \
    '-C[display comments from sadc]' \
    '-d[report activity for each block device]' \
    '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
    '-F[display statistics for mounted filesystems]' \
    '-f[extract records from file]:record:_files' \
    '-H[report hugepages utilization]' \
    '-h[display help]' \
    '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
    '-i[select records as close as possible to interval]:interval' \
    '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
    '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
    '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \
    '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
    '-p[pretty-print device names]' \
    '-q[report queue length and load averages]' \
    '-R[report memory statistics]' \
    '-r[report memory utilization statistics]' \
    '-S[report swap space utilization]' \
    '-s[set starting time of report]:start time (HH\:MM\:SS)' \
    '-u[report CPU utilization]: :(ALL)' \
    '-V[print version number]' \
    '-v[report status of kernel tables]' \
    '-W[report swapping statistics]' \
    '-w[report task creation and system switching activity]' \
    '-y[report TTY device activity]' \
    '1: : _guard "^-*" interval' \
    '2: : _guard "^-*" count'
}

_pidstat() {
  _arguments : \
    '-C[filter tasks by string]:task filter' \
    '-d[report I/O statistics]' \
    '-h[display on horizontally]' \
    '-I[divide CPU usage by number of processors]' \
    '-l[display process name along with arguments]' \
    '-p[select pid]:pid: _sequence _pids' \
    '-r[report page faults and memory]' \
    '-s[report stack utilization]' \
    '-T[specifies what to monitor]:type:(TASK CHILD ALL)' \
    '-t[display statistics for threads]' \
    '-U[display real username of tasks]::username:_users' \
    '-u[report cpu utilization]' \
    '-V[print version number]' \
    '-v[display values from kernel table]' \
    '-w[report task switching activity]' \
    '1: : _guard "^-*" interval' \
    '2: : _guard "^-*" count'
}

_sysstat() {
  local ret
  _call_function ret _$service && return ret
}

_sysstat "$@"