Description
If I use list to show the agents then the JSON output uses agent to name the list of agents:
=> pmm-admin list --json | python -c 'import json; print json.load(open("/dev/stdin", "r")).get("agent")' [{u'status': u'connected', u'service_id': u'', u'agent_type': u'pmm-agent', u'agent_id': u'/agent_id/0a40910a-a829-4f82-9bb2-953e12144ace'}, {u'status': u'running', u'service_id': u'', u'agent_type': u'node_exporter', u'agent_id': u'/agent_id/53f2d2b6-b2a5-4721-aba0-78f1f607fdcd'}]
Whereas, if I use status then the JSON output uses agents:
=> pmm-admin status --json | python -c 'import json; print json.load(open("/dev/stdin", "r")).get("pmm_agent_status", {}).get("agents")' [{u'status': u'RUNNING', u'agent_type': u'NODE_EXPORTER', u'agent_id': u'/agent_id/53f2d2b6-b2a5-4721-aba0-78f1f607fdcd'}]
Also, status changes from "running" to "RUNNING", agent_type changes from "node_exporter" to "NODE_EXPORTER", etc
Most pmm-admin command results use generated API object strucutres:
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/status.go#L43
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/management/add_mysql.go#L40
- etc
Some commands (list, inventory list) use plain strings instead:
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/list.go#L43-L60
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/inventory/list_agents.go#L37-L47
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/inventory/list_nodes.go#L34-L43
- https://github.com/percona/pmm-admin/blob/84d77ee2860b703bd7de551a9b61b18cc09b96de/commands/inventory/list_services.go#L37-L46
- maybe something else?
All results should use generated API object structures. Tests should be added.
Attachments
Issue Links
- causes
-
PMM-5112 The Inventory API List requests now can be filtered by the Node/Service/Agent type
-
- Done
-