示例#1
0
    def _setup_status_page(self):
        listen = self.object.flisten

        if listen.startswith('/'):
            return PHPFPMStatus(path=listen, url=self.object.status_path)
        elif ':' in listen:
            host, port = listen.split(':')
            return PHPFPMStatus(host=host,
                                port=int(port),
                                url=self.object.status_path)
        elif listen.isdigit():
            port = int(listen)
            return PHPFPMStatus(host='127.0.0.1',
                                port=port,
                                url=self.object.status_path)

        context.log.error(
            'failed to parse listen for "%s" pool [listen:"%s", file:"%s"]' %
            (self.object.name, self.object.file, self.object.listen))
示例#2
0
    def test_basic_ipv4(self):
        pool_status = PHPFPMStatus(host='127.0.0.1', port=51, url='/status')
        page = pool_status.get_status()
        """
        pool:                 www
        process manager:      dynamic
        start time:           07/Dec/2016:00:13:21 +0000
        start since:          0
        accepted conn:        1
        listen queue:         0
        max listen queue:     0
        listen queue len:     0
        idle processes:       0
        active processes:     1
        total processes:      1
        max active processes: 1
        max children reached: 0
        slow requests:        0
        """

        assert_that(page, not_none())
        assert_that(page.count('\n'), equal_to(14))