[Git][NTPsec/ntpsec][master] 3 commits: Added loglevel config-file statement, updated docs.
Ian Bruene
gitlab at mg.gitlab.com
Sun Feb 25 23:30:54 UTC 2018
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
e277db4e by Ian Bruene at 2018-02-25T16:16:40-06:00
Added loglevel config-file statement, updated docs.
- - - - -
67feaeea by Ian Bruene at 2018-02-25T16:23:23-06:00
master-addr config command now properly handles both address types.
- - - - -
c34dc16f by Ian Bruene at 2018-02-25T17:30:12-06:00
Added option to specify a non-standard configuration file.
- - - - -
2 changed files:
- docs/includes/ntpsnmpd-body.txt
- ntpclients/ntpsnmpd.py
Changes:
=====================================
docs/includes/ntpsnmpd-body.txt
=====================================
--- a/docs/includes/ntpsnmpd-body.txt
+++ b/docs/includes/ntpsnmpd-body.txt
@@ -4,7 +4,7 @@
== Synopsis ==
-+ntpsnmpd+ [+-ndDV+] [ntp host]
++ntpsnmpd+ [+-nxdDlhV+] [ntp host]
== Description ==
@@ -16,6 +16,8 @@ running NTP and SNMP daemons for ntpsnmpd to work.
== Options ==
++-c+ filename, +--configfile+=filename::
+ The path of the configuration file, /etc/ntpsnmpd.conf by default
+-n+, +--nofork+::
Do not fork
+-x+, +--master-addr+::
@@ -31,10 +33,14 @@ running NTP and SNMP daemons for ntpsnmpd to work.
+-V+, +--version+::
Print the version string and exit.
+== Files ==
+
+/etc/ntpsnmpd.conf the default name of the configuration file
+
== Known Limitations ==
This is still a prototype. Parts of the AgentX standard are not yet fully
-implemented.
+implemented, logging not fleshed out yet, some options missing, etc.
== Known Deviations from RFC 5907 ==
=====================================
ntpclients/ntpsnmpd.py
=====================================
--- a/ntpclients/ntpsnmpd.py
+++ b/ntpclients/ntpsnmpd.py
@@ -1134,9 +1134,9 @@ if __name__ == "__main__":
try:
(options, arguments) = getopt.getopt(
sys.argv[1:],
- "nx:dD:Vhl:",
+ "nx:dD:Vhl:c:",
["no-fork", "master-address=", "debug-level", "set-debug-level=",
- "version", "help", "logfile="])
+ "version", "help", "logfile=", "configfile="])
except getopt.GetoptError as e:
sys.stderr.write("%s\n" % e)
sys.stderr.write(usage)
@@ -1145,17 +1145,34 @@ if __name__ == "__main__":
masterAddr = "/var/agentx/master"
logfile = DEFLOG
hostname = DEFHOST
+
+ # Check for non-default config-file
+ conffile = "/etc/ntpsnmpd.conf"
+ for (switch, val) in options:
+ if switch in ("-c", "--configfile"):
+ conffile = val
+ break
+
# Load configuration file
- conf = loadSettings("/etc/ntpsnmpd.conf",
- ("master-addr", "logfile", "ntp-addr"))
+ conf = loadSettings(conffile,
+ ("master-addr", "logfile", "loglevel", "ntp-addr"))
if conf is not None:
for key in conf.keys():
- if key == "master-addr":
- masterAddr = conf[key]
+ if key == "master-addr": # Address of the SNMP master daemon
+ val = conf[key]
+ if ":" in val:
+ host, port = val.split(":")
+ port = int(port)
+ masterAddr = (host, port)
+ else:
+ masterAddr = val
elif key == "logfile":
logfile = conf[key]
- elif key == "ntp-addr":
+ elif key == "ntp-addr": # Address of the NTP daemon
hostname = conf[key]
+ elif key == "loglevel":
+ errmsg = "Error: loglevel parameter '%s' not a number\n"
+ debug = ntp.util.safeargcast(conf[key], int, errmsg, usage)
fileLogging = False
for (switch, val) in options:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bb4823ea2751bc4551b6a00f81292156cfacc6c4...c34dc16f36557cc9e19ff8537ebffa5805606512
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/bb4823ea2751bc4551b6a00f81292156cfacc6c4...c34dc16f36557cc9e19ff8537ebffa5805606512
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/20180225/1a85842d/attachment.html>
More information about the vc
mailing list