def failing_checks(node_address, timeout=30):
 ctx = ssl.create_default_context()
 ctx.check_hostname = False
 ctx.load_verify_locations(cafile='ssl/cacert.pem')
 ctx.verify_mode = ssl.CERT_REQUIRED
 url = 'https://{}:8500/v1/health/state/any'.format(node_address)
 request = urllib2.Request(url)
 auth = ('Basic ' + base64.b64encode(get_credentials()))
 request.add_header('Authorization', auth)
 f = urllib2.urlopen(request, None, timeout, context=ctx)
 checks = json.loads(f.read().decode('utf8'))
 return [c for c in checks if (c.get('Status', '').lower() != 'passing')]

def failing_checks ( node_address , timeout = 30 ) : ctx = ssl . create_default_context ( ) ctx . check_hostname = False ctx . load_verify_locations ( cafile = 'ssl/cacert.pem' ) ctx . verify_mode = ssl . CERT_REQUIRED url = 'https://{}:8500/v1/health/state/any' . format ( node_address ) request = urllib2 . Request ( url ) auth = ( 'Basic ' + base64 . b64encode ( get_credentials ( ) ) ) request . add_header ( 'Authorization' , auth ) f = urllib2 . urlopen ( request , None , timeout , context = ctx ) checks = json . loads ( f . read ( ) . decode ( 'utf8' ) ) return [ c for c in checks if ( c . get ( 'Status' , '' ) . lower ( ) != 'passing' ) ]
returns a list of failing checks .