Skip to content

Commit

Permalink
fixing so if we aren't using service desc's we require a prefix or po…
Browse files Browse the repository at this point in the history
…stfix set. Also fixing a bug with extra :: in the perfdata.
  • Loading branch information
Shawn Sterling committed Oct 10, 2014
1 parent f7308e8 commit 31c8149
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions graphios.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,18 @@ def validate(self):
self.PERFDATA is not '' and
self.HOSTNAME is not ''
):
if "use_service_desc" in cfg:
if self.SERVICEDESC is not '':
if "use_service_desc" in cfg and cfg["use_service_desc"] is True:
if self.SERVICEDESC != '':
self.VALID = True
else:
self.VALID = True
# not using service descriptions
if (
self.GRAPHITEPREFIX == "" and
self.GRAPHITEPOSTFIX == ""
):
self.VALID = False
else:
self.VALID = True


def chk_bool(value):
Expand Down Expand Up @@ -290,7 +297,7 @@ def get_mobj(nag_array):
"""
mobj = GraphiosMetric()
for var in nag_array:
(var_name, value) = var.split('::')
(var_name, value) = var.split('::', 1)
value = re.sub("/", cfg["replacement_character"], value)
if re.search("PERFDATA", var_name):
mobj.PERFDATA = value
Expand Down

0 comments on commit 31c8149

Please sign in to comment.