PEM Agent Troubleshooting¶
Restoring a Deleted PEM Agent¶
If an agent has been deleted from the pem.agent table then you cannot restore it. You will need to use the pemworker utility to re-register the agent.
If an agent has been deleted from PEM Web client but still has an entry in the pem.agent table with value of active = f, then you can use the following steps to restore the agent:
Use the following command to check the values of the
idandactivefields:pem=# SELECT * FROM pem.agent;Update the status for the agent to
truein thepem.agenttable:pem=# UPDATE pem.agent SET active=true WHERE id=<x>;Where
xis the identifier that was displayed in the output of the query used in step 1.Refresh the PEM web client.
The deleted agent will be restored again. However, the servers that were bound to that particular agent might appear to be down. To resolve this issue, you need to modify the PEM agent properties of the server to add the bound agent again; after the successful modification, the servers will be displayed as running properly.
Using the Command Line to Delete a PEM Agent with Down or Unknown Status¶
Using the PEM web interface to delete PEM agents with Down or Unknown status may be difficult if the number of such agents is large. In such a situation, you might want to use the command line interface to delete Down or Unknown agents.
Use the following query to delete the agents that are
Downfor more than N number of hours:UPDATE pem.agent SET active=false WHERE id IN (SELECT a.id FROM pem.agent a JOIN pem.agent_heartbeat b ON (b.agent_id=a.id) WHERE a.id IN (SELECT agent_id FROM pem.agent_heartbeat WHERE (EXTRACT (HOUR FROM now())- EXTRACT (HOUR FROM last_heartbeat)) > <N> ));
Use the following query to delete the agents with an
Unknownstatus:UPDATE pem.agent SET active=false WHERE id IN (SELECT id FROM pem.agent WHERE id NOT IN (SELECT agent_id FROM pem.agent_heartbeat));