[Git][NTPsec/ntpsec][master] ntpmon update w/ documentation
James Browning
gitlab at mg.gitlab.com
Tue Sep 11 00:53:40 UTC 2018
James Browning pushed to branch master at NTPsec / ntpsec
Commits:
3bdd791a by James Browning at 2018-09-11T00:12:39Z
ntpmon update w/ documentation
- - - - -
2 changed files:
- docs/includes/ntpmon-body.txt
- ntpclients/ntpmon.py
Changes:
=====================================
docs/includes/ntpmon-body.txt
=====================================
@@ -4,7 +4,7 @@
== Synopsis ==
-+ntpmon+ [hostname]
++ntpmon+ [-dhnuV] [-D lvl] [-l logfile] [host]
== Description ==
@@ -83,6 +83,16 @@ x:: Cleanly terminate the program.
== Options ==
+-d:: Increase output debug message level
+- may appear multiple times
+
+-D:: Set the output debug message level
+- may appear multiple times
+
+-h:: Print a usage message.
+
+-l:: Logs debug messages to the provided filename
+
-n:: Show IP addresses (vs. hostnames)
-u:: Show units
=====================================
ntpclients/ntpmon.py
=====================================
@@ -193,26 +193,26 @@ class OutputContext:
usage = '''
-USAGE: ntpmon [-nudV] [-l logfile] [-D lvl] [host]
+USAGE: ntpmon [-dhnuV] [-D lvl] [-l logfile] [host]
Flg Arg Option-Name Description
- -n no numeric Numeric host addresses
- -u no units Display time with units.
-d no debug-level Increase output debug message level
- may appear multiple times
-D Int set-debug-level Set the output debug message level
- may appear multiple times
- -l Str logfile Logs debug messages to the provided filename
-h no help Print a usage message.
+ -l Str logfile Logs debug messages to the provided filename
+ -n no numeric Numeric host addresses
+ -u no units Display time with units.
-V opt version Output version information and exit
'''
if __name__ == '__main__':
try:
(options, arguments) = getopt.getopt(sys.argv[1:],
- "VhnudD:l:",
- ["version", "numeric", "units",
- "debug", "set-debug-level=",
- "logfile=", "help"])
+ "dD:hl:nuV",
+ ["debug", "help", "logfile=",
+ "numeric", "units",
+ "set-debug-level=", "version"])
except getopt.GetoptError as e:
sys.stderr.write("%s\n" % e)
sys.stderr.write(usage)
@@ -230,25 +230,25 @@ if __name__ == '__main__':
defaultlog = "ntpmon.log"
for (switch, val) in options:
- if switch in ("-V", "--version"):
- print("ntpmon %s" % ntp.util.stdversion())
- raise SystemExit(0)
- elif switch in ("-h", "--help"):
- print(usage)
- raise SystemExit(0)
- elif switch in ("-n", "--numeric"):
- showhostnames = False
- elif switch in ("-u", "--units"):
- showunits = True
- elif switch in ("-d", "--debug"):
+ if switch in ("-d", "--debug"):
debug += 1
elif switch in ("-D", "--set-debug-level"):
errmsg = "Error: -D parameter '%s' not a number\n"
debug = ntp.util.safeargcast(val, int, errmsg, usage)
+ elif switch in ("-h", "--help"):
+ print(usage)
+ raise SystemExit(0)
elif switch in ("-l", "--logfile"):
if logfp is not None:
logfp.close()
logfp = open(val, "a", 1) # 1 => line buffered
+ elif switch in ("-n", "--numeric"):
+ showhostnames = False
+ elif switch in ("-u", "--units"):
+ showunits = True
+ elif switch in ("-V", "--version"):
+ print("ntpmon %s" % ntp.util.stdversion())
+ raise SystemExit(0)
if (logfp is None) and (debug > 0):
logfp = open(defaultlog, "a", 1)
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3bdd791a465395b56083bb4baf09309b667b082f
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3bdd791a465395b56083bb4baf09309b667b082f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180911/f8cd376e/attachment-0001.html>
More information about the vc
mailing list