|
82 |
success = [] |
82 |
success = [] |
83 |
for mdb_dir in files: |
83 |
for mdb_dir in files: |
84 |
try: |
84 |
try: |
85 |
output = subprocess.check_output(['/usr/bin/mdb_stat', '-e', mdb_dir], close_fds=True, env={'LC_ALL': 'C'}) |
85 |
output = subprocess.check_output(['/usr/bin/mdb_stat', '-ef', mdb_dir], close_fds=True, env={'LC_ALL': 'C'}) |
86 |
except subprocess.CalledProcessError: |
86 |
except subprocess.CalledProcessError: |
87 |
nagios_exit(STATE_CRITICAL, 'mdb_stat -e %s failed' % (mdb_dir,)) |
87 |
nagios_exit(STATE_CRITICAL, 'mdb_stat -ef %s failed' % (mdb_dir,)) |
88 |
|
88 |
|
89 |
stat = dict(line.strip().lower().split(': ', 1) for line in output.splitlines() if ': ' in line) |
89 |
stat = dict(line.strip().lower().split(': ', 1) for line in output.splitlines() if ': ' in line) |
90 |
try: |
90 |
try: |
91 |
in_use = int((int(stat['number of pages used']) * 100) / int(stat['max pages'])) |
91 |
in_use = 100 * (int(stat['number of pages used']) - int(stat['free pages'])) / int(stat['max pages']) |
92 |
except KeyError: # API change in the future |
92 |
except KeyError: # API change in the future |
93 |
nagios_exit(STATE_CRITICAL, 'output of "mdb_stat -e %s" could not be parsed: %s' % (mdb_dir, output,)) |
93 |
nagios_exit(STATE_CRITICAL, 'output of "mdb_stat -e %s" could not be parsed: %s' % (mdb_dir, output,)) |
94 |
|
94 |
|