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 754216 - Pacemaker should provide equivalent of clustat -x (cluster and services status in xml)
Summary: Pacemaker should provide equivalent of clustat -x (cluster and services statu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pacemaker
Version: 6.3
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: David Vossel
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks: 756082 816875
TreeView+ depends on / blocked
 
Reported: 2011-11-15 18:04 UTC by Jaroslav Kortus
Modified: 2015-08-24 06:34 UTC (History)
6 users (show)

Fixed In Version: pacemaker-1.1.7-2.el6
Doc Type: Technology Preview
Doc Text:
Do not document, internal change for other tools.
Clone Of:
: 816875 (view as bug list)
Environment:
Last Closed: 2012-06-20 13:48:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Sample xml of crm --as-xml output. (3.22 KB, text/plain)
2012-02-02 15:44 UTC, David Vossel
no flags Details
Sample 2 with Andrew's suggestions (3.71 KB, text/xml)
2012-02-02 22:38 UTC, David Vossel
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0846 0 normal SHIPPED_LIVE pacemaker bug fix and enhancement update 2013-06-06 14:38:17 UTC

Description Jaroslav Kortus 2011-11-15 18:04:20 UTC
Description of problem:
Currently there are couple of options to query the status of services (resources). Unfortunately none of them offers xml output which makes parsing and querying much simpler.

Version-Release number of selected component (if applicable):
pacemaker-1.1.6-3.el6.x86_64

  
Actual results:
no tool produces parsable xml output with cluster and resources states

Expected results:
parsable xml output from as much tools as possible, especially:
crm_mon
crm_resource (this one has xml output for the resource but without any state information)

Additional info:

Comment 4 Andrew Beekhof 2011-11-24 01:13:11 UTC
cibadmin -Q exposes the list of cluster resources and the actions that have been performed on them.

the state/location of individual resources can be queries using crm_resource --locate (for scripts you'll probably want --quiet too).

Not sure that there is a need for a new tool here.

Comment 5 Lon Hohberger 2011-12-02 14:09:41 UTC
Hmm, I thought the cibadmin -Q also had states.

Comment 6 Jaroslav Kortus 2011-12-02 16:44:34 UTC
It does. But determining the state of the service is much harder compared to clustat -x.

Comment 10 Lon Hohberger 2012-01-04 20:23:48 UTC
It appears crm_mon is the most logical equivalent to 'clustat', but the output is not uniformly parseable even in HTML form.

It also appears fairly trivial to add a print_xml_status() which is uniformly parseable...:

<?xml version="1.0"?>
<crm_mon version="1.0">
  <nodes>
    <node name="rhel6-1" nodeid="1" state="1" dc="1" standby_onfail="0" standby="0"/>
    <node name="rhel6-2" nodeid="2" state="1" dc="0" standby_onfail="0" standby="0"/>
  </nodes>
  <resources>

[until you get here, where each resource type (clone, group, native, etc.) have their own print functions which would need to be augmented individually in order to present parseable output.]

  </resources>
</crm_mon>

So, some work is necessary here, but it looks fairly simple, though I haven't discussed with Andrew.  Obviously, there are not "services" in the same way rgmanager has them - so you would probably see:

  <resources>
    <group ... >
      <resource ... >
    </group>
    <resource ... />
    <clone  ... />
  </resources>

Comment 12 David Vossel 2012-02-02 15:44:19 UTC
Created attachment 559075 [details]
Sample xml of crm --as-xml output.

I've attached some sample output of the crm_mon --as-xml option I have been working on.

Comment 13 Lon Hohberger 2012-02-02 15:50:21 UTC
Jaroslav,

I believe this should address your needs.

Comment 16 Andrew Beekhof 2012-02-02 22:24:08 UTC
Looking good.

I think we want to include the node's uuid when listing where the resource is active.
We also need a better name for multi_state_slave_master, lets change it to just "multi_state".

Comment 17 David Vossel 2012-02-02 22:38:48 UTC
Created attachment 559155 [details]
Sample 2 with Andrew's suggestions

I uploaded a new sample xml with Andrew's suggestions.

Comment 18 Jaroslav Kortus 2012-02-03 11:29:07 UTC
the attached xml looks very promising, I really like it :). Thanks guys.

I've also changed the component back to pacemaker as I think the change to 389-ds-base was not intentional.

Comment 19 Lon Hohberger 2012-02-08 16:28:30 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Do not document, internal change for other tools.

Comment 21 Andrew Beekhof 2012-02-15 02:33:18 UTC
A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/ca5f8a9

Comment 23 Jaroslav Kortus 2012-02-28 14:20:18 UTC
is there any reason why --as-xml has a mandatory filename parameter?

My idea was to have it like clustat -x which goes to stdout (and then enables us to filter that via gxpp for example).

Can you please change it to print to stdout?

Comment 24 Andrew Beekhof 2012-02-28 21:24:45 UTC
Funnily enough we just spoke about this in the team meeting and reached the same conclusion:
   https://github.com/beekhof/pacemaker/commit/9c928be

Comment 25 Andrew Beekhof 2012-02-29 00:28:00 UTC
A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/9c928be

Comment 26 Jaroslav Kortus 2012-02-29 10:13:04 UTC
great :)

just a small remark from the patch:
+    {"as-xml",         0, 0, 'X', "Write cluster status to the named xml file"},

should not this be changed as well, when it's not writing to a file any more?

Comment 27 David Vossel 2012-02-29 23:10:16 UTC
That was changed as well in the next commit.

https://github.com/beekhof/pacemaker/commit/dfa526bb3dc0f99917447e9c330fda557fa014ad

Comment 28 Andrew Beekhof 2012-03-01 02:26:19 UTC
BZ bot apparently didn't change the status after the errata update, setting to ON_QA manually

Comment 29 Jaroslav Kortus 2012-03-01 17:35:52 UTC
thanks for such a quick fix :).

For today I'll have another question. Would it be possible to show all resources and their states in the output?

I'd like to see the same tree no matter what the state of the cluster is. For every configured resource there should be an entry saying what it's state is.

I came to this by loosing quorum in the cluster, then the reported <resources> section includes only the STONITH agent:
    <resources>
        <resource id="virt-fencing" resource_agent="stonith:fence_xvm" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
            <node name="node01" id="node01" />
        </resource>
    </resources>

while in full operation it says:
    <resources>
        <resource id="virt-fencing" resource_agent="stonith:fence_xvm" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
            <node name="node01" id="node01" />
        </resource>
        <group id="group01" number_resources="2" >
             <resource id="webserver" resource_agent="ocf::heartbeat:apache" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
                 <node name="node03" id="node03" />
             </resource>
             <resource id="ClusterIP" resource_agent="ocf::heartbeat:IPaddr2" role="Started" active="true" orphaned="false" managed="true" failed="false" failure_ignored="false" nodes_running_on="1" >
                 <node name="node03" id="node03" />
             </resource>
        </group>
    </resources>

Comment 30 Andrew Beekhof 2012-03-02 09:05:17 UTC
Traditionally we skip stopped resources but it makes sense in this situation.
David, can you handle this amendment please?

Comment 31 David Vossel 2012-03-02 18:38:53 UTC
Does the --inactive option not already accomplish this?

Example: crm_mon --as-xml --inactive

My understanding is the --inactive option adds the stopped resources to the xml output, which seems to be what you need. It appears to work as I would expect it to for a test scenario I have running on my box.

Comment 32 Andrew Beekhof 2012-03-07 04:23:53 UTC
Totally forgot about that option, thanks David.
Jaraslav... all good now?

Comment 33 Jaroslav Kortus 2012-04-05 14:28:06 UTC
$ crm_mon -1 --as-xml --inactive

the output looks as expected, thank you, guys :)

two remarks:
1. without -1 options it looks just "stuck", maybe it should be implied by --as-xml
2. I'd prefer --only-active option and have --inactive as default (like clustat -x in cman)

pacemaker-1.1.7-5.el6.x86_64

Comment 34 David Vossel 2012-04-05 22:22:58 UTC
For item 1, no problem.  I'll make the -1 option implied when --as-xml is used.

As for item 2, that would be changing the default behavior of the tool that has been established for almost a decade.  This isn't something we can change at this point.

Comment 35 David Vossel 2012-04-10 15:19:08 UTC
(In reply to comment #34)
> For item 1, no problem.  I'll make the -1 option implied when --as-xml is used.
> 
A related patch has been committed upstream.

https://github.com/ClusterLabs/pacemaker/commit/13df1b4c23e89b024801973d82e43f6d959f6df4

Comment 40 errata-xmlrpc 2012-06-20 13:48:40 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2012-0846.html


Note You need to log in before you can comment on or make changes to this bug.