nginx-nr-agent.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:nginx-nr-agent 作者: skyzyx 项目源码 文件源码
def read_config(self):
        # if self.config:
        #     return

        config = ConfigParser.RawConfigParser()
        config.read(self.config_file)

        for s in config.sections():
            if s == 'global':
                if config.has_option(s, 'poll_interval'):
                    self.poll_interval = int(config.get(s, 'poll_interval'))
                if config.has_option(s, 'newrelic_license_key'):
                    self.license_key = config.get(s, 'newrelic_license_key')
                continue

            if not config.has_option(s, 'name') or not config.has_option(s, 'url'):
                continue

            ns = NginxStatusCollector(s, config.get(s, 'name'), config.get(s, 'url'), self.poll_interval)

            if config.has_option(s, 'http_user') and config.has_option(s, 'http_pass'):
                ns.basic_auth = base64.b64encode(config.get(s, 'http_user') + b':' + config.get(s, 'http_pass'))

            self.sources.append(ns)

        self.config = config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号