def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost:8080/manager/status?XML=true" self.order = ORDER self.definitions = CHARTS self.port = 8080
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.url = self.configuration.get( 'url', "http://127.0.0.1:8080/manager/status?XML=true") self.connector_name = self.configuration.get('connector_name', None) self.order = ORDER self.definitions = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.host = self.configuration.get('host', '127.0.0.1') self.port = self.configuration.get('port', 15672) self.scheme = self.configuration.get('scheme', 'http')
def __init__(self, configuration=None, name=None): self.ERROR = False UrlService.__init__(self, configuration=configuration, name=name) self.order = [] self.definitions = {} # config parsing self.monitoring_dbs = self.configuration.get('monitoring_dbs') # self.monitoring_dbs = ['one'] self.untrack_dbs = self.configuration.get('untrack_dbs', ['_replicator', '_users']) # urls self.baseurl = str(self.configuration.get('url')) # self.baseurl = 'http://10.0.0.10:5984/' self.active_tasks_url = str(self.baseurl + '_active_tasks/') self.all_dbs_url = str(self.baseurl + '_all_dbs/') # auth self.user = self.configuration.get('couch_username') or None # self.user = '******' self.password = self.configuration.get('couch_password') or None # self.password = '******' if self.user: self.base64string = base64.encodestring( '%s:%s' % (self.user, self.password)).replace('\n', '') self.data = {}
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) try: self.baseurl = str(self.configuration['url']) except (KeyError, TypeError): self.baseurl = 'http://localhost:9090' self.order = ORDER self.definitions = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.host = self.configuration.get('host') self.port = self.configuration.get('port', 9200) self.scheme = self.configuration.get('scheme', 'http') self.latency = dict() self.methods = list()
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.host = self.configuration.get('host') self.port = self.configuration.get('port') self.user = self.configuration.get('user') self.password = self.configuration.get('pass') self.latency = dict()
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.url = self.configuration.get('url', 'http://localhost/status?full&json') self.order = ORDER self.definitions = CHARTS self.regex = re.compile(r'([a-z][a-z ]+): ([\d.]+)') self.json = '&json' in self.url or '?json' in self.url self.json_full = self.url.endswith(('?full&json', '?json&full')) self.if_all_processes_running = dict([(c_name + p_name, 0) for c_name, func in CALC for metric, p_name in PER_PROCESS_INFO])
def __init__(self, configuration=None, name=None): if 'socket' in configuration: SocketService.__init__(self, configuration=configuration, name=name) self.poll = SocketService self.options_ = dict(regex=REGEX['socket'], stat='show stat\n', info='show info\n') else: UrlService.__init__(self, configuration=configuration, name=name) self.poll = UrlService self.options_ = dict(regex=REGEX['url'], stat=self.url, info=url_remove_params(self.url)) self.order = ORDER self.definitions = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/status" self.order = ORDER self.definitions = CHARTS self.assignment = {"active processes": 'active', "max active processes": 'maxActive', "idle processes": 'idle', "accepted conn": 'requests', "max children reached": 'reached', "slow requests": 'slow'}
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/status" self.order = ORDER self.charts = CHARTS self.assignment = {"active processes": 'active', "max active processes": 'maxActive', "idle processes": 'idle', "accepted conn": 'requests', "max children reached": 'reached', "slow requests": 'slow'}
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.url = self.configuration.get('url', 'http://localhost/status?full&json') self.order = ORDER self.definitions = CHARTS self.regex = re.compile(r'([a-z][a-z ]+): ([\d.]+)') self.json = '&json' in self.url or '?json' in self.url self.json_full = self.url.endswith(('?full&json', '?json&full')) self.if_all_processes_running = dict([ (c_name + p_name, 0) for c_name, func in CALC for metric, p_name in PER_PROCESS_INFO ])
def __init__(self, configuration=None, name=None): if 'socket' in configuration: SocketService.__init__(self, configuration=configuration, name=name) self.poll_method = SocketService self.request = 'show stat\n' else: UrlService.__init__(self, configuration=configuration, name=name) self.poll_method = UrlService self.order = ORDER self.definitions = CHARTS self.order_front = [_ for _ in ORDER if _.startswith('f')] self.order_back = [_ for _ in ORDER if _.startswith('b')] self.charts = True
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.host = self.configuration.get('host', '127.0.0.1') self.port = self.configuration.get('port', 5984) self.node = self.configuration.get('node', '[email protected]') self.scheme = self.configuration.get('scheme', 'http') self.user = self.configuration.get('user') self.password = self.configuration.get('pass') try: self.dbs = self.configuration.get('databases').split(' ') except (KeyError, AttributeError): self.dbs = []
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) # if memstats collection is enabled, add the charts and their order if self.configuration.get('collect_memstats'): self.definitions = MEMSTATS_CHARTS self.order = MEMSTATS_ORDER else: self.definitions = dict() self.order = list() # if extra charts are defined, parse their config extra_charts = self.configuration.get('extra_charts') if extra_charts: self._parse_extra_charts_config(extra_charts)
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/status?full&json" self.order = ORDER self.definitions = CHARTS self.assignment = {"active processes": 'active', "max active processes": 'maxActive', "idle processes": 'idle', "accepted conn": 'requests', "max children reached": 'reached', "slow requests": 'slow'} self.proc_assignment = {"request duration": 'ReqDur', "last request cpu": 'ReqCPU', "last request memory": 'ReqMem'}
def check(self): # We can't start if <host> AND <port> not specified if not (self.host and self.port): self.error('Host is not defined in the module configuration file') return False # Hostname -> ip address try: self.host = gethostbyname(self.host) except gaierror as error: self.error(str(error)) return False # Add handlers (auth, self signed cert accept) self.url = '{scheme}://{host}:{port}/api'.format(scheme=self.scheme, host=self.host, port=self.port) # Add methods api_node = self.url + '/nodes' api_overview = self.url + '/overview' self.methods = [ METHODS(get_data=self._get_overview_stats, url=api_node, stats=NODE_STATS), METHODS(get_data=self._get_overview_stats, url=api_overview, stats=OVERVIEW_STATS) ] return UrlService.check(self)
def check(self): # We can't start if <host> AND <port> not specified if not (self.host and self.port): self.error('Host is not defined in the module configuration file') return False # Hostname -> ip address try: self.host = gethostbyname(self.host) except gaierror as error: self.error(str(error)) return False # Add handlers (auth, self signed cert accept) self.url = '{scheme}://{host}:{port}/api'.format(scheme=self.scheme, host=self.host, port=self.port) # Add methods api_node = self.url + '/nodes' api_overview = self.url + '/overview' self.methods = [METHODS(get_data=self._get_overview_stats, url=api_node, stats=NODE_STATS), METHODS(get_data=self._get_overview_stats, url=api_overview, stats=OVERVIEW_STATS)] return UrlService.check(self)
def check(self): if not all([ self.host, self.port, isinstance(self.host, str), isinstance(self.port, (str, int)) ]): self.error('Host is not defined in the module configuration file') return False # Hostname -> ip address try: self.host = gethostbyname(self.host) except gaierror as error: self.error(str(error)) return False # Create URL for every Elasticsearch API self.methods = [ METHODS(get_data=self._get_node_stats, url=self.url + '/_nodes/_local/stats', run=self.configuration.get('node_stats', True)), METHODS(get_data=self._get_cluster_health, url=self.url + '/_cluster/health', run=self.configuration.get('cluster_health', True)), METHODS(get_data=self._get_cluster_stats, url=self.url + '/_cluster/stats', run=self.configuration.get('cluster_stats', True)) ] # Remove disabled API calls from 'avail methods' return UrlService.check(self)
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost:8080/manager/status?XML=true" self.order = ORDER self.definitions = CHARTS # get port from url self.port = 0 for i in self.url.split('/'): try: int(i[-1]) self.port = i.split(':')[-1] break except: pass if self.port == 0: self.port = 80
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/server-status?auto" self.order = ORDER self.definitions = CHARTS self.assignment = {"BytesPerReq": 'size_req', "IdleWorkers": 'idle', "BusyWorkers": 'busy', "ReqPerSec": 'requests_sec', "BytesPerSec": 'size_sec', "Total Accesses": 'requests', "Total kBytes": 'sent', "ConnsTotal": 'connections', "ConnsAsyncKeepAlive": 'keepalive', "ConnsAsyncClosing": 'closing', "ConnsAsyncWriting": 'writing'}
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/server-status?auto" self.order = ORDER self.charts = CHARTS self.assignment = { "BytesPerReq": 'size_req', "IdleWorkers": 'idle', "BusyWorkers": 'busy', "ReqPerSec": 'requests_sec', "BytesPerSec": 'size_sec', "Total Accesses": 'requests', "Total kBytes": 'sent', "ConnsTotal": 'connections', "ConnsAsyncKeepAlive": 'keepalive', "ConnsAsyncClosing": 'closing', "ConnsAsyncWriting": 'writing' }
def check(self): if UrlService.check(self): if 'idle_servers' in self._data_from_check: self.__module__ = 'lighttpd' for chart in self.definitions: opts = self.definitions[chart]['options'] opts[1] = opts[1].replace('apache', 'lighttpd') opts[4] = opts[4].replace('apache', 'lighttpd') return True return False
def check(self): netloc = urlparse(self.url).netloc.rpartition(':') if netloc[1] == ':': port = netloc[2] else: port = 80 self.regex_jvm = compile(r'<jvm>.*?</jvm>') self.regex_connector = compile(r'[a-z-]+%s.*?/connector' % port) self.regex = compile(r'([\w]+)=\\?[\'\"](\d+)\\?[\'\"]') return UrlService.check(self)
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/status?full&json" self.order = ORDER self.definitions = CHARTS self.assignment = { "active processes": 'active', "max active processes": 'maxActive', "idle processes": 'idle', "accepted conn": 'requests', "max children reached": 'reached', "slow requests": 'slow' } self.proc_assignment = { "request duration": 'ReqDur', "last request cpu": 'ReqCPU', "last request memory": 'ReqMem' }
def __init__(self, configuration=None, name=None): self.ERROR = False UrlService.__init__(self, configuration=configuration, name=name) # self.monitoring_tasks = ['indexer', 'database_compaction', 'view_compaction', 'replication'] self.monitoring_tasks = self.configuration.get('monitoring_tasks') self.order = ORDER self.definitions = CHARTS self.baseurl = str(self.configuration.get('url')) # self.all_dbs_url = str(self.baseurl + '_all_dbs/') self.active_tasks_url = str(self.baseurl + '_active_tasks/') self.untrack_dbs = self.configuration.get('untrack_dbs', ['_replicator', '_users']) self.user = self.configuration.get('couch_username') or None self.password = self.configuration.get('couch_password') or None if self.user: self.base64string = base64.encodestring('%s:%s' % (self.user, self.password)).replace('\n', '') # self.data = {'indexer_task': 0, 'database_compaction_task': 0, 'view_compaction_task': 0, 'replication_task': 0} self.data = {} for task in self.monitoring_tasks: self.data[task + '_task'] = 0
def check(self): if not self.url.endswith('manager/status?XML=true'): self.error('Bad url(%s). Must be http://<ip.address>:<port>/manager/status?XML=true' % self.url) return False netloc = urlparse(self.url).netloc.rpartition(':') if netloc[1] == ':': port = netloc[2] else: port = 80 self.regex_jvm = compile(r'<jvm>.*?</jvm>') self.regex_connector = compile(r'[a-z-]+%s.*?/connector' % port) self.regex = compile(r'([\w]+)=\\?[\'\"](\d+)\\?[\'\"]') return UrlService.check(self)
def check(self): """ Check if the module can collect data: 1) At least one JOB configuration has to be specified 2) The JOB configuration needs to define the URL and either collect_memstats must be enabled or at least one extra_chart must be defined. The configuration and URL check is provided by the UrlService class. """ if not (self.configuration.get('extra_charts') or self.configuration.get('collect_memstats')): self.error('Memstats collection is disabled and no extra_charts are defined, disabling module.') return False return UrlService.check(self)
def check(self): if not self.url.endswith('manager/status?XML=true'): self.error( 'Bad url(%s). Must be http://<ip.address>:<port>/manager/status?XML=true' % self.url) return False netloc = urlparse(self.url).netloc.rpartition(':') if netloc[1] == ':': port = netloc[2] else: port = 80 self.regex_jvm = compile(r'<jvm>.*?</jvm>') self.regex_connector = compile(r'[a-z-]+%s.*?/connector' % port) self.regex = compile(r'([\w]+)=\\?[\'\"](\d+)\\?[\'\"]') return UrlService.check(self)
def check(self): """ Check if the module can collect data: 1) At least one JOB configuration has to be specified 2) The JOB configuration needs to define the URL and either collect_memstats must be enabled or at least one extra_chart must be defined. The configuration and URL check is provided by the UrlService class. """ if not (self.configuration.get('extra_charts') or self.configuration.get('collect_memstats')): self.error( 'Memstats collection is disabled and no extra_charts are defined, disabling module.' ) return False return UrlService.check(self)
def check(self): if not (self.host and self.port): self.error('Host is not defined in the module configuration file') return False try: self.host = gethostbyname(self.host) except gaierror as error: self.error(str(error)) return False self.url = '{scheme}://{host}:{port}'.format(scheme=self.scheme, host=self.host, port=self.port) stats = self.url + '/_node/{node}/_stats'.format(node=self.node) active_tasks = self.url + '/_active_tasks' system = self.url + '/_node/{node}/_system'.format(node=self.node) self.methods = [ METHODS(get_data=self._get_overview_stats, url=stats, stats=OVERVIEW_STATS), METHODS(get_data=self._get_active_tasks_stats, url=active_tasks, stats=None), METHODS(get_data=self._get_overview_stats, url=system, stats=SYSTEM_STATS), METHODS(get_data=self._get_dbs_stats, url=self.url, stats=DB_STATS) ] # must initialise manager before using _get_raw_data self._manager = self._build_manager() self.dbs = [ db for db in self.dbs if self._get_raw_data(self.url + '/' + db) ] for db in self.dbs: self.definitions['db_sizes_file']['lines'].append( ['db_' + db + '_sizes_file', db, 'absolute', 1, 1000]) self.definitions['db_sizes_external']['lines'].append( ['db_' + db + '_sizes_external', db, 'absolute', 1, 1000]) self.definitions['db_sizes_active']['lines'].append( ['db_' + db + '_sizes_active', db, 'absolute', 1, 1000]) self.definitions['db_doc_counts']['lines'].append( ['db_' + db + '_doc_count', db, 'absolute']) self.definitions['db_doc_del_counts']['lines'].append( ['db_' + db + '_doc_del_count', db, 'absolute']) return UrlService.check(self)
def check(self): if UrlService.check(self): return True # get port from url self.port = 0 for i in self.url.split('/'): try: int(i[-1]) self.port = i.split(':')[-1] break except: pass if self.port == 0: self.port = 80 if self._get_data() is None or len(self._get_data()) == 0: return False else: return True
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.url = self.configuration.get('url', "http://127.0.0.1:8080/manager/status?XML=true") self.order = ORDER self.definitions = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/stub_status" self.order = ORDER self.charts = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) if len(self.url) == 0: self.url = "http://localhost/stub_status" self.order = ORDER self.definitions = CHARTS
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.url = self.configuration.get('url', 'http://localhost/server-status?auto')
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS self.url = self.configuration.get( 'url', 'http://localhost/server-status?auto')
def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) self.order = ORDER self.definitions = CHARTS