mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
32_SYSSTAT.pm: allow space, comma and newline as separator in the mibs attribute
git-svn-id: https://svn.fhem.de/fhem/trunk@9460 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
60a258bff5
commit
0de88bffbb
@ -361,15 +361,21 @@ SYSSTAT_GetUpdate($)
|
|||||||
if( $hash->{USE_SNMP} && defined($hash->{session}) ) {
|
if( $hash->{USE_SNMP} && defined($hash->{session}) ) {
|
||||||
if( my $mibs = AttrVal($name, "mibs", undef) ) {
|
if( my $mibs = AttrVal($name, "mibs", undef) ) {
|
||||||
my @snmpoids;
|
my @snmpoids;
|
||||||
foreach my $entry (split(' ,', $mibs)) {
|
foreach my $entry (split(/[ ,\n]/, $mibs)) {
|
||||||
|
next if( !$entry );
|
||||||
my($mib,undef) = split(':', $entry );
|
my($mib,undef) = split(':', $entry );
|
||||||
|
next if( !$mib );
|
||||||
|
|
||||||
push @snmpoids, $mib;
|
push @snmpoids, $mib;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $response = SYSSTAT_readOIDs($hash,\@snmpoids);
|
my $response = SYSSTAT_readOIDs($hash,\@snmpoids);
|
||||||
|
|
||||||
foreach my $entry (split(' ,', $mibs)) {
|
foreach my $entry (split(/[ ,\n]/, $mibs)) {
|
||||||
|
next if( !$entry );
|
||||||
my($mib,$reading) = split(':', $entry );
|
my($mib,$reading) = split(':', $entry );
|
||||||
|
next if( !$mib );
|
||||||
|
next if( !$reading );
|
||||||
|
|
||||||
my $result = $response->{$mib};
|
my $result = $response->{$mib};
|
||||||
readingsBulkUpdate($hash,$reading,$result);
|
readingsBulkUpdate($hash,$reading,$result);
|
||||||
@ -481,7 +487,7 @@ SYSSTAT_readOIDs($$)
|
|||||||
|
|
||||||
if( ref($snmpoids) eq "ARRAY" ) {
|
if( ref($snmpoids) eq "ARRAY" ) {
|
||||||
$response = $hash->{session}->get_request( @{$snmpoids} );
|
$response = $hash->{session}->get_request( @{$snmpoids} );
|
||||||
Log3 $name, 4, "$name: got empty result from snmp query" if( !$response );
|
Log3 $name, 4, "$name: got empty result from snmp query ".$hash->{session}->error() if( !$response );
|
||||||
} else {
|
} else {
|
||||||
$response = $hash->{session}->get_next_request($snmpoids);
|
$response = $hash->{session}->get_next_request($snmpoids);
|
||||||
|
|
||||||
@ -494,7 +500,8 @@ SYSSTAT_readOIDs($$)
|
|||||||
@nextid = keys %$response;
|
@nextid = keys %$response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $hash->{session}->get_request( @snmpoids )
|
$response = $hash->{session}->get_request( @snmpoids );
|
||||||
|
#Log3 $name, 4, "$name: got empty result from snmp query ".$hash->{session}->error() if( !$response );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user