From 35b3e8f6a84da90b4ea165d52865f057bcb28582 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Tue, 13 Oct 2015 11:29:23 +0200 Subject: [PATCH] added the new option 'extra_args' in 'ntp.pm' to be able to include extra arguments to the command executed --- Changes | 3 +++ lib/ntp.pm | 3 ++- man/man5/monitorix.conf.5 | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 8d92779..32cbd35 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ N.N.N - DD-MMM-2015 ==================== - Added support in ZFS graph for versions older than 0.6.4. +- Added the new option 'extra_args' in 'ntp.pm' to be able to include extra + arguments to the command executed by Monitorix. + (suggested by Matti Pentti, Matti.Pentti AT cimcorp.com) - Fixed a missing identifier in sprintf(). [#109] - Fixed a message of 'use of uninitialized value' in 'port.pm'. [#110] - Fixed the Y-axis title in 'fail2ban.pm'. [#111] diff --git a/lib/ntp.pm b/lib/ntp.pm index e74552b..2840fd6 100644 --- a/lib/ntp.pm +++ b/lib/ntp.pm @@ -136,6 +136,7 @@ sub ntp_update { my ($package, $config, $debug) = @_; my $rrd = $config->{base_lib} . $package . ".rrd"; my $ntp = $config->{ntp}; + my $args = $ntp->{extra_args} || ""; my @data; my $del; @@ -150,7 +151,7 @@ sub ntp_update { my $e = 0; foreach my $h (split(',', $ntp->{list})) { $h = trim($h); - open(IN, "ntpq -pn $h |"); + open(IN, "ntpq -pn $args $h |"); @data = ; close(IN); $cod = $str = $del = $off = $jit = 0; diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index f82055b..3c82649 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -1827,6 +1827,17 @@ For more information on these NTP codes: .P The maximum number of codes allowed for each hostname is 10. .RE +.P +.BI extra_args +.RS +This option includes any extra argument to the NTP command executed by Monitorix, which is "ntpq -pn". This is specially useful if you want to force using IPv4, in this case just define this option like this: +.P +.RS +extra_args = "-4" +.RE +.P +Monitorix will add this extra argument to the NTP command which will become as "ntpq -pn -4". +.RE .SS Fail2ban statistics (fail2ban.rrd) This graph is able to monitor an unlimited number of Fail2ban jails. .P