Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: snmptop utility. #142

Merged
merged 9 commits into from
Jul 15, 2017
Prev Previous commit
Next Next commit
Refactoring: pylint warnings fixed.
  • Loading branch information
strizhechenko committed Jul 15, 2017
commit 3652d6f7d41590879dafdec785b21a8a2c261d9c
11 changes: 6 additions & 5 deletions netutils_linux_monitoring/snmptop.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def eval(self):
""" Evaluates difference between snmp metrics """
self.diff = deepcopy(self.current)
for proto, data in iteritems(self.diff):
for n, metric in enumerate(data):
key, value = metric
for i, metric in enumerate(data):
_, value = metric
if isinstance(value, int):
if self.options.random:
self.diff[proto][n][1] = randint(0, 1000)
self.diff[proto][i][1] = randint(0, 1000)
else:
self.diff[proto][n][1] -= self.previous[proto][n][1]
self.diff[proto][i][1] -= self.previous[proto][i][1]

@staticmethod
def __listify(list_of_tuples):
Expand All @@ -61,7 +61,8 @@ def __repr__(self):
table = make_table(self.make_header(), self.make_align_map(), self.make_rows())
return self.__repr_table__(table)

def make_header(self):
@staticmethod
def make_header():
""" :returns: header for prettytable output (provides unique invisible whitespace-headers)

6, 5, 4 spaces are for column blinking avoidance.
Expand Down