Fix network module. (#694)
* default rounding should be 0. * we also should only be calculating bytes_recv, bytes_sent if we are displaying network traffic
This commit is contained in:
parent
f461b1b953
commit
01ca308eaf
@ -340,7 +340,7 @@ class Network(IntervalModule, ColorRangeModule):
|
|||||||
|
|
||||||
# Network traffic settings
|
# Network traffic settings
|
||||||
divisor = 1024
|
divisor = 1024
|
||||||
round_size = None
|
round_size = 0
|
||||||
auto_units = False
|
auto_units = False
|
||||||
|
|
||||||
# Network info settings
|
# Network info settings
|
||||||
@ -476,12 +476,14 @@ class Network(IntervalModule, ColorRangeModule):
|
|||||||
format_values.update(network_info)
|
format_values.update(network_info)
|
||||||
format_values['interface'] = self.interface
|
format_values['interface'] = self.interface
|
||||||
|
|
||||||
for metric in ('bytes_recv', 'bytes_sent'):
|
if self.network_traffic:
|
||||||
if self.auto_units:
|
for metric in ('bytes_recv', 'bytes_sent'):
|
||||||
format_values[metric] = '{value:.{round}f}{unit}'.format(
|
if self.auto_units:
|
||||||
round=self.round_size, **bytes_info_dict(format_values[metric]))
|
format_values[metric] = '{value:.{round}f}{unit}'.format(
|
||||||
else:
|
round=self.round_size, **bytes_info_dict(format_values[metric]))
|
||||||
format_values[metric] = '{:.{round}f}'.format(format_values[metric] / self.divisor, round=self.round_size)
|
else:
|
||||||
|
format_values[metric] = '{:.{round}f}'.format(format_values[metric] / self.divisor,
|
||||||
|
round=self.round_size)
|
||||||
|
|
||||||
self.data = format_values
|
self.data = format_values
|
||||||
self.output = {
|
self.output = {
|
||||||
|
Loading…
Reference in New Issue
Block a user