def main(self): logging.basicConfig(level=logging.ERROR, filename=self.settings.get('log_file', None)) reports_log = self.settings.get('report_log_file', None) if reports_log: boundary_plugin.log_metrics_to_file(reports_log) boundary_plugin.start_keepalive_subprocess() while True: data = self.get_stats_with_retries() self.handle_metrics(data) boundary_plugin.sleep_interval()
def main(self): logging.basicConfig(level=logging.ERROR, filename=self.settings.get('log_file', None)) reports_log = self.settings.get('report_log_file', None) if reports_log: boundary_plugin.log_metrics_to_file(reports_log) boundary_plugin.start_keepalive_subprocess() instances = self.settings['items'] while True: for instance in instances: instance['source_name'] = self.get_source_name(instance) self.report_stats_with_retries(instance) boundary_plugin.sleep_interval()
def main(self): logging.basicConfig(level=logging.ERROR, filename=self.settings.get('log_file', None)) reports_log = self.settings.get('report_log_file', None) if reports_log: boundary_plugin.log_metrics_to_file(reports_log) boundary_plugin.start_keepalive_subprocess() instances = [i['instance_name'] for i in self.settings.get("items", [{'instance_name': None}])] while True: for instance_name in instances: data = self.get_stats_with_retries(instance_name) self.handle_metrics(data, instance_name) boundary_plugin.sleep_interval()
def main(self): logging.basicConfig(level=logging.ERROR, filename=self.settings.get('log_file', None)) reports_log = self.settings.get('report_log_file', None) if reports_log: boundary_plugin.log_metrics_to_file(reports_log) boundary_plugin.start_keepalive_subprocess() instances = [ i['instance_name'] for i in self.settings.get("items", [{ 'instance_name': None }]) ] while True: for instance_name in instances: data = self.get_stats_with_retries(instance_name) self.handle_metrics(data, instance_name) boundary_plugin.sleep_interval()
except KeyError: old_value = new_value diff = new_value - old_value _accum[stat_name] = new_value return diff # List of values returned from Redis' info call to report to Boundary. # Each value has a boolean specifying whether to aggregate data (i.e. report # only delta from the previous value) or report the metric as-is. values_to_report = ( ('connected_clients', False), ('keyspace_hits', True), ('keyspace_misses', True), ('expired_keys', True), ('evicted_keys', True), ('total_commands_processed', True), ('total_connections_received', True), ('used_memory_rss', False), ) while True: info = r.info() for v, aggregate in values_to_report: val = accum(v, info[v]) if aggregate else info[v] boundary_plugin.boundary_report_metric('REDIS_' + v.upper(), val) boundary_plugin.sleep_interval()
except KeyError: old_value = new_value diff = new_value - old_value _accum[stat_name] = new_value return diff # List of values returned from Redis' info call to report to Boundary. # Each value has a boolean specifying whether to aggregate data (i.e. report # only delta from the previous value) or report the metric as-is. values_to_report = ( ('connected_clients', False), ('keyspace_hits', True), ('keyspace_misses', True), ('expired_keys', True), ('evicted_keys', True), ('total_commands_processed', True), ('total_connections_received', True), ('used_memory_rss', False), ) while True: info = r.info() for v,aggregate in values_to_report: val = accum(v, info[v]) if aggregate else info[v] boundary_plugin.boundary_report_metric('REDIS_' + v.upper(), val) boundary_plugin.sleep_interval()