|
END
} else {
print "$Lang::tr{'profile has errors'}\n \n";
}
}
my $HOSTNAME = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
if ( "$HOSTNAME" ne "" ) {
print <Hostname: | $HOSTNAME |
END
}
if ( -e "/var/ipfire/red/remote-ipaddress" ) {
my $GATEWAY = `cat /var/ipfire/red/remote-ipaddress`;
chomp($GATEWAY);
print <Gateway: | $GATEWAY |
END
}
my $DNS1 = `cat /var/ipfire/red/dns1`;
my $DNS2 = `cat /var/ipfire/red/dns2`;
chomp($DNS1);
chomp($DNS1);
if ( $DNS1 ) { print <DNS-Server: | $DNS1
END
}
if ( $DNS2 ) { print <$DNS2
END
} else { print <
END
}
if ( $netsettings{'GREEN_DEV'} ) { print <$Lang::tr{'lan'}
| $netsettings{'GREEN_ADDRESS'}
|
END
if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE=on` ) {
print "Proxy an";
if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT=on` ) { print " (transparent)"; }
} else { print "Proxy aus"; }
}
if ( $netsettings{'BLUE_DEV'} ) { print <$Lang::tr{'wireless'}
| $netsettings{'BLUE_ADDRESS'}
|
END
if ( `cat /var/ipfire/proxy/advanced/settings | grep ^ENABLE_BLUE=on` ) {
print "Proxy an";
if ( `cat /var/ipfire/proxy/advanced/settings | grep ^TRANSPARENT_BLUE=on` ) { print " (transparent)"; }
} else { print "Proxy aus"; }
}
if ( $netsettings{'ORANGE_DEV'} ) { print <$Lang::tr{'dmz'}
| $netsettings{'ORANGE_ADDRESS'}
| Online
END
}
if ( `cat /var/ipfire/vpn/settings | grep ^ENABLED=on` ||
`cat /var/ipfire/vpn/settings | grep ^ENABLED_BLUE=on` ) {
my $ipsecip = `cat /var/ipfire/vpn/settings | grep ^VPN_IP= | cut -c 8-`;
my @status = `/usr/sbin/ipsec auto --status`;
my %confighash = ();
&General::readhasharray("${General::swroot}/vpn/config", \%confighash);
print <$Lang::tr{'vpn'}
| $ipsecip
| Online
END
my $id = 0;
my $gif;
foreach my $key (keys %confighash) {
if ($confighash{$key}[0] eq 'on') { $gif = 'on.gif'; } else { $gif = 'off.gif'; }
if ($id % 2) {
print " | $confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ") | $confighash{$key}[11] | ";
} else {
print " $confighash{$key}[1] / " . $Lang::tr{"$confighash{$key}[3]"} . " (" . $Lang::tr{"$confighash{$key}[4]"} . ") | $confighash{$key}[11] | ";
}
my $active = "";
if ($confighash{$key}[0] eq 'off') {
$active = "";
} else {
foreach my $line (@status) {
if ($line =~ /\"$confighash{$key}[1]\".*IPsec SA established/) {
$active = "";
}
}
}
print "$active | ";
}
}
if ( `cat /var/ipfire/ovpn/settings | grep ^ENABLED=on` ||
`cat /var/ipfire/ovpn/settings | grep ^ENABLED_BLUE=on` ||
`cat /var/ipfire/ovpn/settings | grep ^ENABLED_ORANGE=on`) {
my $ovpnip = `cat /var/ipfire/ovpn/settings | grep ^DOVPN_SUBNET= | cut -c 14- | sed -e 's\/\\/255.255.255.0\/\/'`;
print <OpenVPN
| $ovpnip
| Online
END
}
# Memory usage warning
my @free = `/usr/bin/free`;
$free[1] =~ m/(\d+)/;
my $mem = $1;
$free[2] =~ m/(\d+)/;
my $used = $1;
my $pct = int 100 * ($mem - $used) / $mem;
if ($used / $mem > 90) {
$warnmessage .= " $Lang::tr{'high memory usage'}: $pct% !\n";
}
# Diskspace usage warning
my @temp=();
my $temp2=();
my @df = `/bin/df -B M -x rootfs`;
foreach my $line (@df) {
next if $line =~ m/^Filesystem/;
if ($line =~ m/root/ ) {
$line =~ m/^.* (\d+)M.*$/;
@temp = split(/ +/,$line);
if ($1<5) {
# available:plain value in MB, and not %used as 10% is too much to waste on small disk
# and root size should not vary during time
$warnmessage .= "$Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$1M !\n";
}
} else {
# $line =~ m/^.* (\d+)m.*$/;
$line =~ m/^.* (\d+)\%.*$/;
if ($1>90) {
@temp = split(/ /,$line);
$temp2=int(100-$1);
$warnmessage .= "$Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$temp2% !\n";
}
}
}
if ($warnmessage) {
print " | $warnmessage | | | | | | | |