收集 IPMI 裝置感應器度量

除了監視代理程式自動收集的一組度量之外,您還可能想要收集其他度量,例如感應器度量。 您可以使用 Prometheus IPMI Exporter 來執行「智慧型平台管理介面 (IPMI)」裝置感應器度量的收集。

  • Prometheus IPMI Exporter 匯出器支援可使用「遠端管理控制通訊協定 (RMCP)」存取的本端 IPMI 裝置及遠端裝置。
  • 當您使用 RMCP 來存取遠端裝置時,可以使用 IPMI 匯出器來監視多個 IPMI 裝置。 您可以透過傳遞目標主機名稱作為參數來識別每一個裝置。
  • IPMI 匯出程式依賴 FreeIPMI 套組中的工具。

下圖顯示您可以用來監視來自主機的感應器度量值的不同配置,這些主機可以在 IBM Cloud 中或 IBM Cloud外部提供:

IPMI 元件
IPMI 元件:不同主機中的 IPMI 匯出器和Kubernetes代理程式

當您在伺服器中配置 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_celsiusipmi_temperature_state

    風扇速度感應器度量: ipmi_fan_speed_rpmipmi_fan_speed_state

    電壓感應器度量: ipmi_voltage_stateipmi_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型主機完成下列步驟:

  1. 從本端終端機 下載 Prometheus IPMI 匯出器

  2. 在伺服器中,從 ssh 階段作業建立 /usr/sysdig 目錄。 執行下列指令:

    cd /usr
    
    mkdir sysdig
    
  3. 將檔案複製到伺服器。 從檔案所在的目錄,執行下列指令:

    scp ipmi_exporter-v1.2.0.linux-amd64.tar.gz  root@<IP_ADDRESS>:/usr/sysdig/
    

    其中 <IP_ADDRESS> 是伺服器的公用 IP 位址。

    如果指令失敗,請檢查 VPN 連線是否仍開啟。

  4. 解壓縮檔案。 執行下列指令:

    cd /usr/sysdig/
    
    tar -xvf ipmi_exporter-v1.2.0.linux-amd64.tar.gz
    
  5. 安裝 FreeIPMI 套組。 執行下列指令:

    sudo apt-get update
    
    sudo apt-get install freeipmi
    
  6. 設定 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
    
  7. 如果 IPMI 匯出器安裝在您計劃從中收集多個主機的感應器度量的主機中,請配置 ipmi_remote.yml 檔案。 請參閱 IPMI 遠端範例檔案

  8. 執行 IPMI 匯出器。

    ./ipmi_exporter --config.file=ipmi_local.yml &
    
  9. 請檢查 IPMI 匯出器是否在執行中。 請執行以下指令:

    ps -aux | grep ipmi
    

    您應該會看到 IPMI 匯出器在執行中。

配置網路設定

如果您想要從遠端伺服器收集 IPMI 度量,請完成下列步驟:

  1. 啟用防火牆以容許存取 ipmi_exporter

  2. [選用] 更新 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 度量:

  1. 透過 SSH 登入監視代理程式執行所在的主機。 然後,切換至 /opt/draios/etc/ 目錄,並執行下列指令:

    cd /opt/draios/etc/
    
  2. 更新 /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"
    
  3. 重新啟動監視代理程式。 執行下列指令:

    service dragent restart
    

檢查您是否取得 IPMI 度量值

  1. 啟動監視使用者介面

  2. 建立儀表板。

  3. 為下列每一個查詢新增一個畫面:

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)

例如,您可以建立如下所示的儀表板:

IPMI 儀表板範例
IPMI 儀表板範例