From c52c959ef8cf749e9e6361467f067b282a796a21 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 7 Feb 2013 18:37:09 +0100 Subject: [PATCH] updated configuration file to support the new HTTP builtin server --- lib/HTTPServer.pm | 2 ++ monitorix | 6 +++--- monitorix.cgi | 16 ++++++++-------- monitorix.conf | 10 +++++----- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/HTTPServer.pm b/lib/HTTPServer.pm index d906c9b..65849dd 100644 --- a/lib/HTTPServer.pm +++ b/lib/HTTPServer.pm @@ -82,12 +82,14 @@ sub handle_request { my $cur = length($target); $target =~ s/\.\.\///; $target =~ s/^\///; + $target =~ s/\/$//; last unless $cur ne length $target; } $target = "/$target"; $target =~ s/^$base_url//; # removes the 'base_url' part $target =~ s/^$base_cgi//; # removes the 'base_cgi' part + $target =~ s/^\///; # removes leading slash $target = "index.html" unless $target; ($mimetype) = ($target =~ m/.*\.(html|cgi|png)$/); diff --git a/monitorix b/monitorix index 60948fb..1f422ca 100755 --- a/monitorix +++ b/monitorix @@ -185,7 +185,7 @@ sub create_index { $config{title} - +
@@ -195,7 +195,7 @@ sub create_index { @@ -205,7 +205,7 @@ sub create_index {
- +

-

+ \n"; } @@ -122,7 +122,7 @@ sub multihost { print " \n"; } @@ -145,7 +145,7 @@ sub multihost { print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; @@ -153,7 +153,7 @@ sub multihost { print " \n"; } @@ -320,7 +320,7 @@ if(!$silent) { print("\n"); print(" \n"); print(" $config{title}\n"); - print(" \n"); + print(" \n"); if($config{refresh_rate}) { print(" \n"); } @@ -430,7 +430,7 @@ if(!$silent) { print(" \n"); print(" \n"); print("

\n"); - print(" \n"); + print(" \n"); print("
\n"); print(" \n"); print("Copyright © 2005-2013 Jordi Sanfeliu\n"); diff --git a/monitorix.conf b/monitorix.conf index cf10031..0963cf0 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -14,8 +14,8 @@ disable_javascript_void = n base_dir = /usr/share/monitorix/ base_lib = /var/lib/monitorix/ -base_url = /monitorix/ -base_cgi = /monitorix/ +base_url = /monitorix +base_cgi = /monitorix-cgi enabled = y @@ -444,9 +444,9 @@ ftp_log_date_format = %b %e graphs_per_row = 2 remotehost_list = server 1, server 2, server 3 - 0 = http://www.example.com - 1 = http://10.0.0.1 - 2 = http://192.168.0.100:8080 + 0 = http://www.example.com,/monitorix,/monitorix-cgi + 1 = http://10.0.0.1,/monitorix,/monitorix-cgi + 2 = http://192.168.0.100:8080,/,/ groups = n remotegroup_list = My Group

diff --git a/monitorix.cgi b/monitorix.cgi index 24e5104..b251f2f 100755 --- a/monitorix.cgi +++ b/monitorix.cgi @@ -74,7 +74,7 @@ sub multihost { my $h2 = trim($remotehost_list[$n2]); if($h eq $h2) { push(@host, $h); - push(@url, $multihost->{remotehost_desc}->{$n2}); + push(@url, (split(',', $multihost->{remotehost_desc}->{$n}))[0] . (split(',', $multihost->{remotehost_desc}->{$n}))[1]); } } } @@ -82,7 +82,7 @@ sub multihost { my @remotehost_list = split(',', $multihost->{remotehost_list}); for($n = 0; $n < scalar(@remotehost_list); $n++) { push(@host, trim($remotehost_list[$n])); - push(@url, $multihost->{remotehost_desc}->{$n}); + push(@url, (split(',', $multihost->{remotehost_desc}->{$n}))[0] . (split(',', $multihost->{remotehost_desc}->{$n}))[1]); } } @@ -108,7 +108,7 @@ sub multihost { for($n2 = 0, $n = $n - $multihost->{graphs_per_row}; $n2 < $multihost->{graphs_per_row}; $n2++) { if($n < scalar(@host)) { print " \n"; - print " \n"; + print " \n"; print " \n"; print " \n"; print " \n"; - print "   $url[$n]\n"; + print "   $url[$n]\n"; print " \n"; print "
\n"; - print " \n"; + print " \n"; print "
\n"; print " \n"; print " \n"; - print "   $url[$cgi->{val}]\n"; + print "   $url[$cgi->{val}]\n"; print " \n"; print "