Search code examples
perfino

How to upgrade agents in running environment?


I'm using Perfino to monitor some Tomcats in SLES. The server has its own installer, so upgrading it is not an issue (just run the installer, and it'll detect the existing installation an upgrade it). But there is no installer for the agents.

I already contacted EJ-Technology's support about this issue (emphasis mine):

the agents are updated automatically. The monitored applications will continue to run with the same agent until they are restarted. In the VMs view you will see a special icon next to VM that indicates that the agent is out of date.

If I understand it correctly, the agents in the running JVMs are upgraded on the fly. But I checked the agent.jar, perfino.jar and libperfino.so and neither of them are modified, so after restart, the server will need to upgrade it again.

I've already experienced problems with outdated agents, so I have begun building my own rpms to deploy the agent upgrades (that is, all the agent.tar.gz). But I'm now a bit concerned about the appropriateness of this method: it depends on the class loader the jar of a running application can be overwritten. I've done it already and nothing broke. But...

Is it safe to unpack a new agent.tar.gz of a running monitored application?


Solution

  • But I checked the agent.jar, perfino.jar and libperfino.so and neither of them are modified

    The server pushes the new agent to all monitored JVMs, but it does not overwrite the agent that you specified in the -javaagent:[path to perfino.jar] VM parameter, because those files may be in use and they might not even be writable.

    Instead, the new agent is saved to the ~/.perfino/agent directory. Each agent update has an ID and that is the name of the subdirectory where the agent is stored. The file perfino.jar is just a bootstrapper that selects the most recent available agent at startup.

    Is it safe to unpack a new agent.tar.gz of a running monitored application?

    No, that would not be safe in general, the removed JAR files may still be required for class loading.