Knowledge base

Command output formats

output format options
Not just text

The pmta command prints its result in one of four formats: text for a person — by default, –xml, –dom — variables for scripts without XML parsing — and –json.

The format option goes before the command: pmta –json show status.

The main trap is parsing the text output with a script. Column widths and text headers are designed for the eyes and change between versions; a structure holds by its fields.
What the Hub does. Through POST /command it asks for json — a structure: json-text returned an empty string for some commands. The commands the Hub runs over SSH it reads as text.
Recommended values

Four formats:

Option What it prints For whom
— text a person
–xml XML programs with XML
–dom variables of the form name=”value” Perl and shell scripts
–json JSON programs with JSON
The four formats and their purpose come from the manual (§ 6.2). The trap analysis is ours.
Example configuration
# state as a structure and as DOM variables
pmta --json show statuspmta --dom show status | grep smtpOut
DOM variables are searched with plain grep — that is what the format is designed for.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
How to check on the node
Compare the formats of one command:
pmta show version
pmta --json show version
The data is the same; only the form changes.
In the Hub
Cost of a mistake
safe: a wrong value breaks nothing
Scenarios
Collect telemetry