IBM Cloud Docs
收集 IPMI 设备传感器度量

收集 IPMI 设备传感器度量

除了监视代理程序自动收集的一组度量值外,您可能还希望收集其他度量值,例如传感器度量值。 您可以使用 Prometheus IPMI Exporter 来执行 Intelligent Platform Management Interface (IPMI) 设备传感器度量的收集。

  • Prometheus IPMI Exporter 导出器支持本地 IPMI 设备和可使用远程管理控制协议 (RMCP) 访问的远程设备。
  • 使用 RMCP 访问远程设备时,可以使用 IPMI 导出器来监视多个 IPMI 设备。 通过将目标主机名作为参数传递来标识每个设备。
  • IPMI 导出器依赖于 FreeIPMI 套件中的工具。

下图显示了可用于监视来自可在 IBM Cloud 中或 IBM Cloud外部提供的主机的传感器度量的不同配置:

IPMI components
IPMI components: IPMI exporter and Kubernetes agent in different hosts

在服务器中配置 IPMI 导出器时,可以收集以下度量值:

  • IPMI 管理度量

    当成功收集来自远程主机的数据时,度量 ipmi_up {collector="<NAME>"} 报告 1。 它报告 0 以收集本地主机中的数据。

    度量 ipmi_scrape_duration_seconds 报告收集器检索数据所花费的时间量。

  • IPMI 系统事件日志 (SEL) 度量

    度量值 ipmi_sel_entries_count 报告系统事件日志中的条目数。

    度量值 ipmi_sel_free_space_bytes 报告新 ystem 事件日志条目的可用字节数。

  • 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

要配置监视代理程序以从 1 或更多主机收集 IPMI 度量,请完成以下步骤:

配置监视代理程序

要监视 1 或更多主机,必须配置监视代理程序。 代理程序会自动收集一组可通过监视 UI 监视的度量。

请参阅“按基础设施选择代理类型”,并选择要配置的监控代理,以监控主机。

配置 Prometheus IPMI Exporter

您可以在 1 或更多主机中安装 IPMI Exporer 以收集 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 远程样本文件(IPMI remote sample file)

  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'

Where

  • <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. 启动监视 UI

  2. 创建仪表板。

  3. 为以下每个查询添加一个面板:

IPMI 输出程序示例查询
指标 PromQL 查询 选项
Ipmi 向上 ipmi_up number (auto)
电压 ipmi_voltage_volts number (auto)
摄氏温度 ipmi_temperature_celsius number (auto)
风扇速度 RPM ipmi_fan_speed_rpm number (auto)

例如,您可以创建如下所示的仪表板:

IPMI 仪表板示例
示例* IPMI 仪表板示例* IPMI
示例