Commit 73f073fe authored by Tristan Cavelier's avatar Tristan Cavelier

check_computer_memory: no abbreviations

parent ba4b3b4c
...@@ -16,7 +16,7 @@ from slapos.collect.db import Database ...@@ -16,7 +16,7 @@ from slapos.collect.db import Database
def getMemoryInfo(database, time, date): def getMemoryInfo(database, time, date):
mem = {} memory_info = {}
database = Database(database) database = Database(database)
try: try:
database.connect() database.connect()
...@@ -24,7 +24,7 @@ def getMemoryInfo(database, time, date): ...@@ -24,7 +24,7 @@ def getMemoryInfo(database, time, date):
result = zip(*query_result) result = zip(*query_result)
if not result or not result[0][0]: if not result or not result[0][0]:
return (None, "couldn't fetch total memory, collectordb is empty?") return (None, "couldn't fetch total memory, collectordb is empty?")
mem['total'] = result[0][0] memory_info['total'] = result[0][0]
# fetch free and used memory # fetch free and used memory
where_query = "time between '%s:00' and '%s:30' " % (time, time) where_query = "time between '%s:00' and '%s:30' " % (time, time)
...@@ -32,14 +32,14 @@ def getMemoryInfo(database, time, date): ...@@ -32,14 +32,14 @@ def getMemoryInfo(database, time, date):
result = zip(*query_result) result = zip(*query_result)
if not result or not result[0][0]: if not result or not result[0][0]:
return (None, "couldn't fetch free memory") return (None, "couldn't fetch free memory")
mem['free'] = result[0][0] memory_info['free'] = result[0][0]
if not result or not result[1][0]: if not result or not result[1][0]:
return (None, "couldn't fetch used memory") return (None, "couldn't fetch used memory")
mem['used'] = result[1][0] memory_info['used'] = result[1][0]
finally: finally:
database.close() database.close()
return (mem, "") return (memory_info, "")
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment