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 restore the agent using the following steps:

  1. Use the following command to check the values of the id and active fields:

    pem=# select * from pem.agent;

  2. Update the status for the agent to true in the pem.agent table:

    pem=# update pem.agent set active=true where id=<x>;

    Where, x is the identifier that was displayed in the output of the query used in step 1.

  3. 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.

Reconfiguring the PEM Server

In certain situations, you may need to uninstall the PEM server, install it again, and reconfigure the PEM server. Use the following commands in the given sequence:

  1. Use the following command to remove the PEM server configuration and uninstall:

    usr/edb/pem/bin/configure-pem-server.sh –un

  2. Use the following command to remove the PEM packages:

    yum erase edb-pem-server

  3. Use the following command to drop the pem database:

    DROP DATABASE pem

  4. Move the certificates from /root/.pem/ to another location:

    mv /root/.pem/* <new_location>

  5. Move the agent.cfg file from /usr/edb/pem/agent/etc/agent.cfg to another location:

    mv /usr/edb/pem/agent/etc/agent.cfg <new_location>

  6. Then, use the following command to configure the PEM server again:

    /usr/edb/pem/bin/configure-pem-server.sh'

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 situations, you might want to use the command line interface to delete Down or Unknown agents.

  1. Use the following query to delete the agents that are Down for more than N number of hours:
DELETE FROM pem.agent 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> ));``
  1. Use the following query to delete the agents with an Unknown status:
DELETE FROM pem.agent WHERE id IN
(SELECT id FROM pem.agent WHERE id NOT IN
(SELECT agent_id FROM pem.agent_heartbeat));``