收集 IPMI 裝置感應器度量
除了監視代理程式自動收集的一組度量之外,您還可能想要收集其他度量,例如感應器度量。 您可以使用 Prometheus IPMI Exporter 來執行「智慧型平台管理介面 (IPMI)」裝置感應器度量的收集。
- Prometheus IPMI Exporter 匯出器支援可使用「遠端管理控制通訊協定 (RMCP)」存取的本端 IPMI 裝置及遠端裝置。
- 當您使用 RMCP 來存取遠端裝置時,可以使用 IPMI 匯出器來監視多個 IPMI 裝置。 您可以透過傳遞目標主機名稱作為參數來識別每一個裝置。
- IPMI 匯出程式依賴 FreeIPMI 套組中的工具。
下圖顯示您可以用來監視來自主機的感應器度量值的不同配置,這些主機可以在 IBM Cloud 中或 IBM Cloud外部提供:
當您在伺服器中配置 IPMI 匯出器時,可以收集下列度量值:
-
IPMI 管理度量
從遠端主機順利收集資料時,度量
ipmi_up {collector="<NAME>"}會報告1。 它會報告0,以收集本端主機中的資料。度量
ipmi_scrape_duration_seconds會報告收集器擷取資料所花費的時間量。 -
IPMI 系統事件日誌 (SEL) 度量
度量
ipmi_sel_entries_count會報告系統事件日誌中的項目數。度量
ipmi_sel_free_space_bytes報告新系統事件日誌項目的可用位元組數。 -
IPMI 感應器資料
IPMI 匯出程式會針對每個感應器類型收集 2 個度量值: 狀態和值。
0值會報告正常狀態。 值1會報告警告狀態。 值2會報告嚴重狀態。NaN報告資訊的值無法使用。 例如,請參閱不同感應器的度量值:溫度感應器度量:
ipmi_temperature_celsius,ipmi_temperature_state風扇速度感應器度量:
ipmi_fan_speed_rpm、ipmi_fan_speed_state電壓感應器度量:
ipmi_voltage_state,ipmi_voltage_volts -
機器的 IPMI 機箱電源狀態
度量
ipmi_chassis_power_state會通知機器機箱的現行狀態。 當電源開啟時,它的值為1。 當電源關閉時,它的值為0。 -
DCMI 資料
度量
ipmi_dcmi_power_consumption_current_watts會通知機器的即時耗電量 (瓦特)。 -
BMC 詳細資料
度量值 ipmi_bmc_info 包含標籤中韌體修訂及製造商的相關資訊,且值為
1。
如需相關資訊,請參閱 Prometheus IPMI Exporter。
請完成下列步驟來配置監視代理程式,以從一或多個主機收集 IPMI 度量:
配置監視代理程式
若要監視一或多個主機,您必須配置監視代理程式。 代理程式會自動收集一組您可以透過監視使用者介面監視的度量值。
請參閱 依基礎結構選擇代理程式類型,然後選擇要設定為監控主機的監控代理程式。
配置 Prometheus IPMI Exporter
您可以在 1 個以上主機中安裝 IPMI 匯出器,以收集 IPMI 度量值。
對於您要收集 IPMI 度量的每一個主機,請完成下列步驟來安裝 IPMI 匯出器。 例如,針對 Linux型主機完成下列步驟:
-
從本端終端機 下載 Prometheus IPMI 匯出器。
-
在伺服器中,從
ssh階段作業建立/usr/sysdig目錄。 執行下列指令:cd /usrmkdir sysdig -
將檔案複製到伺服器。 從檔案所在的目錄,執行下列指令:
scp ipmi_exporter-v1.2.0.linux-amd64.tar.gz root@<IP_ADDRESS>:/usr/sysdig/其中
<IP_ADDRESS>是伺服器的公用 IP 位址。如果指令失敗,請檢查 VPN 連線是否仍開啟。
-
解壓縮檔案。 執行下列指令:
cd /usr/sysdig/tar -xvf ipmi_exporter-v1.2.0.linux-amd64.tar.gz -
安裝 FreeIPMI 套組。 執行下列指令:
sudo apt-get updatesudo apt-get install freeipmi -
設定
ipmi_local.yml檔案。- 您可以更新檔案,以排除您不想監視的感應器。
切換至您已在其中解壓縮 IPMI 匯出器的目錄:
cd ipmi_exporter-v1.2.0.linux-amd64/檢查配置檔。 執行下列指令:
more ipmi_local.yml您應該會看到具有類似內容的檔案。# Configuration file for ipmi_exporter # This is an example config for scraping the local host. # In most cases, this should work without using a config file at all. modules: default: # Available collectors are bmc, ipmi, chassis, dcmi, and sel collectors: - bmc - ipmi - dcmi - chassis - sel # Got any sensors you don't care about? Add them here. exclude_sensor_ids: # - 2 -
如果 IPMI 匯出器安裝在您計劃從中收集多個主機的感應器度量的主機中,請配置
ipmi_remote.yml檔案。 請參閱 IPMI 遠端範例檔案。 -
執行 IPMI 匯出器。
./ipmi_exporter --config.file=ipmi_local.yml & -
請檢查 IPMI 匯出器是否在執行中。 請執行以下指令:
ps -aux | grep ipmi您應該會看到 IPMI 匯出器在執行中。
配置網路設定
如果您想要從遠端伺服器收集 IPMI 度量,請完成下列步驟:
-
啟用防火牆以容許存取
ipmi_exporter。 -
[選用] 更新 VPC 規則
如果您使用專用端點,請使用
source type = Security Group將入埠規則新增至埠9290的安全群組,並選擇伺服器的安全群組。
更新監視代理程式以收集 IPMI 度量
您必須配置監視代理程式,以啟用 IPMI 度量的收集。
根據您所配置的監視代理程式類型,選擇下列其中一個選項:
Kubernetes 監視代理程式
執行下列指令,以編輯 configmap,並新增已配置 IPMI 匯出程式之主機的相關資訊:
kubectl edit configmap sysdig-agent -n ibm-observe
修改 yaml 檔案,以新增 IPMI 匯出程式的 prometheus 配置:
log:
file_priority: error
configmap: true
### Agent tags
# tags: linux:ubuntu,dept:dev,local:nyc
#### Software related config ####
# Collector address
# collector: 192.168.1.1
# Collector TCP port
# collector_port: 6666
# Whether collector accepts ssl
# ssl: true
# collector certificate validation
# ssl_verify_certificate: true
#######################################
# new_k8s: true
# k8s_cluster_name: production
security:
k8s_audit_server_url: 0.0.0.0
k8s_audit_server_port: 7765
k8s_cluster_name: <CLUSTER_NAME>/<CLUSTER_ID>
tags: ibm.containers-kubernetes.cluster.id:<CLUSTER_ID>
collector: <INGESTION_ENDPOINT>
collector_port: 6443
ssl: true
ssl_verify_certificate: true
sysdig_capture_enabled: false
promscrape_fastproto: true
use_promscrape: true
prom_service_discovery: true
prometheus:
enabled: true
log_errors: true
max_metrics: 200000
max_metrics_per_process: 200000
max_tags_per_metric: 100
ingest_raw: true
ingest_calculated: false
prometheus.yaml:
----
global:
scrape_interval: 10s
scrape_configs:
- job_name: ipmi
metrics_path: /metrics
static_configs:
- targets:
- '<IP_ADDRESS_OF_REMOTE_SERVER_WHERE_IPMI_EXPORTER_IS_RUNNING>:9290'
- '<IP_ADDRESS_OF_REMOTE_SERVER_WHERE_IPMI_EXPORTER_IS_RUNNING>:9290'
- '<IP_ADDRESS_OF_REMOTE_SERVER_WHERE_IPMI_EXPORTER_IS_RUNNING>:9290'
其中
<IP_ADDRESS_OF_REMOTE_SERVER>是您要監控的伺服器的 IP 位址。<INGESTION_ENDPOINT>是 IBM Cloud Monitoring 實例汲取端點,例如ingest.us-south.monitoring.cloud.ibm.com。 請參閱 收集器端點。<IP_ADDRESS_OF_REMOTE_SERVER>:9290是您要監視之伺服器的 IP 位址。
當您儲存檔案時,會套用變更。
Linux 服務監視代理程式
請完成下列步驟,以更新監視代理程式來收集 IPMI 度量:
-
透過 SSH 登入監視代理程式執行所在的主機。 然後,切換至
/opt/draios/etc/目錄,並執行下列指令:cd /opt/draios/etc/ -
更新
/opt/draios/etc/dragent.yaml以啟用遠端提取。將以下部分附加到
dragent.yaml檔案:customerid: xxxxxxxxxx collector: ingest.us-south.monitoring.cloud.ibm.com collector_port: 6443 ssl: true sysdig_capture_enabled: false use_promscrape: true promscrape_fastproto: false prom_service_discovery: true prometheus: enabled: true process_filter: - include: port: 9290 conf: port: 9290 path: "/metrics" -
重新啟動監視代理程式。 執行下列指令:
service dragent restart
檢查您是否取得 IPMI 度量值
-
建立儀表板。
-
為下列每一個查詢新增一個畫面:
| 度量 | PromQL 查詢 | 選項 |
|---|---|---|
| Ipmi Up | ipmi_up |
number (auto) |
| 伏特 | ipmi_voltage_volts |
number (auto) |
| 溫度攝氏 | ipmi_temperature_celsius |
number (auto) |
| 風扇速度 RPM | ipmi_fan_speed_rpm |
number (auto) |
例如,您可以建立如下所示的儀表板: