Because the agent framework is multithreaded, all C++ code written by the agent developer must be MT-safe. For best results, avoid using global variables. If you do use them, access must be serialized (for example, by using mutex locks).
The following guidelines also apply:
readdir_r
() instead of readdir
(). Access manual pages for either of these commands by entering: man
command.
pthread_cleanup_push
and pthread_cleanup_pop
for details. Access manual pages for either of these commands by entering: man
command.
If you develop an agent with at least one entry point implemented in C++, you must implement the function VCSAgStartup() and use the required C++ primitives to register the C++ entry point with the agent framework.
A sample file containing templates for creating an agent using C++ entry points is located in:
UNIX: $VCS_HOME/src/agent/Sample
You can use C++ to develop agents for monitoring applications that run in containers, including non-global zones. VCS provides APIs for container suppport.