add swap check

This commit is contained in:
Adrien Beudin 2013-10-04 21:51:04 +02:00
parent 720f0a5a0d
commit f357060ed9
2 changed files with 9 additions and 1 deletions

View file

@ -396,6 +396,10 @@ monitor:
full: --memory full: --memory
help: Check Memory help: Check Memory
action: store_true action: store_true
-s:
full: --swap
help: Check Swap
action: store_true
-c: -c:
full: --cpu full: --cpu
help: Check CPU help: Check CPU

View file

@ -113,7 +113,7 @@ def process_check(args):
return { 'Status' : result } return { 'Status' : result }
def monitor_info(memory=False, cpu=False, disk=False, ifconfig=False, uptime=False, public=False): def monitor_info(memory=False, swap=False, cpu=False, disk=False, ifconfig=False, uptime=False, public=False):
""" """
Check System Check System
@ -123,12 +123,16 @@ def monitor_info(memory=False, cpu=False, disk=False, ifconfig=False, uptime=Fal
public -- Show IP public public -- Show IP public
cpu -- Check CPU cpu -- Check CPU
memory -- Check Memory memory -- Check Memory
swap -- Check Swap
ifconfig -- Show Ip and MAC Adress ifconfig -- Show Ip and MAC Adress
""" """
if memory: if memory:
return json.loads(s.getMem()) return json.loads(s.getMem())
if swap:
return json.loads(s.getMemSwap())
elif cpu: elif cpu:
return json.loads(s.getLoad()) return json.loads(s.getLoad())