Pacemaker Command-Line Output

It was long common for agents and scripts to parse the text output of Pacemaker command-line tools. However, that approach is prone to problems when new versions were released and output changes.

To address this, Pacemaker has been gradually adding support for XML output for all command-line tools. The intent is that text output may change from release to release, but the XML output will change as little as possible, and remain backward-compatible as much as possible, for parsing. All commands will take the same --output-as option, which may be set to "none", "text" (the default), or "xml". Individual commands may support additional formats.

The schema for the XML output is installed as api-result.rng (typically in /usr/share/pacemaker/api). That file includes RNGs for each individual command. You can browse those to figure out how to parse what you want.

Pacemaker has also been gradually adding high-level C APIs corresponding to each command-line tool, and those generate identical XML output. See "Pacemaker High-Level API" in Pacemaker's API documentation for details.