From: llua <llua@gmx.com>
To: zsh-workers@zsh.org
Subject: [PATCH] Initial commit for completion of the sysstat suite.
Date: Tue, 31 Dec 2013 17:19:37 -0500 [thread overview]
Message-ID: <1388528377-1772-1-git-send-email-llua@gmx.com> (raw)
From: Eric Cook <llua@gmx.com>
I've been using this for awhile, it may be of use to others. :D
---
Completion/Linux/Command/_sysstat | 150 ++++++++++++++++++++++++++++++++++++++
1 file changed, 150 insertions(+)
create mode 100644 Completion/Linux/Command/_sysstat
diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
new file mode 100644
index 0000000..60de9d8
--- /dev/null
+++ b/Completion/Linux/Command/_sysstat
@@ -0,0 +1,150 @@
+#compdef -P mpstat (|cifs)iostat 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() {
+ local ret=1
+ _arguments : \
+ '-A[equivalent to -u -I ALL -P ALL]' \
+ '-I[report interrupt statistics]:interrupts:(SUM CPU SCPU ALL)' \
+ '-P[specify processor number]:processor: _values -s "," processor ON ALL' \
+ '-u[report CPU utilization]' \
+ '-V[print version number]' \
+ '1:interval:_guard "[0-9]#" "interval"' \
+ '2:count:_guard "[0-9]#" "count"' && ret=0
+ return ret
+}
+
+_iostat() {
+ local ret=1
+ _arguments : \
+ '-c[display CPU utilization report]' \
+ '-d[display device utilization report]' \
+ '-T[only display global statistics for group_name]' \
+ '-g[display statistics for a group of devices]:group name: _message "group name"' \
+ '-h[human readable device utilization report]' \
+ '-j[display persistent device name]' \
+ '(-m)-k[display statistics in kB/s]' \
+ '(-k)-m[display statistics in MB/s]' \
+ '-N[display registered device mapper names]' \
+ '1:interval:_guard "[0-9]#" "interval"' \
+ '2:count:_guard "[0-9]#" "count"' && ret=0
+ return ret
+}
+
+_cifsiostat() {
+ local ret=1
+ _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:interval:_guard "[0-9]#" "interval"' \
+ '2:count:_guard "[0-9]#" "count"' && ret=0
+ return ret
+}
+
+_isag() {
+ local ret=1
+ _arguments : \
+ '-p[Pathname to daily data files]:data files: _files -/' \
+ '-c[Specify configuration file]:configuration file: _files' \
+ '-ght[Specify height of the chart]:height: _message "height"' \
+ '-gwd[Specify width of the chart]:width: _message "width"' && ret=0
+ return ret
+}
+
+_sadf() {
+ local ret=1 line state context expl
+ typeset -A opt_args
+ # 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: _message "ending time in localtime(HH\:MM\:SS 24-hour format)"' \
+ '-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: _message "starting time in localtime(HH\:MM\:SS 24-hour format)"' \
+ '(-t -U)-T[display timestamp in local time]' \
+ '(-T -U)-t[display timestamp in file\''s original localtime]' \
+ '(-t -T)-U[display in seconds from epoch(UTC)]' \
+ '-V[print version number]' \
+ '(-j -d -p)-x[output file in XML]' \
+ '1:interval:_guard "[0-9]#" "interval"' \
+ '2:count:_guard "[0-9]#" "count"' && ret=0
+ else
+ _arguments : '*::sar: _sar' && ret=0
+ fi
+ return ret
+}
+
+_sar() {
+ local ret=1
+ _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: _message "ending time (HH\:MM\:SS 24-hour format)"' \
+ '-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: _message "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: _message "start time (HH\:MM\:SS 24-hour format)"' \
+ '-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:interval:_guard "[0-9]#" "interval"' \
+ '2:count:_guard "[0-9]#" "count"' && ret=0
+ return ret
+}
+
+_pidstat() {
+ local ret=1
+ _arguments : \
+ '-C[filter tasks by string]:task: _message "string or regex"' \
+ '-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: _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]' && ret=0
+ return ret
+}
+
+_sysstat() {
+ local ret=1
+ _call_function ret _$service
+ return ret
+}
+
+_sysstat "$@"
--
1.8.5.2
reply other threads:[~2013-12-31 22:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388528377-1772-1-git-send-email-llua@gmx.com \
--to=llua@gmx.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).