How to use the supervisor.xmlrpc.SupervisorTransport function in supervisor

To help you get started, we’ve selected a few supervisor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nexedi / erp5 / bt5 / vifib_slap / TestTemplateItem / testVifibSlapgrid2.py View on Github external
def shutdownSupervisor(self):
    xmlrpclib.ServerProxy('http://127.0.0.1', SupervisorTransport('', '',
      'unix://%s' % self.supervisor_socket)).supervisor.shutdown()
github python-diamond / Diamond / src / collectors / supervisord / supervisord.py View on Github external
def getAllProcessInfo(self):

        server = None
        protocol = self.config['xmlrpc_server_protocol']
        path = self.config['xmlrpc_server_path']
        uri = '{}://{}'.format(protocol, path)

        self.log.debug(
            'Attempting to connect to XML-RPC server "%s"', uri)

        if protocol == 'unix':
            server = xmlrpclib.ServerProxy(
                'http://127.0.0.1',
                supervisor.xmlrpc.SupervisorTransport(None, None, uri)
            ).supervisor

        elif protocol == 'http':
            server = xmlrpclib.Server(uri).supervisor

        else:
            self.log.debug(
                'Invalid xmlrpc_server_protocol config setting "%s"',
                protocol)
            return None

        return server.getAllProcessInfo()
github LPgenerator / django-celery-mon / celerymon / management / commands / check_celery_state.py View on Github external
def __init__(self):
        super(Command, self).__init__()
        self.app = celery.Celery(broker=settings.BROKER_URL)
        self.server = xmlrpclib.ServerProxy(
            defaults.MON_URI,
            transport=supervisor.xmlrpc.SupervisorTransport(
                defaults.MON_SERVER_USER, defaults.MON_SERVER_PASS,
                defaults.MON_SERVER_URL)
        )
        self.queue = None
github PaloAltoNetworks / minemeld-core / minemeld / run / restore.py View on Github external
def handle_minemeld_engine(supervisor_url):
    sserver = xmlrpclib.ServerProxy(
        'http://127.0.0.1',
        transport=supervisor.xmlrpc.SupervisorTransport(
            None,
            None,
            supervisor_url
        )
    )

    # check supervisor state
    sstate = sserver.supervisor.getState()
    if sstate['statecode'] == 2:  # FATAL
        raise RuntimeError('Supervisor state: 2')

    if sstate['statecode'] != 1:
        raise RuntimeError(
            "Supervisor transitioning to a new state, restore not performed"
        )
github gwu-libraries / social-feed-manager / sfm / ui / utils.py View on Github external
def get_supervisor_proxy():
    proxy = xmlrpclib.ServerProxy(
        'http://' + settings.INTERNAL_IPS[0],
        transport=xmlrpc.SupervisorTransport(
            None, None, 'unix://'+settings.SUPERVISOR_UNIX_SOCKET_FILE))
    return proxy
github DataDog / integrations-core / supervisord / datadog_checks / supervisord / supervisord.py View on Github external
def _connect(instance):
        sock = instance.get('socket')
        user = instance.get('user')
        password = instance.get('pass')
        if sock is not None:
            host = instance.get('host', DEFAULT_SOCKET_IP)
            transport = supervisor.xmlrpc.SupervisorTransport(user, password, sock)
            server = xmlrpclib.ServerProxy(host, transport=transport)
        else:
            host = instance.get('host', DEFAULT_HOST)
            port = instance.get('port', DEFAULT_PORT)
            auth = '{}:{}@'.format(user, password) if user and password else ''
            server = xmlrpclib.Server('http://{}{}:{}/RPC2'.format(auth, host, port))
        return server.supervisor
github PaloAltoNetworks / minemeld-core / minemeld / run / restore.py View on Github external
def _reload_candidate_config(supervisor_url):
    SR = redis.StrictRedis()
    ckeys = SR.keys('{}*'.format(REDIS_KEY_PREFIX))
    if ckeys:
        for ck in ckeys:
            LOG.info('Deleting {}'.format(ck))
            SR.delete(ck)

    LOG.info('Candidate config keys deleted')

    sserver = xmlrpclib.ServerProxy(
        'http://127.0.0.1',
        transport=supervisor.xmlrpc.SupervisorTransport(
            None,
            None,
            supervisor_url
        )
    )

    # check supervisor state
    sstate = sserver.supervisor.getState()
    if sstate['statecode'] == 2:  # FATAL
        raise RuntimeError('Supervisor state: 2')

    if sstate['statecode'] != 1:
        raise RuntimeError(
            "Supervisor transitioning to a new state, restore not performed"
        )
github PaloAltoNetworks / minemeld-core / minemeld / traced / purge.py View on Github external
def start_minemeld_traced(supervisor_url):
    sserver = xmlrpclib.ServerProxy(
        'http://127.0.0.1',
        transport=supervisor.xmlrpc.SupervisorTransport(
            None,
            None,
            supervisor_url
        )
    )

    sserver.supervisor.startProcess('minemeld-traced', False)
    LOG.info('Started minemeld-traced')
github DataDog / integrations-core / supervisord / check.py View on Github external
    @staticmethod
    def _connect(instance):
        sock = instance.get('socket')
        if sock is not None:
            host = instance.get('host', DEFAULT_SOCKET_IP)
            transport = supervisor.xmlrpc.SupervisorTransport(None, None, sock)
            server = xmlrpclib.ServerProxy(host, transport=transport)
        else:
            host = instance.get('host', DEFAULT_HOST)
            port = instance.get('port', DEFAULT_PORT)
            user = instance.get('user')
            password = instance.get('pass')
            auth = '%s:%s@' % (user, password) if user and password else ''
            server = xmlrpclib.Server('http://%s%s:%s/RPC2' % (auth, host, port))
        return server.supervisor