Rest API /v1/inventory/Agents/Get always shows RUNNING for service

Hi,

I am in the process of remotely monitoring the PMM2 agents for postgres through API call to PMM2 Server.
I could get the service_id for the Postgres service and the API call to /v1/inventory/Agents/Get. But the API call returns the response properly, but the status is always “RUNNING” even though I stopped the agent manually on the host.

Is there anyway , I can monitor the status of postgres_exporter and qan_postgresql_pgstatements_agent status remotely without logging into the individual node.

For example

{
    "postgres_exporter": [
        {
            "agent_id": "/agent_id/92313ac0-74a8-4f8d-8874-c5c5dcae6cfc",
            "listen_port": 50226,
            "pmm_agent_id": "/agent_id/10ec276b-86a2-4afd-aabf-ed7cd4bfcb40",
            "service_id": "/service_id/83412f60-772f-4bc2-93d8-2644ae8c3e4d",
            "status": "RUNNING",
            "tls": true,
            "tls_skip_verify": true,
            "username": "pmm_user"
        }
    ],
    "qan_postgresql_pgstatements_agent": [
        {
            "agent_id": "/agent_id/dc7b810a-1c0b-4844-b952-13fcd862af44",
            "pmm_agent_id": "/agent_id/10ec276b-86a2-4afd-aabf-ed7cd4bfcb40",
            "service_id": "/service_id/83412f60-772f-4bc2-93d8-2644ae8c3e4d",
            "status": "RUNNING",
            "tls": true,
            "tls_skip_verify": true,
            "username": "pmm_user"
        }
    ]
}

Thanks
Raj

1 Like

Hi @Raj,

Thank you for your question,
Could explain what do you mean by stopping agent manually? Because our supervisor on pmm-agent restarts agent if it was stopped or killed manually.

Best regards,
Nurlan

1 Like

Hi @nurlan

Thanks for the reply. Sometimes agent gets stopped as part of node maintenance or not able to connect to the PMMserver for any network issue. In this case, the agent may be up and running and not able to communicate with the PMM server. We would like to monitor those situations remotely and alert it. Hope my explanation is clear

Thanks
Raj

Thanks for the explanation,
Looks like we have this bug, could you create a ticket in our Jira, please.

Thank you in advance

1 Like

Thanks. Created issue in the Jira board
https://jira.percona.com/browse/PMM-7285

1 Like

Thank you :slight_smile: