Exemplo n.º 1
0
 def create_connection(self):
     self.con = HTTPClient(address=self.arb_satmap['address'],
                           port=self.arb_satmap['port'],
                           timeout=self.timeout,
                           data_timeout=self.data_timeout,
                           use_ssl=self.use_ssl)
     self.uri = self.con.uri
Exemplo n.º 2
0
    def pynag_con_init(self, id, type='scheduler'):
        # Get the good links tab for looping..
        links = self.get_links_from_type(type)
        if links is None:
            logger.debug('Type unknown for connection! %s' % type)
            return

        if type == 'scheduler':
            # If sched is not active, I do not try to init
            # it is just useless
            is_active = links[id]['active']
            if not is_active:
                return

        # If we try to connect too much, we slow down our tests
        if self.is_connection_try_too_close(links[id]):
            return

        # Ok, we can now update it
        links[id]['last_connection'] = time.time()

        # DBG: print "Init connection with", links[id]['uri']
        running_id = links[id]['running_id']
        # DBG: print "Running id before connection", running_id
        uri = links[id]['uri']
        try:
            con = links[id]['con'] = HTTPClient(
                uri=uri, strong_ssl=links[id]['hard_ssl_name_check'])
        except HTTPExceptions, exp:
            # But the multiprocessing module is not compatible with it!
            # so we must disable it immediately after
            logger.info("Connection problem to the %s %s: %s" %
                        (type, links[id]['name'], str(exp)))
            links[id]['con'] = None
            return
Exemplo n.º 3
0
 def __init__(self):
     self.name = ''
     self.type = ''
     self.app = None
     self.stats = {}
     self.api_key = ''
     self.secret = ''
     self.con = HTTPClient(uri='http://kernel.shinken.io')
Exemplo n.º 4
0
 def __init__(self):
     self.name = ''
     self.type = ''
     self.app = None
     self.stats = {}
     self.api_key = ''
     self.secret = ''
     self.cyph = None
     self.con = HTTPClient(uri='http://metrology')
Exemplo n.º 5
0
 def __init__(self):
     self.name = ''
     self.type = ''
     self.app = None
     self.stats = {}
     # There are two modes that are not exclusive
     # first the kernel mode
     self.api_key = ''
     self.secret = ''
     self.http_proxy = ''
     self.con = HTTPClient(uri='http://kernel.shinken.io')
     # then the statsd one
     self.statsd_sock = None
     self.statsd_addr = None
Exemplo n.º 6
0
 def __init__(self):
     self.name = ''
     self.type = ''
     self.app = None
     self.stats = {}
     # There are two modes that are not exclusive
     # first the kernel mode
     self.api_key = ''
     self.secret = ''
     self.http_proxy = ''
     self.con = HTTPClient(uri='http://kernel.shinken.io')
     # then the statsd one
     self.statsd_interval = 5
     self.statsd_types = ['system', 'queue', 'perf']
     self.statsd_sock = None
     self.statsd_addr = None
     self.statsd_types = 'system,object,queue,perf'
     self.statsd_pattern = None
     self.name_cache = {}
Exemplo n.º 7
0

daemon=options.daemon

if daemon not in daemon_types:
    print 'CRITICAL - ', daemon, 'is not a Shinken daemon!'
    parser.print_help()
    raise SystemExit(CRITICAL)

port=options.portnum
if port==0:
    port=daemon_types[daemon]

con = None
try:
    con = HTTPClient(address=options.hostname, port=port,  timeout=options.timeout, data_timeout=options.data_timeout, use_ssl=options.ssl)
    result=con.get('ping')
except Exception, exp:
    print "CRITICAL : the %s is not reachable : (%s)." % (daemon,exp)
    raise SystemExit(CRITICAL)

if result:
   if result=='pong':
       if daemon != 'arbiter':
           try:
               result=con.get('have_conf')
           except Exception, exp:
               print "CRITICAL : the have_conf call to the %s failed : (%s)." % (daemon,exp)
               raise SystemExit(CRITICAL)

           if result: