|
END
} else {
print "$Lang::tr{'profile has errors'}\n \n";
}
print <
$Lang::tr{'lan'}:
| $netsettings{'GREEN_ADDRESS'}
|
END
if (`ifconfig | grep $netsettings{'GREEN_DEV'}`) { print "Online"; } else { print "Offline"; }
print <
$Lang::tr{'wireless'}:
| $netsettings{'BLUE_ADDRESS'}
|
END
if (`ifconfig | grep $netsettings{'BLUE_DEV'}`) { print "Online"; } else { print "Offline"; }
print <$Lang::tr{'dmz'}:
| $netsettings{'ORANGE_ADDRESS'}
|
END
if (`ifconfig | grep $netsettings{'ORANGE_DEV'}`) { print "Online"; } else { print "Offline"; }
print <$Lang::tr{'vpn'}:
| N/A
|
END
if (`ifconfig | grep ipsec0`) { print "Online"; } else { print "Offline"; }
print <OpenVPN:
| N/A
|
END
if (`ifconfig | grep tun0`) { print "Online"; } else { print "Offline"; }
print <
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";
}
}
}
# Patches warning
open(AV, "<${General::swroot}/patches/available") or die "Could not open available patches database ($!)";
my @av = ;
close(AV);
open(PF, "<${General::swroot}/patches/installed") or die "Could not open installed patches file. ($!) ";
while()
{
next if $_ =~ m/^#/;
@temp = split(/\|/,$_);
@av = grep(!/^$temp[0]/, @av);
}
close(PF);
if ($#av != -1)
{
$warnmessage .= " $Lang::tr{'there are updates'}";
}
my $age = &General::age("/${General::swroot}/patches/available");
if ($age =~ m/(\d{1,3})d/) {
if ($1 >= 7) {
$warnmessage .= "$Lang::tr{'updates is old1'} $age $Lang::tr{'updates is old2'}\n";
}
}
if ($warnmessage) {
print "$warnmessage ";
}
print "";
system('/usr/bin/uptime');
print " \n";
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
| | | | | |