about summary refs log tree commit diff
path: root/Completion/Linux/Command/_sysstat
blob: 855bf0a709faad8fafad46e2898ea900dd4edadf (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#compdef mpstat cifsiostat isag sadf sar pidstat
#TODO:
# sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat.

_mpstat() {
  _arguments -S : \
    '(-n -u -I -N -P)-A[equivalent to -n -u -I ALL -N ALL -P ALL]' \
    '(-A)-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
    '(-A)-N[specify NUMA nodes]:NUMA node' \
    '(-A)-n[report summary CPU statistics based on NUMA node placement]' \
    '-o[display statistics in JSON]:format:(JSON)' \
    '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
    '-u[report CPU utilization]' \
    '(- 1 2)-V[display version information]' \
    '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]' \
    '(- 1 2)-V[print version number]' \
    '--human[print sizes in human readable format]' \
    '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 i ret=1
  # any options after `--' are for sar(1)
  if (( CURRENT <= $words[(i)--] )); then
    _arguments : \
      '-C[display comments in file]' \
      '-c[convert an old datafile to the new format]' \
      '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
      '-H[display only the header of the report]' \
      '(-g -j -p -r -x)-h[print on a single line when used with -d]' \
      '-O[specify output options]: : _values -s , option
        autoscale height\:value oneday packed showidle showinfo skipempty showhints' \
      '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
      '-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)]' \
      '(- 1 2 3)-V[print version number]' \
      '1: : _guard "^-*" interval' \
      '2: : _guard "^-*" count' \
      '3:data file:_files' \
      + '(format)' \
      '-d[output file in SQL format]' \
      '-g[print data in SVG format]' \
      '-j[output file in JSON]' \
      '-p[print in format parsable by tools like awk]' \
      '-r[print raw contents of data file]' \
      '-x[output file in XML]' \
      && ret=0
  else
    (( i = words[(i)--] - 1, CURRENT -= i ))
    shift i words
    _sar && ret=0
  fi
  return ret
}

_sar() {
  _arguments -s : \
    '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -r ALL -u ALL -P ALL]' \
    '-B[report paging statistics]' \
    '-b[report I/O and transfer rate statistics]' \
    '-C[display comments from sadc]' \
    '-D[use saYYYYMMDD instead of saDD as the standard system activity daily data file name]' \
    '-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]' \
    '--human[print sizes in human readable format]' \
    '*-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' \
    '-o[save readings to file in binary form]:file:_files' \
    '-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)' \
    '--sadc[print name of data collector]' \
    '-t[display timestamps in original local time of file creator]' \
    '-u[report CPU utilization]: :(ALL)' \
    '(- 1 2)-V[display version information]' \
    '-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 -s : \
    '-C[filter tasks by string]:task filter' \
    '-d[report I/O statistics]' \
    '-e[execute specified program and monitor it with pidstat]:*::command: _normal' \
    '-H[display timestamp in seconds since the epoch]' \
    '-h[display horizontally]' \
    '-I[divide CPU usage by number of processors]' \
    '-l[display process name along with arguments]' \
    '*-p[select pid]:pid: _sequence _pids' \
    '-R[report realtime priority and scheduling policy information]' \
    '-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]' \
    '(- 1 2)-V[display version information]' \
    '-v[display values from kernel table]' \
    '-w[report task switching activity]' \
    '-G[include only processes with specified name]:process name' \
    '--human[print sizes in human readable format]' \
    '1: : _guard "^-*" interval' \
    '2: : _guard "^-*" count'
}

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

_sysstat "$@"