Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

include performance_data (parsed) with state/service check

  • Loading branch information...
commit 7e443e00440b45a38ebafa6af71d59ed57152afd 1 parent b8ea3c2
@scoates scoates authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 nagios/core.py
View
12 nagios/core.py
@@ -36,6 +36,16 @@ def next_stanza(f):
cur = {'type': line.split(' ', 1)[0]}
elif '=' in line:
key, val = line.split('=', 1)
+ if key == "performance_data":
+ # performance_data is special
+ performance_data = {}
+ split = val.split(' ')
+ for dat in split:
+ chunks = dat.split(';', 1)
+ if chunks and len(chunks) > 0 and '=' in chunks[0]:
+ (c_key, c_val) = chunks[0].split('=', 1)
+ performance_data[c_key] = c_val
+ val = performance_data
cur[key] = val
if cur is not None:
yield cur
@@ -125,7 +135,7 @@ def __init__(self, obj):
self.essential_keys = ['current_state', 'plugin_output',
'notifications_enabled', 'last_check', 'last_notification',
'active_checks_enabled', 'problem_has_been_acknowledged',
- 'last_hard_state', 'scheduled_downtime_depth']
+ 'last_hard_state', 'scheduled_downtime_depth', 'performance_data']
def attach_downtime(self, dt):
'''Given a Downtime object, store a record to it for lookup later.'''
Please sign in to comment.
Something went wrong with that request. Please try again.