mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
bugfix: warnings
git-svn-id: https://svn.fhem.de/fhem/trunk@8020 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4ee525148c
commit
69840dac03
@ -1899,14 +1899,25 @@ sub SYSMON_getRamAndSwap($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
shift @speicher;
|
shift @speicher;
|
||||||
my ($fs_desc, $total, $used, $free, $shared, $buffers, $cached) = split(/\s+/, trim($speicher[0]));
|
my ($fs_desc, $total, $used, $free, $shared, $buffers, $cached);
|
||||||
shift @speicher;
|
if(defined ($speicher[0])) {
|
||||||
my ($fs_desc2, $total2, $used2, $free2, $shared2, $buffers2, $cached2) = split(/\s+/, trim($speicher[0]));
|
($fs_desc, $total, $used, $free, $shared, $buffers, $cached) = split(/\s+/, trim($speicher[0]));
|
||||||
|
}
|
||||||
|
|
||||||
if($fs_desc2 ne "Swap:")
|
shift @speicher;
|
||||||
{
|
my ($fs_desc2, $total2, $used2, $free2, $shared2, $buffers2, $cached2);
|
||||||
shift @speicher;
|
|
||||||
($fs_desc2, $total2, $used2, $free2, $shared2, $buffers2, $cached2) = split(/\s+/, trim($speicher[0]));
|
if(defined ($speicher[0])) {
|
||||||
|
($fs_desc2, $total2, $used2, $free2, $shared2, $buffers2, $cached2) = split(/\s+/, trim($speicher[0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
if(defined($fs_desc2)) {
|
||||||
|
if($fs_desc2 ne "Swap:") {
|
||||||
|
shift @speicher;
|
||||||
|
if(defined ($speicher[0])) {
|
||||||
|
($fs_desc2, $total2, $used2, $free2, $shared2, $buffers2, $cached2) = split(/\s+/, trim($speicher[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $ram;
|
my $ram;
|
||||||
@ -1914,7 +1925,7 @@ sub SYSMON_getRamAndSwap($$)
|
|||||||
#my $percentage_ram;
|
#my $percentage_ram;
|
||||||
#my $percentage_swap;
|
#my $percentage_swap;
|
||||||
|
|
||||||
if($total > 0) {
|
if(defined($total) && $total > 0) {
|
||||||
|
|
||||||
$total = $total / 1024;
|
$total = $total / 1024;
|
||||||
$used = $used / 1024;
|
$used = $used / 1024;
|
||||||
@ -1936,7 +1947,7 @@ sub SYSMON_getRamAndSwap($$)
|
|||||||
$map->{+RAM} = $ram;
|
$map->{+RAM} = $ram;
|
||||||
|
|
||||||
# wenn kein swap definiert ist, ist die Groesse (total2) gleich Null. Dies wuerde eine Exception (division by zero) ausloesen
|
# wenn kein swap definiert ist, ist die Groesse (total2) gleich Null. Dies wuerde eine Exception (division by zero) ausloesen
|
||||||
if($total2 > 0)
|
if(defined($total2) && $total2 > 0)
|
||||||
{
|
{
|
||||||
$total2 = $total2 / 1024;
|
$total2 = $total2 / 1024;
|
||||||
$used2 = $used2 / 1024;
|
$used2 = $used2 / 1024;
|
||||||
@ -2422,14 +2433,16 @@ sub SYSMON_getNetworkInfo ($$$)
|
|||||||
my $lastVal = ReadingsVal($hash->{NAME},$nName,"RX: 0 MB, TX: 0 MB, Total: 0 MB");
|
my $lastVal = ReadingsVal($hash->{NAME},$nName,"RX: 0 MB, TX: 0 MB, Total: 0 MB");
|
||||||
my ($d0, $o_rx, $d1, $d2, $o_tx, $d3, $d4, $o_tt, $d5) = split(/\s+/, trim($lastVal));
|
my ($d0, $o_rx, $d1, $d2, $o_tx, $d3, $d4, $o_tt, $d5) = split(/\s+/, trim($lastVal));
|
||||||
|
|
||||||
my $d_rx = $rx-$o_rx;
|
if(defined($o_tx) && defined($o_tt)) {
|
||||||
if($d_rx<0) {$d_rx=0;}
|
my $d_rx = $rx-$o_rx;
|
||||||
my $d_tx = $tx-$o_tx;
|
if($d_rx<0) {$d_rx=0;}
|
||||||
if($d_tx<0) {$d_tx=0;}
|
my $d_tx = $tx-$o_tx;
|
||||||
my $d_tt = $totalRxTx-$o_tt;
|
if($d_tx<0) {$d_tx=0;}
|
||||||
if($d_tt<0) {$d_tt=0;}
|
my $d_tt = $totalRxTx-$o_tt;
|
||||||
my $out_txt_diff = "RX: ".sprintf ("%.2f", $d_rx)." MB, TX: ".sprintf ("%.2f", $d_tx)." MB, Total: ".sprintf ("%.2f", $d_tt)." MB";
|
if($d_tt<0) {$d_tt=0;}
|
||||||
$map->{$nName.DIFF_SUFFIX} = $out_txt_diff;
|
my $out_txt_diff = "RX: ".sprintf ("%.2f", $d_rx)." MB, TX: ".sprintf ("%.2f", $d_tx)." MB, Total: ".sprintf ("%.2f", $d_tt)." MB";
|
||||||
|
$map->{$nName.DIFF_SUFFIX} = $out_txt_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#Log 3, "SYSMON>>>>>>>>>>>>>>>>> NOK ";
|
#Log 3, "SYSMON>>>>>>>>>>>>>>>>> NOK ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user