Revision 314

Date:
2010/02/05 15:34:43
Author:
alan
Revision Log:
Handle no swap on FreeBSD
Files:

Legend:

 
Added
 
Removed
 
Modified
  • binarystor/trunk/src/python/dbalerter/daemon/dbalerter/checkos.py

     
    36 36 """Check host swap usage"""
    37 37
    38 38 swap_usage = get_swap_usage()
    39 threshold = int(config.get('dbAlerter', 'os_swap_threshold'))
    40 swap_capacity = int((100/swap_usage['total']) * swap_usage['used'])
    41 if (swap_capacity > threshold):
    42 notify.stateful_notify(True, warning_state, 'SWAP_USAGE', 'Warning', 'OS Swap usage threshold crossed', 'OS Swap usage is currently ' + str(swap_capacity) + '% (Threshold currently set to ' + str(threshold) + '%)')
    43 else:
    44 notify.stateful_notify(False, warning_state, 'SWAP_USAGE', 'Info', 'OS Swap usage returned below threshold', 'OS Swap usage is currently ' + str(swap_capacity) + '% (Threshold currently set to ' + str(threshold) + '%)')
    39 if (swap_usage['total']):
    40 threshold = int(config.get('dbAlerter', 'os_swap_threshold'))
    41 swap_capacity = int((100/swap_usage['total']) * swap_usage['used'])
    42 if (swap_capacity > threshold):
    43 notify.stateful_notify(True, warning_state, 'SWAP_USAGE', 'Warning', 'OS Swap usage threshold crossed', 'OS Swap usage is currently ' + str(swap_capacity) + '% (Threshold currently set to ' + str(threshold) + '%)')
    44 else:
    45 notify.stateful_notify(False, warning_state, 'SWAP_USAGE', 'Info', 'OS Swap usage returned below threshold', 'OS Swap usage is currently ' + str(swap_capacity) + '% (Threshold currently set to ' + str(threshold) + '%)')
    45 46
    46 47 def check_memory_usage():
    47 48 """Check host memory usage"""