我正在使用 SNMP 导出器提供来自 APC 实验室监控设备的指标。
Prometheus 配置的相关部分如下所示:
- job_name: labtemp_snmp
static_configs:
- targets:
- 10.163.123.87
scrape_interval: 15s
metrics_path: /snmp
params:
module: [labtemp]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9116
Prometheus SNMP 导出器配置是使用以下方法生成的:
modules:
labtemp:
walk:
- memSensorsStatusTable
version: 1
手动查询时('http://localhost:9116/snmp?target=10.163.123.87&module=labtemp'),输出包含这些表:
# HELP memSensorsStatusSensorLocation The location of the sensor. - 1.3.6.1.4.1.318.1.1.10.4.2.3.1.4
# TYPE memSensorsStatusSensorLocation gauge
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="0",memSensorsStatusSensorLocation="Cold Aisle C1",memSensorsStatusSensorNumber="1"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="0",memSensorsStatusSensorLocation="Hot Aisle C2",memSensorsStatusSensorNumber="2"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="1",memSensorsStatusSensorLocation="Cold Aisle C12",memSensorsStatusSensorNumber="2"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="1",memSensorsStatusSensorLocation="Hot Aisle B8",memSensorsStatusSensorNumber="1"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="2",memSensorsStatusSensorLocation="Cold Aisle A5",memSensorsStatusSensorNumber="1"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="2",memSensorsStatusSensorLocation="Hot Aisle B2",memSensorsStatusSensorNumber="2"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="3",memSensorsStatusSensorLocation="Cold Aisle C9",memSensorsStatusSensorNumber="3"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="3",memSensorsStatusSensorLocation="Hot Aisle C12",memSensorsStatusSensorNumber="6"} 1
memSensorsStatusSensorLocation{memSensorsStatusModuleNumber="3",memSensorsStatusSensorLocation="Hot Aisle C7",memSensorsStatusSensorNumber="5"} 1
# HELP memSensorsTemperature The sensor's current temperature reading - 1.3.6.1.4.1.318.1.1.10.4.2.3.1.5
# TYPE memSensorsTemperature gauge
memSensorsTemperature{memSensorsStatusModuleNumber="0",memSensorsStatusSensorNumber="1"} 26
memSensorsTemperature{memSensorsStatusModuleNumber="0",memSensorsStatusSensorNumber="2"} 33
memSensorsTemperature{memSensorsStatusModuleNumber="1",memSensorsStatusSensorNumber="1"} 30
memSensorsTemperature{memSensorsStatusModuleNumber="1",memSensorsStatusSensorNumber="2"} 20
memSensorsTemperature{memSensorsStatusModuleNumber="2",memSensorsStatusSensorNumber="1"} 22
memSensorsTemperature{memSensorsStatusModuleNumber="2",memSensorsStatusSensorNumber="2"} 30
memSensorsTemperature{memSensorsStatusModuleNumber="3",memSensorsStatusSensorNumber="3"} 20
memSensorsTemperature{memSensorsStatusModuleNumber="3",memSensorsStatusSensorNumber="5"} 31
memSensorsTemperature{memSensorsStatusModuleNumber="3",memSensorsStatusSensorNumber="6"} 29
现在,我想使用
memSensorsStatusSensorLocation
表将 memSensorsTemperature
值分配给 memSensorsStatusSensorLocation
表,类似的做法是具有网络接口索引,因此条目如下所示:
memSensorsTemperature{memSensorsStatusSensorLocation="Cold Aisle C1",memSensorsStatusModuleNumber="0",memSensorsStatusSensorNumber="1"} 26
...
任何人都可以提供一种方法/提示如何实现这一目标?
我不清楚这是否应该/可以在 Prometheus SNMP 导出器配置或 Prometheus 配置中完成。