Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

9.8. 使用 SNMP 查询 Pacemaker 集群(Red Hat Enterprise Linux 7.5 及更新的版本)

从 Red Hat Enterprise Linux 7.5 开始,您可以使用 pcs_snmp_agent 守护进程通过 SNMP 查询 Pacemaker 集群的数据。pcs_snmp_agent 守护进程是一个 SNMP 代理,通过代理 x 协议连接到主代理 (snmpd)。pcs_snmp_agent 代理不充当独立代理,因为它仅向主代理提供数据。
以下流程为系统设置基本配置,以便在 Pacemaker 集群中使用 SNMP。您可以在集群的每个节点上运行此步骤,您将使用 SNMP 为集群获取数据。
  1. 在群集的每个节点上安装 pcs-snmp 软件包。这还将安装提供 sn mp 守护进程的 net-sn mp 软件包。
    # yum install pcs-snmp
  2. 将以下行添加到 /etc/snmp/snmpd.conf 配置文件,以将 snmpd 守护进程设置为 主代理x
    master agentx
    
  3. 将以下行添加到 /etc/snmp/snmpd.conf 配置文件,以在同一 SNMP 配置中启用 pcs_snmp_agent
    view    systemview    included   .1.3.6.1.4.1.32723.100
    
  4. 启动 pcs_snmp_agent 服务。
    # systemctl start pcs_snmp_agent.service
    # systemctl enable pcs_snmp_agent.service
  5. 要检查配置,请使用 pcs status 显示群集的状态,然后尝试从 SNMP 获取数据,以检查它是否与输出对应。请注意,当使用 SNMP 获取数据时,只会提供原始资源。
    以下示例显示了在运行中的群集上使用失败操作的 pcs status 命令的输出结果。
    # pcs status
    Cluster name: rhel75-cluster
    Stack: corosync
    Current DC: rhel75-node2 (version 1.1.18-5.el7-1a4ef7d180) - partition with quorum
    Last updated: Wed Nov 15 16:07:44 2017
    Last change: Wed Nov 15 16:06:40 2017 by hacluster via cibadmin on rhel75-node1
    
    2 nodes configured
    14 resources configured (1 DISABLED)
    
    Online: [ rhel75-node1 rhel75-node2 ]
    
    Full list of resources:
    
     fencing        (stonith:fence_xvm):    Started rhel75-node1
     dummy5 (ocf::pacemaker:Dummy): Stopped (disabled)
     dummy6 (ocf::pacemaker:Dummy): Stopped
     dummy7 (ocf::pacemaker:Dummy): Started rhel75-node2
     dummy8 (ocf::pacemaker:Dummy): Started rhel75-node1
     dummy9 (ocf::pacemaker:Dummy): Started rhel75-node2
     Resource Group: group1
         dummy1     (ocf::pacemaker:Dummy): Started rhel75-node1
         dummy10    (ocf::pacemaker:Dummy): Started rhel75-node1
     Clone Set: group2-clone [group2]
         Started: [ rhel75-node1 rhel75-node2 ]
     Clone Set: dummy4-clone [dummy4]
         Started: [ rhel75-node1 rhel75-node2 ]
    
    Failed Actions:
    * dummy6_start_0 on rhel75-node1 'unknown error' (1): call=87, status=complete, exitreason='',
        last-rc-change='Wed Nov 15 16:05:55 2017', queued=0ms, exec=20ms
    
    # snmpwalk -v 2c -c public localhost PACEMAKER-PCS-V1-MIB::pcmkPcsV1Cluster
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterName.0 = STRING: "rhel75-cluster"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterQuorate.0 = INTEGER: 1
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNum.0 = INTEGER: 2
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNames.0 = STRING: "rhel75-node1"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNames.1 = STRING: "rhel75-node2"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOnlineNum.0 = INTEGER: 2
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOnlineNames.0 = STRING: "rhel75-node1"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOnlineNames.1 = STRING: "rhel75-node2"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOfflineNum.0 = INTEGER: 0
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOnlineNum.0 = INTEGER: 2
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOnlineNames.0 = STRING: "rhel75-node1"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOnlineNames.1 = STRING: "rhel75-node2"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesStandbyNum.0 = INTEGER: 0
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOfflineNum.0 = INTEGER: 0
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesNum.0 = INTEGER: 11
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.0 = STRING: "fencing"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.1 = STRING: "dummy5"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.2 = STRING: "dummy6"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.3 = STRING: "dummy7"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.4 = STRING: "dummy8"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.5 = STRING: "dummy9"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.6 = STRING: "dummy1"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.7 = STRING: "dummy10"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.8 = STRING: "dummy2"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.9 = STRING: "dummy3"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesIds.10 = STRING: "dummy4"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesNum.0 = INTEGER: 9
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.0 = STRING: "fencing"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.1 = STRING: "dummy7"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.2 = STRING: "dummy8"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.3 = STRING: "dummy9"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.4 = STRING: "dummy1"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.5 = STRING: "dummy10"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.6 = STRING: "dummy2"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.7 = STRING: "dummy3"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesIds.8 = STRING: "dummy4"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterStoppedResroucesNum.0 = INTEGER: 1
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterStoppedResroucesIds.0 = STRING: "dummy5"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterFailedResourcesNum.0 = INTEGER: 1
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterFailedResourcesIds.0 = STRING: "dummy6"
    PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterFailedResourcesIds.0 = No more variables left in this MIB View (It is past the end of the MIB tree)