added support of the new argument '-s' also in monitorix.cgi

This commit is contained in:
Jordi Sanfeliu 2021-05-31 12:31:04 +02:00
parent 8d263a97b3
commit de3cdc655e
2 changed files with 9 additions and 2 deletions

View File

@ -658,6 +658,7 @@ if(!$config{use_external_firewall}) {
# save the path of the configuration file # save the path of the configuration file
if(open(OUT, "> " . $config{base_dir} . "/cgi/monitorix.conf.path")) { if(open(OUT, "> " . $config{base_dir} . "/cgi/monitorix.conf.path")) {
print(OUT "$options{c}\n"); print(OUT "$options{c}\n");
print(OUT "$options{s}\n");
close(OUT); close(OUT);
} else { } else {
logger("WARNING: unable to create the file '$config{base_dir}/cgi/monitorix.conf.path'. $!"); logger("WARNING: unable to create the file '$config{base_dir}/cgi/monitorix.conf.path'. $!");

View File

@ -227,9 +227,13 @@ sub graph_footer {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
open(IN, dirname(__FILE__)."/monitorix.conf.path"); open(IN, dirname(__FILE__)."/monitorix.conf.path");
my $config_path = <IN>; my $config_path = <IN>;
my $split_policy = <IN>;
chomp($config_path); chomp($config_path);
close(IN); close(IN);
$split_policy = "guess" if !defined($split_policy);
chomp($split_policy);
if(! -f $config_path) { if(! -f $config_path) {
print(<< "EOF"); print(<< "EOF");
Content-Type: text/plain Content-Type: text/plain
@ -250,6 +254,7 @@ EOF
# load main configuration file # load main configuration file
my $conf = new Config::General( my $conf = new Config::General(
-ConfigFile => $config_path, -ConfigFile => $config_path,
-SplitPolicy => $split_policy,
); );
%config = $conf->getall; %config = $conf->getall;
@ -262,6 +267,7 @@ if($config{include_dir} && opendir(DIR, $config{include_dir})) {
next unless $c =~ m/\.conf$/; next unless $c =~ m/\.conf$/;
my $conf_inc = new Config::General( my $conf_inc = new Config::General(
-ConfigFile => $config{include_dir} . "/$c", -ConfigFile => $config{include_dir} . "/$c",
-SplitPolicy => $split_policy,
); );
my %config_inc = $conf_inc->getall; my %config_inc = $conf_inc->getall;
while(my ($key, $val) = each(%config_inc)) { while(my ($key, $val) = each(%config_inc)) {