updated configuration file to support the new HTTP builtin server

This commit is contained in:
Jordi Sanfeliu 2013-02-07 18:37:09 +01:00
parent 768f2e27dd
commit c52c959ef8
4 changed files with 18 additions and 16 deletions

View File

@ -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)$/);

View File

@ -185,7 +185,7 @@ sub create_index {
<html>
<head>
<title>$config{title}</title>
<link rel="shortcut icon" href="$config{base_url}$config{favicon}">
<link rel="shortcut icon" href="$config{base_url}/$config{favicon}">
</head>
<body bgcolor="$bgcolor" text="#888888" vlink="#888888" link="#888888">
<center>
@ -195,7 +195,7 @@ sub create_index {
<table>
<tr>
<td>
<a href="http://www.monitorix.org/"><img src="$config{base_url}$config{logo_top}" border="0"></a>
<a href="http://www.monitorix.org/"><img src="$config{base_url}/$config{logo_top}" border="0"></a>
</td>
</tr>
<tr>
@ -205,7 +205,7 @@ sub create_index {
</tr>
</table>
<p>
<form action="$config{base_cgi}monitorix.cgi" method="get">
<form action="$config{base_cgi}/monitorix.cgi" method="get">
<table cellspacing="5" cellpadding="0" bgcolor="$table_back_color" border="1">
<tr>
<td bgcolor="$title_back_color">

View File

@ -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 " <td bgcolor='$colors->{title_bg_color}' style='vertical-align: top; height: 10%; width: 10%;'>\n";
print " <iframe src=$url[$n]$config->{base_cgi}monitorix.cgi?mode=localhost&when=$cgi->{when}&graph=$graph&color=$cgi->{color}&silent=imagetag height=201 width=397 frameborder=0 marginwidth=0 marginheight=0 scrolling=no></iframe>\n";
print " <iframe src=" . (split(',', $multihost->{remotehost_desc}->{$n}))[0] . (split(',', $multihost->{remotehost_desc}->{$n}))[2] . "/monitorix.cgi?mode=localhost&when=$cgi->{when}&graph=$graph&color=$cgi->{color}&silent=imagetag height=201 width=397 frameborder=0 marginwidth=0 marginheight=0 scrolling=no></iframe>\n";
print " </td>\n";
}
@ -122,7 +122,7 @@ sub multihost {
print " <td bgcolor='$colors->{title_bg_color}'>\n";
print " <font face='Verdana, sans-serif' color='$colors->{title_fg_color}'>\n";
print " <font size='-1'>\n";
print " <b>&nbsp;&nbsp;<a href='" . $url[$n] . $config->{base_url} . "/' style='{color: " . $colors->{title_fg_color} . "}'>$url[$n]</a><b>\n";
print " <b>&nbsp;&nbsp;<a href='" . $url[$n] . "' style='{color: " . $colors->{title_fg_color} . "}'>$url[$n]</a><b>\n";
print " </font></font>\n";
print " </td>\n";
}
@ -145,7 +145,7 @@ sub multihost {
print " </tr>\n";
print " <tr>\n";
print " <td bgcolor='$colors->{title_bg_color}' style='vertical-align: top; height: 10%; width: 10%;'>\n";
print " <iframe src=$url[$cgi->{val}]$config->{base_cgi}monitorix.cgi?mode=localhost&when=$cgi->{when}&graph=$graph&color=$cgi->{color}&silent=imagetagbig height=249 width=545 frameborder=0 marginwidth=0 marginheight=0 scrolling=no></iframe>\n";
print " <iframe src=" . (split(',', $multihost->{remotehost_desc}->{$cgi->{val}}))[0] . (split(',', $multihost->{remotehost_desc}->{$cgi->{val}}))[2] . "/monitorix.cgi?mode=localhost&when=$cgi->{when}&graph=$graph&color=$cgi->{color}&silent=imagetagbig height=249 width=545 frameborder=0 marginwidth=0 marginheight=0 scrolling=no></iframe>\n";
print " </td>\n";
print " </tr>\n";
print " <tr>\n";
@ -153,7 +153,7 @@ sub multihost {
print " <td bgcolor='$colors->{title_bg_color}'>\n";
print " <font face='Verdana, sans-serif' color='$colors->{title_fg_color}'>\n";
print " <font size='-1'>\n";
print " <b>&nbsp;&nbsp;<a href='" . $url[$cgi->{val}] . "/monitorix/' style='{color: " . $colors->{title_fg_color} . "}'>$url[$cgi->{val}]</a><b>\n";
print " <b>&nbsp;&nbsp;<a href='" . $url[$cgi->{val}] . "' style='{color: " . $colors->{title_fg_color} . "}'>$url[$cgi->{val}]</a><b>\n";
print " </font></font>\n";
print " </td>\n";
}
@ -320,7 +320,7 @@ if(!$silent) {
print("<html>\n");
print(" <head>\n");
print(" <title>$config{title}</title>\n");
print(" <link rel='shortcut icon' href='" . $config{base_url} . $config{favicon} . "'>\n");
print(" <link rel='shortcut icon' href='" . $config{base_url} . "/" . $config{favicon} . "'>\n");
if($config{refresh_rate}) {
print(" <meta http-equiv='Refresh' content='" . $config{refresh_rate} . "'>\n");
}
@ -430,7 +430,7 @@ if(!$silent) {
print(" </font>\n");
print(" </center>\n");
print(" <p>\n");
print(" <a href='http://www.monitorix.org'><img src='" . $config{url} . $config{logo_bottom} . "' border='0'></a>\n");
print(" <a href='http://www.monitorix.org'><img src='" . $config{url} . "/" . $config{logo_bottom} . "' border='0'></a>\n");
print(" <br>\n");
print(" <font face='Verdana, sans-serif' color='" . $colors{fg_color} . "' size='-2'>\n");
print("Copyright &copy; 2005-2013 Jordi Sanfeliu\n");

View File

@ -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
<httpd_builtin>
enabled = y
@ -444,9 +444,9 @@ ftp_log_date_format = %b %e
graphs_per_row = 2
remotehost_list = server 1, server 2, server 3
<remotehost_desc>
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,/,/
</remotehost_desc>
groups = n
remotegroup_list = My Group