#NEWLINE# def _get_data( self , instance ) : #NEWLINE# #INDENT# url = instance . get ( 'nginx_status_url' ) #NEWLINE# ssl_validation = instance . get ( 'ssl_validation' , True ) #NEWLINE# auth = None #NEWLINE# if ( ( 'user' in instance ) and ( 'password' in instance ) ) : #NEWLINE# #INDENT# auth = ( instance [ 'user' ] , instance [ 'password' ] ) #NEWLINE# #UNINDENT# parsed_url = urlparse . urlparse ( url ) #NEWLINE# nginx_host = parsed_url . hostname #NEWLINE# nginx_port = ( parsed_url . port or 80 ) #NEWLINE# service_check_name = 'nginx.can_connect' #NEWLINE# service_check_tags = [ ( 'host:%s' % parsed_url ) , ( 'port:%s' % nginx_port ) ] #NEWLINE# try : #NEWLINE# #INDENT# r = requests . get ( url , auth = auth , headers = headers ( self . agentConfig ) , verify = ssl_validation ) #NEWLINE# r . raise_for_status ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . service_check ( service_check_name , AgentCheck . CRITICAL , tags = service_check_tags ) #NEWLINE# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . service_check ( service_check_name , AgentCheck . OK , tags = service_check_tags ) #NEWLINE# #UNINDENT# body = r . content #NEWLINE# resp_headers = r . headers #NEWLINE# return ( body , resp_headers . get ( 'content-type' , 'text/plain' ) )