Handle 0 swap

This commit is contained in:
Dave Pedu 2015-12-06 23:18:31 -08:00
parent dfe1da1599
commit 539d307003
1 changed files with 2 additions and 2 deletions

View File

@ -7,8 +7,8 @@ computed_fields = {
"mempctfree": lambda items: 1-round((items["memtotal"]-items["memfree"])/items["memtotal"], 2),
"mempctused_nocache": lambda items: round((items["memtotal"]-items["memfree"]-items["cached"])/items["memtotal"], 2),
"mempctfree_nocache": lambda items: 1-round((items["memtotal"]-items["memfree"]-items["cached"])/items["memtotal"], 2),
"swappctused": lambda items: round((items["swaptotal"]-items["swapfree"])/items["swaptotal"], 2),
"swappctfree": lambda items: 1-round((items["swaptotal"]-items["swapfree"])/items["swaptotal"], 2)
"swappctused": lambda items: round((items["swaptotal"]-items["swapfree"])/items["swaptotal"] if items["swaptotal"] > 0 else 0, 2),
"swappctfree": lambda items: 1-round((items["swaptotal"]-items["swapfree"])/items["swaptotal"] if items["swaptotal"] > 0 else 0, 2)
}
def meminfo(whitelist=[]):