This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 754216 - Pacemaker should provide equivalent of clustat -x (cluster and services status in xml)
Pacemaker should provide equivalent of clustat -x (cluster and services statu...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pacemaker (Show other bugs)
6.3
Unspecified Unspecified
high Severity medium
: rc
: ---
Assigned To: David Vossel
Cluster QE
: TechPreview
Depends On:
Blocks: 756082 816875
  Show dependency treegraph
 
Reported: 2011-11-15 13:04 EST by Jaroslav Kortus
Modified: 2015-08-24 02:34 EDT (History)
6 users (show)

See Also:
Fixed In Version: pacemaker-1.1.7-2.el6
Doc Type: Technology Preview
Doc Text:
Do not document, internal change for other tools.
Story Points: ---
Clone Of:
: 816875 (view as bug list)
Environment:
Last Closed: 2012-06-20 09:48:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Jaroslav Kortus 2011-11-15 13:04:20 EST
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-23 20:13:11 EST
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 09:09:41 EST
Hmm, I thought the cibadmin -Q also had states.
Comment 6 Jaroslav Kortus 2011-12-02 11:44:34 EST
It does. But determining the state of the service is much harder compared to clustat -x.
Comment 10 Lon Hohberger 2012-01-04 15:23:48 EST
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 10:44:19 EST
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 10:50:21 EST
Jaroslav,

I believe this should address your needs.
Comment 16 Andrew Beekhof 2012-02-02 17:24:08 EST
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 17:38:48 EST
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 06:29:07 EST
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 11:28:30 EST
    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-14 21:33:18 EST
A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/ca5f8a9
Comment 23 Jaroslav Kortus 2012-02-28 09:20:18 EST
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 16:24:45 EST
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-28 19:28:00 EST
A related patch has been committed upstream: https://github.com/beekhof/pacemaker/commit/9c928be
Comment 26 Jaroslav Kortus 2012-02-29 05:13:04 EST
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 18:10:16 EST
That was changed as well in the next commit.

https://github.com/beekhof/pacemaker/commit/dfa526bb3dc0f99917447e9c330fda557fa014ad
Comment 28 Andrew Beekhof 2012-02-29 21:26:19 EST
BZ bot apparently didn't change the status after the errata update, setting to ON_QA manually
Comment 29 Jaroslav Kortus 2012-03-01 12:35:52 EST
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 04:05:17 EST
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 13:38:53 EST
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-06 23:23:53 EST
Totally forgot about that option, thanks David.
Jaraslav... all good now?
Comment 33 Jaroslav Kortus 2012-04-05 10:28:06 EDT
$ 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 18:22:58 EDT
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 11:19:08 EDT
(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 09:48:40 EDT
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.