Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2047983

Summary: pcs_snmp_agent fails to get cluster status due to uninitialized constant PCS_INTERNAL
Product: Red Hat Enterprise Linux 8 Reporter: Reid Wahl <nwahl>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: high Docs Contact:
Priority: high    
Version: 8.5CC: cluster-maint, idevat, kmalyjur, mlisik, mmazoure, mpospisi, nhostako, omular, sbradley, tojeline
Target Milestone: rcKeywords: EasyFix, Regression, Triaged
Target Release: 8.6Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcs-0.10.12-5.el8 Doc Type: Bug Fix
Doc Text:
Cause: User starts pcs snmp service to get cluster status over snmp. Consequence: Pcs snmp agent crashes. Fix: Define missing constant in pcs snmp agent code. Result: Pcs snmp agent works and provides data over snmp.
Story Points: ---
Clone Of:
: 2048640 (view as bug list) Environment:
Last Closed: 2022-05-10 14:50:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Reid Wahl 2022-01-29 01:08:38 UTC
Description of problem:

After upgrading to pcs-snmp-0.10.10-4.el8, pcs_snmp_agent fails to get the cluster status. pcs_snmp_agent.log shows the following with debug enabled:

2022-01-28 16:56:15,037 - pcs - DEBUG - Finished running: /usr/bin/ruby -I/usr/lib64/pcsd /usr/lib64/pcsd/pcsd-cli.rb node_status
Return value: 1
--Debug Stdout Start--

--Debug Stdout End--
--Debug Stderr Start--
/usr/lib64/pcsd/pcs.rb:1955:in `run_pcs_internal': uninitialized constant PCS_INTERNAL (NameError)
Did you mean?  PCS_INTERNAL_EXEC
	from /usr/lib64/pcsd/pcs.rb:1763:in `initialize'
	from /usr/lib64/pcsd/cluster_entity.rb:1184:in `new'
	from /usr/lib64/pcsd/cluster_entity.rb:1184:in `load_current_node'
	from /usr/lib64/pcsd/remote.rb:926:in `node_status'
	from /usr/lib64/pcsd/pcsd-cli-main.rb:131:in `block in pcsd_cli_main'
	from /usr/lib64/pcsd/pcsd-cli-main.rb:155:in `pcsd_cli_main'
	from /usr/lib64/pcsd/pcsd-cli.rb:5:in `<main>'

--Debug Stderr End--
2022-01-28 16:56:15,037 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.
PCSD return code: 1
PCSD output: {'status': 'bad_json_output', 'text': '', 'data': None}



The issue is fixed upstream via:
  - Fix snmp client (https://github.com/ClusterLabs/pcs/commit/f3767e59)

The issue isn't present in pcs-0.10.8-1. Not really sure why it's not present there, since in that version pcsd-cli.rb (which has the same contents as pcsd-cli-main.rb in pcs-0.10.10-4) also doesn't define PCS_INTERNAL. Anyway, seems to be a regression starting in 0.10.10 (RHEL 8.5).

-----

Version-Release number of selected component (if applicable):

pcs-snmp-0.10.10-4.el8

-----

How reproducible:

Always

-----

Steps to Reproduce:
1. Start pcs_snmp_agent.service.

-----

Actual results:

/var/log/pcsd/pcs_snmp_agent.log shows:
2022-01-28 16:56:15,037 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.

-----

Expected results:

The above error is not present.

------

Additional info:

The customer who reported this reported the following error from snmpwalk:

# snmpwalk -v 2c -c public localhost
PACEMAKER-PCS-V1-MIB::pcmkPcsV1Cluster
PACEMAKER-PCS-V1-MIB::pcmkPcsV1Cluster = No more variables left in this MIB
View (It is past the end of the MIB tree)

But I believe this is just a consequence of the undefined constant.

Comment 2 Tomas Jelinek 2022-01-31 09:58:55 UTC
Upstream patch: https://github.com/ClusterLabs/pcs/commit/f3767e59

Test:
Verify pcs_snmp_agent starts and provides data over snmp.

Comment 6 Miroslav Lisik 2022-02-03 10:07:18 UTC
DevTestResults:

[root@r8-node-01 ~]# rpm -q pcs{,-snmp}
pcs-0.10.12-5.el8.x86_64
pcs-snmp-0.10.12-5.el8.x86_64

[root@r8-node-01 ~]# echo -ne "master agentx\nview systemview included .1.3.6.1.4.1.32723.100\n" >> /etc/snmp/snmpd.conf
[root@r8-node-01 ~]# sed -e 's/\s*#.*//' -e '/^\s*$/ d' /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
master agentx
view systemview included .1.3.6.1.4.1.32723.100
[root@r8-node-01 ~]# systemctl start pcs_snmp_agent.service
[root@r8-node-01 ~]# systemctl status pcs_snmp_agent.service
● pcs_snmp_agent.service - SNMP agent for pacemaker cluster
   Loaded: loaded (/usr/lib/systemd/system/pcs_snmp_agent.service; disabled; >
   Active: active (running) since Thu 2022-02-03 11:03:04 CET; 7s ago
     Docs: man:pcs_snmp_agent(8)
 Main PID: 6925 (pcs_snmp_agent)
    Tasks: 2 (limit: 8424)
   Memory: 30.4M
   CGroup: /system.slice/pcs_snmp_agent.service
           └─6925 /usr/libexec/platform-python -Es /usr/lib64/pcs/pcs_snmp_ag>

Feb 03 11:03:04 r8-node-01 systemd[1]: Started SNMP agent for pacemaker clust>
[root@r8-node-01 ~]# tail /var/log/pcsd/pcs_snmp_agent.log
2022-02-03 09:23:41,598 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-03 09:24:13,540 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-03 09:24:44,641 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-03 11:03:05,389 - pcs.snmp - INFO - Update interval set to: 30
2022-02-03 11:03:05,390 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-03 11:03:05,391 - pyagentx.network - INFO - ==== Open PDU ====
2022-02-03 11:03:05,394 - pyagentx.network - INFO - ==== Ping PDU ====
2022-02-03 11:03:05,394 - pyagentx.network - INFO - ==== Register PDU ====
2022-02-03 11:03:05,394 - pyagentx.network - INFO - Registering: 1.3.6.1.4.1.32723.100.1
2022-02-03 11:03:05,395 - pyagentx.network - INFO - ==== Waiting for PDU ====
[root@r8-node-01 ~]# snmpwalk -v 2c -c public localhost PACEMAKER-PCS-V1-MIB::pcmkPcsV1Cluster
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterName.0 = STRING: "HACluster"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterQuorate.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNum.0 = INTEGER: 3
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNames.0 = STRING: "r8-node-01"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNames.1 = STRING: "r8-node-02"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterNodesNames.2 = STRING: "r8-node-03"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOnlineNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOfflineNum.0 = INTEGER: 3
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOfflineNames.0 = STRING: "r8-node-01"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOfflineNames.1 = STRING: "r8-node-02"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterCorosyncNodesOfflineNames.2 = STRING: "r8-node-03"
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOnlineNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesStandbyNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterPcmkNodesOfflineNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterAllResourcesNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterRunningResourcesNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterStoppedResroucesNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterFailedResourcesNum.0 = INTEGER: 0
PACEMAKER-PCS-V1-MIB::pcmkPcsV1ClusterFailedResourcesNum.0 = No more variables left in this MIB View (It is past the end of the MIB tree)

Comment 10 Michal Mazourek 2022-02-28 14:18:10 UTC
BEFORE:
=======

[root@virt-250 ~]# rpm -q pcs pcs-snmp
pcs-0.10.12-4.el8.x86_64
pcs-snmp-0.10.12-4.el8.x86_64


## adding lines "master agent" and "view systemview included .1.3.6.1.4.1.32723.100" to snmp config

[root@virt-250 ~]# echo -ne "master agentx\nview systemview included .1.3.6.1.4.1.32723.100\n" >> /etc/snmp/snmpd.conf
[root@virt-250 ~]# sed -e 's/\s*#.*//' -e '/^\s*$/ d' /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
master agentx
view systemview included .1.3.6.1.4.1.32723.100


## Starting the agent and checking its status

[root@virt-250 ~]# systemctl start pcs_snmp_agent.service
[root@virt-250 ~]# echo $?
0

[root@virt-250 ~]# systemctl status pcs_snmp_agent.service
● pcs_snmp_agent.service - SNMP agent for pacemaker cluster
   Loaded: loaded (/usr/lib/systemd/system/pcs_snmp_agent.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-02-28 14:57:31 CET; 7s ago
     Docs: man:pcs_snmp_agent(8)
 Main PID: 1115043 (pcs_snmp_agent)
    Tasks: 2 (limit: 25538)
   Memory: 28.8M
   CGroup: /system.slice/pcs_snmp_agent.service
           └─1115043 /usr/libexec/platform-python -Es /usr/lib64/pcs/pcs_snmp_agent

Feb 28 14:57:31 virt-250 systemd[1]: Started SNMP agent for pacemaker cluster.

[root@virt-250 ~]# cat /var/log/pcsd/pcs_snmp_agent.log
2022-02-28 14:57:32,345 - pcs.snmp - INFO - Update interval set to: 30
2022-02-28 14:57:32,346 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 14:57:32,347 - pyagentx.network - INFO - ==== Open PDU ====
2022-02-28 14:57:32,354 - pyagentx.network - INFO - ==== Ping PDU ====
2022-02-28 14:57:32,364 - pyagentx.network - INFO - ==== Register PDU ====
2022-02-28 14:57:32,364 - pyagentx.network - INFO - Registering: 1.3.6.1.4.1.32723.100.1
2022-02-28 14:57:32,370 - pyagentx.network - INFO - ==== Waiting for PDU ====
2022-02-28 14:57:34,701 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.
PCSD return code: 1
PCSD output: {'status': 'bad_json_output', 'text': '', 'data': None}

2022-02-28 14:58:02,728 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 14:58:04,978 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.
PCSD return code: 1
PCSD output: {'status': 'bad_json_output', 'text': '', 'data': None}

2022-02-28 14:58:33,007 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 14:58:35,226 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.
PCSD return code: 1
PCSD output: {'status': 'bad_json_output', 'text': '', 'data': None}

2022-02-28 14:59:03,252 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 14:59:05,390 - pcs.snmp.updaters.v1 - ERROR - Unable to obtain cluster status.
PCSD return code: 1
PCSD output: {'status': 'bad_json_output', 'text': '', 'data': None}

> Error message about obtaining status is present.


AFTER:
======

[root@virt-250 ~]# rpm -q pcs pcs-snmp
pcs-0.10.12-6.el8.x86_64
pcs-snmp-0.10.12-6.el8.x86_64


## adding lines "master agent" and "view systemview included .1.3.6.1.4.1.32723.100" to snmp config

[root@virt-250 ~]# echo -ne "master agentx\nview systemview included .1.3.6.1.4.1.32723.100\n" >> /etc/snmp/snmpd.conf
[root@virt-250 ~]# sed -e 's/\s*#.*//' -e '/^\s*$/ d' /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
master agentx
view systemview included .1.3.6.1.4.1.32723.100


## Starting the agent and checking its status

[root@virt-250 ~]# systemctl start pcs_snmp_agent.service
[root@virt-250 ~]# echo $?
0

[root@virt-250 ~]# systemctl status pcs_snmp_agent.service
● pcs_snmp_agent.service - SNMP agent for pacemaker cluster
   Loaded: loaded (/usr/lib/systemd/system/pcs_snmp_agent.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-02-28 15:10:13 CET; 22s ago
     Docs: man:pcs_snmp_agent(8)
 Main PID: 1118906 (pcs_snmp_agent)
    Tasks: 2 (limit: 25538)
   Memory: 30.2M
   CGroup: /system.slice/pcs_snmp_agent.service
           └─1118906 /usr/libexec/platform-python -Es /usr/lib64/pcs/pcs_snmp_agent

Feb 28 15:10:13 virt-250 systemd[1]: Started SNMP agent for pacemaker cluster.

[root@virt-250 ~]# cat /var/log/pcsd/pcs_snmp_agent.log
{...}
2022-02-28 15:09:55,456 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 15:10:14,499 - pcs.snmp - INFO - Update interval set to: 30
2022-02-28 15:10:14,500 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)
2022-02-28 15:10:14,501 - pyagentx.network - INFO - ==== Open PDU ====
2022-02-28 15:10:14,502 - pyagentx.network - INFO - ==== Ping PDU ====
2022-02-28 15:10:14,502 - pyagentx.network - INFO - ==== Register PDU ====
2022-02-28 15:10:14,506 - pyagentx.network - INFO - Registering: 1.3.6.1.4.1.32723.100.1
2022-02-28 15:10:14,509 - pyagentx.network - INFO - ==== Waiting for PDU ====
2022-02-28 15:10:44,947 - pyagentx.updater - INFO - Updating : ClusterPcsV1Updater (1.3.6.1.4.1.32723.100.1)

> OK: No error message about obtaining cluster status


Marking as VERIFIED for pcs-0.10.12-6.el8, pcs-snmp-0.10.12-6.el8.

Comment 12 errata-xmlrpc 2022-05-10 14:50:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (pcs bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:1978