1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 10:23:46 +01:00
This commit is contained in:
Páll Guðjón Sigurðsson 2010-10-20 14:25:23 +00:00
parent 87b137f762
commit 890a8aed51

View File

@ -321,7 +321,13 @@ def end(summary,perfdata,longserviceoutput,nagios_state):
debug( "do_phone_home = %s" %(do_phone_home) ) debug( "do_phone_home = %s" %(do_phone_home) )
if do_phone_home == True: if do_phone_home == True:
try: try:
if nagios_myhostname == None: nagios_myhostname = hostname if nagios_myhostname is None:
if environ.has_key( 'HOSTNAME' ):
nagios_myhostname = environ['HOSTNAME']
elif environ.has_key( 'COMPUTERNAME' ):
nagios_myhostname = environ['COMPUTERNAME']
else:
nagios_myhostname = hostname
phone_home(nagios_server,nagios_port, status=nagios_state, message=message, hostname=nagios_myhostname, servicename=mode,system=check_system) phone_home(nagios_server,nagios_port, status=nagios_state, message=message, hostname=nagios_myhostname, servicename=mode,system=check_system)
except: except:
raise raise
@ -344,7 +350,8 @@ class ProxiedTransport(xmlrpclib.Transport):
''' phone_home: Sends results to remote nagios server via python xml-rpc ''' ''' phone_home: Sends results to remote nagios server via python xml-rpc '''
def phone_home(nagios_server,nagios_port, status, message, hostname=None, servicename=None,system=None): def phone_home(nagios_server,nagios_port, status, message, hostname=None, servicename=None,system=None):
debug("phoning home: %s" % (servicename) ) debug("phoning home: %s" % (servicename) )
servicename = str(servicename) + str(system) if system is not None:
servicename = str(servicename) + str(system)
uri = "http://%s:%s" % (nagios_server,nagios_port) uri = "http://%s:%s" % (nagios_server,nagios_port)
global proxyserver global proxyserver