def _response_to_metrics(self, result, sensors): metrics = [] timestamp = time.time() data = ((sensors[oid], value) for oid, value in result.iteritems() if oid in sensors) for sensor, value in data: value = convert_to_precision(value, sensor) path = metric_path_for_sensor(self.netbox, sensor['internal_name']) metrics.append((path, (timestamp, value))) send_metrics(metrics) return metrics
def _response_to_metrics(self, result, sensors, netboxes): metrics = [] timestamp = time.time() data = ((sensors[oid], value) for oid, value in result.items() if oid in sensors) for sensor, value in data: # Attempt to support numbers-as-text values if isinstance(value, bytes): value = safestring(value) if isinstance(value, str): try: value = float(value) except ValueError: pass value = convert_to_precision(value, sensor) for netbox in netboxes: path = metric_path_for_sensor(netbox, sensor['internal_name']) metrics.append((path, (timestamp, value))) send_metrics(metrics) return metrics
def find_metric(self, datasource, sysname=None, info_object=None): return metric_path_for_sensor(sysname, info_object.name)
def find_metric(self, datasource, sysname=None, info_object=None): return metric_path_for_sensor(sysname, info_object.name)