Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/nagios/files/check_memory

Issue 29382622: Noissue - Handle nodes without swap (Closed)
Patch Set: Created March 13, 2017, 11:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/nagios/files/check_memory
===================================================================
--- a/modules/nagios/files/check_memory
+++ b/modules/nagios/files/check_memory
@@ -42,7 +42,7 @@
swapfree = meminfo.get("swapfree", 0) + meminfo.get("swapcached", 0)
mempercentage = round(float(memfree) / memtotal * 100)
- swappercentage = round(float(swapfree) / swaptotal * 100)
+ swappercentage = round(float(swapfree) / swaptotal * 100) if swaptotal else 0
status = "memory %i%% (%s/%s) swap %i%% (%s/%s)" % (
mempercentage, format_memory(memfree), format_memory(memtotal),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld