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
if(open(OUT, "> " . $config{base_dir} . "/cgi/monitorix.conf.path")) {
print(OUT "$options{c}\n");
print(OUT "$options{s}\n");
close(OUT);
} else {
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");
my $config_path = <IN>;
my $split_policy = <IN>;
chomp($config_path);
close(IN);
$split_policy = "guess" if !defined($split_policy);
chomp($split_policy);
if(! -f $config_path) {
print(<< "EOF");
Content-Type: text/plain
@ -249,7 +253,8 @@ EOF
# load main configuration file
my $conf = new Config::General(
-ConfigFile => $config_path,
-ConfigFile => $config_path,
-SplitPolicy => $split_policy,
);
%config = $conf->getall;
@ -261,7 +266,8 @@ if($config{include_dir} && opendir(DIR, $config{include_dir})) {
next unless -f $config{include_dir} . "/$c";
next unless $c =~ m/\.conf$/;
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;
while(my ($key, $val) = each(%config_inc)) {