Hi,
while we still, let's switch the meaning of -f and -P switch to match
the other tools.
Drop the remotely related but now-useless self.argless while at it.
Add few words about command line options to the TODO file.
---
qa/1069 | 4 ++--
src/pmrep/TODO | 23 +++++++++++++++++------
src/pmrep/pmrep.1 | 46 +++++++++++++++++++++++-----------------------
src/pmrep/pmrep.conf.5 | 4 ++--
src/pmrep/pmrep.py | 13 ++++++-------
5 files changed, 50 insertions(+), 40 deletions(-)
diff --git a/qa/1069 b/qa/1069
index 9c04ed3..f442dcb 100755
--- a/qa/1069
+++ b/qa/1069
@@ -33,7 +33,7 @@ echo "== basic live mode reporting"
pmrep -p -s 2 -t 0.25 sample.long.one | _live_filter
echo "== basic archive mode reporting"
-pmrep -z -p -s 5 -t 2 -f 2 --archive $here/archives/sample-secs \
+pmrep -z -p -s 5 -t 2 -P 2 --archive $here/archives/sample-secs \
sample.seconds sample.milliseconds
echo "== basic configuration file handling"
@@ -47,7 +47,7 @@ echo "== exercise raw counter mode "
pmrep -s 5 -t 2 $log -c $tmp.config -r sample
echo "== exercise CSV and alternate delimiters"
-pmrep -s 5 -t 2 $log -c $tmp.config -o csv -p -f 1 sample
+pmrep -s 5 -t 2 $log -c $tmp.config -o csv -p -P 1 sample
pmrep -s 5 -t 2 $log -c $tmp.config -o csv --delimiter '|' sample
echo "== exercise repeated headers option"
diff --git a/src/pmrep/TODO b/src/pmrep/TODO
index 8f60eed..e1ab178 100644
--- a/src/pmrep/TODO
+++ b/src/pmrep/TODO
@@ -1,12 +1,12 @@
- after first release: drop all compat code
- after first release: check all code marked with BZ references
-- allow defining instances to display
-- opt to write cols per row with stdout output
-- -Q/-B/-Y/-W to override per-metric unit/scale/width
+- allow defining instances to display [-i]
+- opt to write cols per row with stdout output [-k]
+- -Q/-B/-Y/-r/-W to override per-metric unit/scale/raw/width
- maybe adjust unit/scale handling to ~match fetchgroup
- shorten unit display count / sec -> count/s -> c/s if needed
-- opt to output in short format (see pmdumptext -F / pmNumberStr)
-- -X to support pmdumptext -X like output (or shorten inst names if needed)
+- opt to output in short format (see pmdumptext -F / pmNumberStr) [-m/-M]
+- opt to support pmdumptext -X like output (or shorten inst names if needed)
- bash/zsh completion with short help (allow description for sets?)
- containers support
- verify CSV format
@@ -23,4 +23,15 @@
- generalised daemon startup support (?)
- provide percentage metrics (e.g. CPU/:vmstat) (?)
- add option to prevent truncating string output (?)
-- optionally ignore incompatible/unsupported metrics rather than abort (?)
+- optionally ignore incompatible/unsupported metrics rather than abort [-I]
(?)
+
+-----
+
+In use / "reserved" cmd line options:
+AaBbcCdDeEGhHKLloOqQrRsStTuUVwWxyYzZ
+
+Tentatively reserved:
+iIgkmMpv
+
+Available:
+jJnNX
diff --git a/src/pmrep/pmrep.1 b/src/pmrep/pmrep.1
index d8e8e5f..f08afaf 100644
--- a/src/pmrep/pmrep.1
+++ b/src/pmrep/pmrep.1
@@ -26,14 +26,14 @@
[\f3\-c\f1 \f2config\f1]
[\f3\-e\f1 \f2derived\f1]
[\f3\-E\f1 \f2lines\f1]
-[\f3\-f\f1 \f2precision\f1]
+[\f3\-f\f1 \f2format\f1]
[\f3\-F\f1 \f2archive\f1]
[\f3\-h\f1 \f2host\f1]
[\f3\-K\f1 \f2spec\f1]
[\f3\-l\f1 \f2delimiter\f1]
[\f3\-o\f1 \f2output\f1]
[\f3\-O\f1 \f2origin\f1]
-[\f3\-P\f1 \f2timefmt\f1]
+[\f3\-P\f1 \f2precision\f1]
[\f3\-q\f1 \f2count-scale\f1]
[\f3\-R\f1 \f2runtime\f1]
[\f3\-s\f1 \f2samples\f1]
@@ -281,14 +281,19 @@ Repeat the header every
of output.
.TP
.B \-f
-Use
-.I precision
-for numeric non-integer output values.
-If the value is too wide for its column width,
-.I precision
-is reduced one by one until the value fits, or not printed at all if it
-does not.
-The default is to use 3 decimal places (when applicable).
+Use the
+.I format
+string for formatting the timestamp.
+The format will be used with
+Python's
+.B datetime.strftime
+method which is mostly the same as that described in
+.BR strftime (3).
+An empty
+.I format
+string (i.e., '') will remove the timestamps from the output.
+The default is
+.BR %H:%M:%S .
.TP
.B \-F
Specify the output
@@ -400,19 +405,14 @@ Print timestamps.
By default no timestamps are printed.
.TP
.B \-P
-Use the
-.I timefmt
-format string for formatting the timestamp.
-The format will be used with
-Python's
-.B datetime.strftime
-method which is mostly the same as that described in
-.BR strftime (3).
-An empty
-.I timefmt
-string (i.e., '') will remove the timestamps from the output.
-The default is
-.BR %H:%M:%S .
+Use
+.I precision
+for numeric non-integer output values.
+If the value is too wide for its column width,
+.I precision
+is reduced one by one until the value fits, or not printed at all if it
+does not.
+The default is to use 3 decimal places (when applicable).
.TP
.B \-q
.I Unit/scale
diff --git a/src/pmrep/pmrep.conf.5 b/src/pmrep/pmrep.conf.5
index 4acc34f..c1eaa35 100644
--- a/src/pmrep/pmrep.conf.5
+++ b/src/pmrep/pmrep.conf.5
@@ -204,7 +204,7 @@ shortest width that can fit the metric label.
precision (integer)
.RS 4
Indicates how many decimals to use for numeric non-integer output
-values. Corresponding command line parameter is \fB-f\fR. Defaults to
+values. Corresponding command line parameter is \fB-P\fR. Defaults to
\fB3\fR.
.RE
.P
@@ -230,7 +230,7 @@ parameter is \fB-E\fR. Defaults to \fB0\fR.
timefmt (string)
.RS 4
Indicates the format string for formatting the timestamp. Corresponding
-command line parameter is \fB-P\fR. Defaults to \fB%H:%M:%S\fR.
+command line parameter is \fB-f\fR. Defaults to \fB%H:%M:%S\fR.
.RE
.P
interpol (bool)
diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index 627d0d6..dd2230d 100644
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -173,8 +173,7 @@ class PMReporter(object):
'count_scale', 'space_scale', 'time_scale', 'version',
'zabbix_server', 'zabbix_port', 'zabbix_host',
'zabbix_interval')
- # Command line switches without arguments
- self.argless = ('-C', '-L', '-H', '-U', '-G', '-p', '-d', '--delay',
'-r', '--raw', '-x', '--extended-header', '-u')
+ # Special command line switches
self.arghelp = ('-?', '--help', '-V', '--version')
# The order of preference for parameters (as present):
@@ -300,7 +299,7 @@ class PMReporter(object):
opts = pmapi.pmOptions()
opts.pmSetOptionCallback(self.option)
opts.pmSetOverrideCallback(self.option_override)
-
opts.pmSetShortOptions("a:h:LK:c:Co:F:e:D:V?HUGpA:S:T:O:s:t:R:Z:zdrw:f:l:xE:P:uq:b:y:")
+
opts.pmSetShortOptions("a:h:LK:c:Co:F:e:D:V?HUGpA:S:T:O:s:t:R:Z:zdrw:P:l:xE:f:uq:b:y:")
opts.pmSetShortUsage("[option...] metricspec [...]")
opts.pmSetLongOptionHeader("General options")
@@ -335,11 +334,11 @@ class PMReporter(object):
opts.pmSetLongOption("delay", 0, "d", "", "delay, pause between
updates for archive replay")
opts.pmSetLongOption("raw", 0, "r", "", "output raw counter values (no
rate conversion)")
opts.pmSetLongOption("width", 1, "w", "N", "default column width")
- opts.pmSetLongOption("fixed-point", 1, "f", "N", "N digits after the
decimal separator (if width enough)")
+ opts.pmSetLongOption("precision", 1, "P", "N", "N digits after the
decimal separator (if width enough)")
opts.pmSetLongOption("delimiter", 1, "l", "STR", "delimiter to
separate csv/stdout columns")
opts.pmSetLongOption("extended-header", 0, "x", "", "display extended
header")
opts.pmSetLongOption("repeat-header", 1, "E", "N", "repeat stdout
headers every N lines")
- opts.pmSetLongOption("timestamp-format", 1, "P", "STR", "strftime
string for timestamp format")
+ opts.pmSetLongOption("timestamp-format", 1, "f", "STR", "strftime
string for timestamp format")
opts.pmSetLongOption("no-interpolation", 0, "u", "", "disable
interpolation mode with archives")
opts.pmSetLongOption("count-scale", 1, "q", "SCALE", "default count
unit")
opts.pmSetLongOption("space-scale", 1, "b", "SCALE", "default space
unit")
@@ -394,7 +393,7 @@ class PMReporter(object):
self.raw = 1
elif opt == 'w':
self.width = int(optarg)
- elif opt == 'f':
+ elif opt == 'P':
self.precision = int(optarg)
elif opt == 'l':
self.delimiter = optarg
@@ -402,7 +401,7 @@ class PMReporter(object):
self.extheader = 1
elif opt == 'E':
self.repeat_header = int(optarg)
- elif opt == 'P':
+ elif opt == 'f':
self.timefmt = optarg
elif opt == 'u':
self.interpol = 0
Thanks,
--
Marko Myllynen
|