Skip to content

Commit

Permalink
Merge pull request #5 from k0ste/newfeature
Browse files Browse the repository at this point in the history
Changeset for support Luminous 12.2.2
  • Loading branch information
Crapworks committed Dec 9, 2017
2 parents ce45b7d + 93ca10e commit fafe1cb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions check-ceph-dash.py
Expand Up @@ -33,7 +33,10 @@ def _map(self, status):
return ('UNKNOWN', 3)

def get_perf_data(self):
nagios_str, nagios_exit = self._map(self['health']['overall_status'])
if 'status' in self['health']:
nagios_str, nagios_exit = self._map(self['health']['status'])
else:
nagios_str, nagios_exit = self._map(self['health']['overall_status'])
if nagios_exit == 3:
return ""

Expand Down Expand Up @@ -65,7 +68,10 @@ def get_perf_data(self):
return perfdata

def get_exit_code(self):
nagios_str, nagios_exit = self._map(self['health']['overall_status'])
if 'status' in self['health']:
nagios_str, nagios_exit = self._map(self['health']['status'])
else:
nagios_str, nagios_exit = self._map(self['health']['overall_status'])
return int(nagios_exit)

def get_nagios_string(self):
Expand All @@ -76,10 +82,10 @@ def get_nagios_string(self):
if nagios_exit == 0:
summary = 'ceph cluster operates with no problems'
else:
if 'summary' in self['health']:
summary = '\n'.join([ "{severity}: {summary}".format(**problems) for problems in self['health']['summary']])
elif 'checks' in self['health']:
if 'checks' in self['health']:
summary = '\n'.join([ "{severity}: {summary[message]}".format(**problems) for problems in self['health']['checks'].values()])
elif 'summary' in self['health']:
summary = '\n'.join([ "{severity}: {summary}".format(**problems) for problems in self['health']['summary']])
else:
summary = 'Unable to fetch healt details. Please check cluster directly'

Expand Down

0 comments on commit fafe1cb

Please sign in to comment.