1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 02:13:44 +01:00

--escape-newlines added

This commit is contained in:
Páll Guðjón Sigurðsson 2010-09-08 16:24:34 +00:00
parent afd5494569
commit 0f99d2b5e6

View File

@ -295,13 +295,13 @@ def end(summary,perfdata,longserviceoutput,nagios_state):
global escape_newlines global escape_newlines
message = "%s - %s" % ( state[nagios_state], summary) message = "%s - %s" % ( state[nagios_state], summary)
if escape_newlines == True:
lines = message.split('\n')
message = '\\n'.join(lines)
if show_perfdata: if show_perfdata:
message = "%s | %s" % ( message, perfdata) message = "%s | %s" % ( message, perfdata)
if show_longserviceoutput: if show_longserviceoutput:
message = "%s\n%s" % ( message, longserviceoutput.strip()) message = "%s\n%s" % ( message, longserviceoutput.strip())
if escape_newlines == True:
lines = message.split('\n')
message = '\\n'.join(lines)
if nagios_server is not None: if nagios_server is not None:
try: try:
phone_home(nagios_server,nagios_port, status=nagios_state, message=message, hostname=nagios_myhostname, servicename=mode) phone_home(nagios_server,nagios_port, status=nagios_state, message=message, hostname=nagios_myhostname, servicename=mode)