JSON Output of the pmm-admin list CommandBorys Belinsky
In this blog post, we’ll look at Percona Monitoring and Management’s pmm-admin list command.
The pmm-admin list command shows all monitoring services you have added using the pmm-admin add command. Starting with version 1.4.0, Percona Monitoring and Management (PMM) also lists external monitoring services when you run pmm-admin list, i.e., those services that monitor the backends not supported out of the box (such as PostgreSQL databases).
In the output, the external monitoring services appear at the bottom:
JSON Output for Automatic Verification
But there is also another feature of pmm-admin list. If you run this command with the –json parameter, the command gives you a JSON document as output. This option now enables inspecting the monitoring services by computers due to the strict JSON syntax rules. JSON has become a de-facto standard for exchanging data for many tools. The JSON output provided by the pmm-admin list command can be used by configuration management tools such as ansible or chef.
The output is captured as keys and values. The general information about the computer where this pmm-client is installed is given as top-level elements:
You can quickly determine if there are any errors in built-in monitoring services by inspecting the
Err top level element in the JSON output. Similarly, the
ExternalErr element reports errors on external services:
Representing Monitoring Services
Two elements contain lists as their values. The
Services top-level element contains a list of documents that represent enabled monitoring services. The
ExternalServices element contains a list of documents that represent enabled external monitoring services. Each attribute in the Services and ExternalServices elements provides the same information as a column in the tabular output.
Hope this brief post provides some valuable information regarding new Percona Monitoring and Management 1.4.0 functionality. Let me know about any questions in the comments.