1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin unifi_api: handle missing error fields in response

It seems to be possible, that the response lacks the values for
`rx_errors` and `tx_errors`.  This should not result in warnings due to
undefined values.

Thanks, kboenke!

Closes: #1095
This commit is contained in:
Lars Kruse 2020-07-12 19:14:07 +02:00
parent 83737c4fe0
commit bd1302c3f2

View file

@ -1033,7 +1033,7 @@ sub make_data {
'label' => $label . '-' . $thisDevice->{'name'},
'pckt' => $_->{$name . '-rx_packets'} + $_->{$name . '-tx_packets'},
'dret' => $_->{$name . '-rx_dropped'} + $_->{$name . '-tx_retries'} + $_->{$name . '-tx_dropped'},
'err' => $_->{$name . '-rx_errors'} + $_->{$name . '-tx_errors'},
'err' => ($_->{$name . '-rx_errors'} || 0) + ($_->{$name . '-tx_errors'} || 0),
'type' => $label
};
}
@ -1209,4 +1209,4 @@ sub env_default_bool_true {
}
# Quick 2 digit zero pad
sub zPad { return sprintf("%02d", $_[0]); }
sub zPad { return sprintf("%02d", $_[0]); }