renamed some options in 'multihost' graph

This commit is contained in:
Jordi Sanfeliu 2013-01-07 12:58:56 +01:00
parent 7f973b3372
commit 1400098ef8
2 changed files with 27 additions and 25 deletions

View File

@ -74,7 +74,7 @@ sub multihost {
my $h2 = trim($remotehost_list[$n2]); my $h2 = trim($remotehost_list[$n2]);
if($h eq $h2) { if($h eq $h2) {
push(@host, $h); push(@host, $h);
push(@url, $multihost->{remotehost_url}->{$n2}); push(@url, $multihost->{remotehost_desc}->{$n2});
} }
} }
} }
@ -82,18 +82,18 @@ sub multihost {
my @remotehost_list = split(',', $multihost->{remotehost_list}); my @remotehost_list = split(',', $multihost->{remotehost_list});
for($n = 0; $n < scalar(@remotehost_list); $n++) { for($n = 0; $n < scalar(@remotehost_list); $n++) {
push(@host, trim($remotehost_list[$n])); push(@host, trim($remotehost_list[$n]));
push(@url, $multihost->{remotehost_url}->{$n}); push(@url, $multihost->{remotehost_desc}->{$n});
} }
} }
$multihost->{imgs_per_row} = 1 unless $multihost->{imgs_per_row} > 1; $multihost->{graphs_per_row} = 1 unless $multihost->{graphs_per_row} > 1;
my $graph = ($cgi->{graph} eq "all" || $cgi->{graph} =~ m/group\[0-9]*/) ? "_system1" : $cgi->{graph}; my $graph = ($cgi->{graph} eq "all" || $cgi->{graph} =~ m/group\[0-9]*/) ? "_system1" : $cgi->{graph};
if($cgi->{val} eq "all" || $cgi->{val} =~ m/group[0-9]*/) { if($cgi->{val} eq "all" || $cgi->{val} =~ m/group[0-9]*/) {
for($n = 0; $n < scalar(@host); $n += $multihost->{imgs_per_row}) { for($n = 0; $n < scalar(@host); $n += $multihost->{graphs_per_row}) {
print "<table cellspacing='5' cellpadding='0' width='1' bgcolor='$colors->{graph_bg_color}' border='1'>\n"; print "<table cellspacing='5' cellpadding='0' width='1' bgcolor='$colors->{graph_bg_color}' border='1'>\n";
print " <tr>\n"; print " <tr>\n";
for($n2 = 0; $n2 < $multihost->{imgs_per_row}; $n2++) { for($n2 = 0; $n2 < $multihost->{graphs_per_row}; $n2++) {
if($n < scalar(@host)) { if($n < scalar(@host)) {
print " <td bgcolor='$colors->{title_bg_color}'>\n"; print " <td bgcolor='$colors->{title_bg_color}'>\n";
print " <font face='Verdana, sans-serif' color='$colors->{fg_color}'>\n"; print " <font face='Verdana, sans-serif' color='$colors->{fg_color}'>\n";
@ -105,7 +105,7 @@ sub multihost {
} }
print " </tr>\n"; print " </tr>\n";
print " <tr>\n"; print " <tr>\n";
for($n2 = 0, $n = $n - $multihost->{imgs_per_row}; $n2 < $multihost->{imgs_per_row}; $n2++) { for($n2 = 0, $n = $n - $multihost->{graphs_per_row}; $n2 < $multihost->{graphs_per_row}; $n2++) {
if($n < scalar(@host)) { if($n < scalar(@host)) {
print " <td bgcolor='$colors->{title_bg_color}' style='vertical-align: top; height: 10%; width: 10%;'>\n"; 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=$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";
@ -116,7 +116,7 @@ sub multihost {
} }
print " </tr>\n"; print " </tr>\n";
print " <tr>\n"; print " <tr>\n";
for($n2 = 0, $n = $n - $multihost->{imgs_per_row}; $n2 < $multihost->{imgs_per_row}; $n2++) { for($n2 = 0, $n = $n - $multihost->{graphs_per_row}; $n2 < $multihost->{graphs_per_row}; $n2++) {
if($n < scalar(@host)) { if($n < scalar(@host)) {
if(lc($multihost->{footer_url}) eq "y") { if(lc($multihost->{footer_url}) eq "y") {
print " <td bgcolor='$colors->{title_bg_color}'>\n"; print " <td bgcolor='$colors->{title_bg_color}'>\n";
@ -129,7 +129,7 @@ sub multihost {
} }
$n++; $n++;
} }
$n = $n - $multihost->{imgs_per_row}; $n = $n - $multihost->{graphs_per_row};
print " </tr>\n"; print " </tr>\n";
print "</table>\n"; print "</table>\n";
print "<br>\n"; print "<br>\n";

View File

@ -400,20 +400,22 @@ alert_rootfs_script = /path/to/script.sh
# PC LAN Internet traffic accounting # PC LAN Internet traffic accounting
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
pc_max = 10 <pc>
pc_rigid = 0 max = 10
pc_limit = 1000 graphs_per_row = 2
pc_imgs_per_row = 2 enable_monthly_reports = n
pc_enable_monthly_reports = n report_lang = en
pc_report_lang = en default_mail = root@localhost
pc_default_mail = root@localhost list = pc101, pc102, pc103, pc104
pc_list = pc101, pc102, pc103, pc104 <desc>
<pc_ip> 0 = 192.168.1.101/32, ace@example.com
0 = 192.168.1.101/32, ace@example.com 1 = 192.168.1.102/32, gene@example.com
1 = 192.168.1.102/32, gene@example.com 2 = 192.168.1.103/32, paul@example.com
2 = 192.168.1.103/32, paul@example.com 3 = 192.168.1.104/32, peter@example.com
3 = 192.168.1.104/32, peter@example.com </desc>
</pc_ip> rigid = 0
limit = 100
</pc>
# Multihost # Multihost
@ -421,13 +423,13 @@ pc_list = pc101, pc102, pc103, pc104
<multihost> <multihost>
enabled = n enabled = n
footer_url = y footer_url = y
imgs_per_row = 2 graphs_per_row = 2
remotehost_list = server 1, server 2, server 3 remotehost_list = server 1, server 2, server 3
<remotehost_url> <remotehost_desc>
0 = http://www.example.com 0 = http://www.example.com
1 = http://10.0.0.1 1 = http://10.0.0.1
2 = http://192.168.0.100:8080 2 = http://192.168.0.100:8080
</remotehost_url> </remotehost_desc>
groups = n groups = n
remotegroup_list = My Group remotegroup_list = My Group
<remotegroup_desc> <remotegroup_desc>