Skip to content

Commit

Permalink
Resolved issue with status_file not being included correctly and retu…
Browse files Browse the repository at this point in the history
…rning a list instead of a \n delimited string
  • Loading branch information
Rob Tucker committed Oct 19, 2011
1 parent 15c6efc commit c9337cf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MozillaNagiosStatus.py
Expand Up @@ -205,7 +205,7 @@ def validate_host(self, host):
##Following is for the test case to pass. We shouldn't ever have a host with this name
if host == 'test-host.fake.mozilla.com':
return True
conf = self.parseConf(STATUS_FILE)
conf = self.parseConf(self.status_file)
if host is None:
host = options.group(1)
host = host.strip()
Expand Down Expand Up @@ -261,7 +261,7 @@ def nagios_status(self, event, message, options):
services_passive_warning_count += 1
if entry['current_state'] == '2' and entry['check_type'] == '1':
services_passive_down_count += 1
return_msg = ["%s: Status file is %i seconds stale" % (event.source, self.file_age_in_seconds(STATUS_FILE)),
return_msg = ["%s: Status file is %i seconds stale" % (event.source, self.file_age_in_seconds(self.status_file)),
"%s: Hosts Total/Up/Warning/Down" % (event.source),
"%s: %s/%s/%s/%s" % (event.source, total_host_count, hosts_up_count, hosts_warning_count, hosts_down_count),
"%s: Services Total/Up/Warning/Down" % (event.source),
Expand Down Expand Up @@ -518,7 +518,7 @@ def parseConf(self, inputFile):
return False

def status_by_host_name(self, event, message, options):
conf = self.parseConf(self.STATUS_FILE)
conf = self.parseConf(self.status_file)
service_statuses = []
if conf is not False:
hostname = options.group(1)
Expand Down Expand Up @@ -576,10 +576,10 @@ def status_by_host_name(self, event, message, options):
state_string = format.color('CRITICAL', format.RED)
write_string = "%s: %s:%s is %s - %s" % (event.source, hostname, entry['service_description'], state_string, entry['plugin_output'])
output_list.append(write_string)
if len(output_list) < service_output_limit:
return event.target, "\n".join(output_list)
if len(output_list) < self.service_output_limit:
return event.target, output_list
else:
write_string = "%s: more than %i services returned. Please be more specific." % (event.source, service_output_limit)
write_string = "%s: more than %i services returned. Please be more specific." % (event.source, self.service_output_limit)
return event.target, write_string
else:
host_found = False
Expand Down

0 comments on commit c9337cf

Please sign in to comment.