本文整理汇总了Python中base.SimpleService类的典型用法代码示例。如果您正苦于以下问题:Python SimpleService类的具体用法?Python SimpleService怎么用?Python SimpleService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self._parse_config(configuration)
self.order = ORDER
self.definitions = CHARTS
self.connection = None
self.do_slave = -1
示例2: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.regex = r_compile(r'(\d+);(\d+);(\d+)')
self.log_path = self.configuration.get('log_path', '/var/log/smartd')
self.raw_values = self.configuration.get('raw_values')
self.attr = self.configuration.get('smart_attributes', [])
self.previous_data = dict()
示例3: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = []
self.definitions = {}
self.celsius = ('Celsius', lambda x: x)
self.fahrenheit = ('Fahrenheit', lambda x: x * 9 / 5 + 32) if self.configuration.get('fahrenheit') else False
self.choice = (choice for choice in [self.fahrenheit, self.celsius] if choice)
self.chips = []
示例4: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
self.log_path = self.configuration.get('log_path')
self.regex = dict(tls=r_compile(r'\d{1,3}(?:\.\d{1,3}){3}(?::\d+)? (?P<bytes_in>\d+) (?P<bytes_out>\d+)'),
static_key=r_compile(r'TCP/[A-Z]+ (?P<direction>(?:read|write)) bytes,(?P<bytes>\d+)'))
self.to_netdata = dict(bytes_in=0, bytes_out=0)
示例5: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
self.log_path = self.configuration.get('log_path')
self.regex_data_inter = compile(r'(?<=Since ).*?(?=.ROUTING)')
self.regex_data_final = compile(r'\d{1,3}(?:\.\d{1,3}){3}[:0-9,. ]*')
self.regex_users = compile(r'\d{1,3}(?:\.\d{1,3}){3}:\d+')
self.regex_traffic = compile(r'(?<=(?:,| ))\d+(?=(?:,| ))')
示例6: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.regex = dict(disks=re_compile(r' (?P<array>[a-zA-Z_0-9]+) : active .+\['
r'(?P<total_disks>[0-9]+)/'
r'(?P<inuse_disks>[0-9])\]'),
status=re_compile(r' (?P<array>[a-zA-Z_0-9]+) : active .+ '
r'(?P<operation>[a-z]+) = '
r'(?P<operation_status>[0-9.]+).+finish='
r'(?P<finish>([0-9.]+))min speed='
r'(?P<speed>[0-9]+)'))
示例7: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ['agr_health']
self.definitions = {'agr_health':
{'options':
[None, 'Faulty devices in MD', 'failed disks', 'health', 'md.health', 'line'],
'lines': []}}
self.proc_mdstat = '/proc/mdstat'
self.regex_disks = compile(r'((?<=\ )[a-zA-Z_0-9]+(?= : active)).*?((?<= \[)[0-9]+)/([0-9]+(?=\] ))')
self.regex_status = compile(r'([a-zA-Z_0-9]+)( : active)[^:]*?([a-z]+) = ([0-9.]+(?=%)).*?((?<=finish=)[0-9.]+)min speed=([0-9]+)')
示例8: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.named_stats_path = self.configuration.get('named_stats_path', '/var/log/bind/named.stats')
self.regex_values = compile(r'([0-9]+) ([^\n]+)')
# self.options = ['Incoming Requests', 'Incoming Queries', 'Outgoing Queries',
# 'Name Server Statistics', 'Zone Maintenance Statistics', 'Resolver Statistics',
# 'Cache DB RRsets', 'Socket I/O Statistics']
self.options = ['Name Server Statistics', 'Incoming Queries', 'Outgoing Queries']
self.regex_options = [r'(%s(?= \+\+)) \+\+([^\+]+)' % option for option in self.options]
self.rndc = self.find_binary('rndc')
示例9: __init__
def __init__(self, configuration=None, name=None):
prefix = os.getenv('NETDATA_HOST_PREFIX', "")
if prefix.endswith('/'):
prefix = prefix[:-1]
self.sys_dir = prefix + "/sys/devices/system/cpu"
self.schedstat_path = prefix + "/proc/schedstat"
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = []
self.definitions = {}
self._orig_name = ""
self.assignment = {}
示例10: __init__
def __init__(self, configuration=None, name=None):
prefix = os.getenv('NETDATA_HOST_PREFIX', "")
if prefix.endswith('/'):
prefix = prefix[:-1]
self.sys_dir = prefix + "/sys/devices"
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
self._orig_name = ""
self.assignment = {}
self.accurate_exists = True
self.accurate_last = {}
示例11: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.host = self.configuration.get('host', 'localhost')
self.port = self.configuration.get('port', '18121')
self.secret = self.configuration.get('secret', 'adminsecret')
self.acct = self.configuration.get('acct', False)
self.proxy_auth = self.configuration.get('proxy_auth', False)
self.proxy_acct = self.configuration.get('proxy_acct', False)
self.echo = self.find_binary('echo')
self.radclient = self.find_binary('radclient')
self.sub_echo = [self.echo, 'Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 15, Response-Packet-Type = Access-Accept']
self.sub_radclient = [self.radclient, '-r', '1', '-t', '1', ':'.join([self.host, self.port]), 'status', self.secret]
示例12: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.varnish = self.find_binary('varnishstat')
self.rgx_all = compile(r'([A-Z]+\.)?([\d\w_.]+)\s+(\d+)')
# Could be
# VBE.boot.super_backend.pipe_hdrbyte (new)
# or
# VBE.default2(127.0.0.2,,81).bereq_bodybytes (old)
# Regex result: [('super_backend', 'beresp_hdrbytes', '0'), ('super_backend', 'beresp_bodybytes', '0')]
self.rgx_bck = (compile(r'VBE.([\d\w_.]+)\(.*?\).(beresp[\w_]+)\s+(\d+)'),
compile(r'VBE\.[\d\w-]+\.([\w\d_]+).(beresp[\w_]+)\s+(\d+)'))
self.cache_prev = list()
示例13: __init__
def __init__(self, configuration=None, name=None):
prefix = os.getenv('NETDATA_HOST_PREFIX', "")
if prefix.endswith('/'):
prefix = prefix[:-1]
self.sys_dir = prefix + "/sys/devices"
self.filename = "scaling_cur_freq"
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
self._orig_name = ""
self.assignment = {}
self.paths = []
示例14: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.order = ORDER[:]
self.definitions = deepcopy(CHARTS)
self.user = self.configuration.get('user')
self.password = self.configuration.get('pass')
self.host = self.configuration.get('host', '127.0.0.1')
self.port = self.configuration.get('port', 27017)
self.timeout = self.configuration.get('timeout', 100)
self.metrics_to_collect = deepcopy(DEFAULT_METRICS)
self.connection = None
self.do_replica = None
self.databases = list()
示例15: __init__
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
self.named_stats_path = self.configuration.get('named_stats_path', '/var/log/bind/named.stats')
self.regex_values = compile(r'([0-9]+) ([^\n]+)')
# self.options = ['Incoming Requests', 'Incoming Queries', 'Outgoing Queries',
# 'Name Server Statistics', 'Zone Maintenance Statistics', 'Resolver Statistics',
# 'Cache DB RRsets', 'Socket I/O Statistics']
self.options = ['Name Server Statistics', 'Incoming Queries', 'Outgoing Queries']
self.regex_options = [r'(%s(?= \+\+)) \+\+([^\+]+)' % option for option in self.options]
try:
self.rndc = [''.join([directory, 'rndc']) for directory in DIRECTORIES
if isfile(''.join([directory, 'rndc']))][0]
except IndexError:
self.rndc = False