From 6ec4b822edbf67cd06c4fcfb4cb9f7e4e0e0bf00 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 6 May 2021 18:58:11 +0200 Subject: [PATCH] added the new command line option '-s' to decide which part of a line in the config file will be the key and which one will be the value. The split policy accepts the values 'guess' (as the default), 'whitespace' and 'equalsign' --- monitorix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monitorix b/monitorix index 526ee94..9ae3d6a 100755 --- a/monitorix +++ b/monitorix @@ -112,7 +112,7 @@ sub daemonize { sub usage { print(STDERR << "EOF"); -Usage: monitorix -c configfile [-p pidfile] [-d none | graph[,graph] | all ] [-v] [-n] [-u] +Usage: monitorix -c configfile [-p pidfile] [-d none | graph[,graph] | all ] [-v] [-n] [-u] [-s splitpolicy] EOF exit(1); @@ -486,7 +486,7 @@ EOF # Main # ---------------------------------------------------------------------------- -getopts("c:p:d:vnu", \%options) || usage(); +getopts("c:p:d:vnus:", \%options) || usage(); if($options{v}) { print("Monitorix version " . VERSION . " (" . RELDATE . ")\n"); @@ -504,8 +504,10 @@ if(!stat($options{c})) { } # load main configuration file +$options{s} = "guess" if !defined($options{s}); my $conf = new Config::General( - -ConfigFile => $options{c}, + -ConfigFile => $options{c}, + -SplitPolicy => $options{s}, ); %config = $conf->getall; $config{debug} = ();