Discovery of Multiple instances of a single server/service
I have a customized plugin which discovers a server based on the process name and collects the basic metrics using the SIGAR API. Things work very fine when a single instance of the server is run in system.
But when two or more instances are running, the process query fails stating that more than once processes are found and i'm not able to capture the metrics.
My process query is State.Name.ct=processName.
I went through a lot of options figuring out that,
State.Name.ct=processName,Pid.Pid=processId ==> would result in the specific process identification.
But again in case of servers who dont run on specific process id's [i dont have a PID file].
Is there any way to distinguish the process based on the ports in which the process runs.
Or is it that in Hyperic, only one instance of a server per system will be identified by the agent. I dont believe it might be like that. Please let me know if it is possible .
It's unclear if you're asking how to write a ptql that will uniquely identify your server or if you're asking how to make a plugin that will detect/create multiple instances of the server with different properties when it autoinventories.
The former simply requires more details about the system. If it's Windows ptql:Pid.Service.eq=servicename may solve your problem. For Linux you'll probably need to identify something unique on the command line arguments.
To have the plugin automagically locate and create multiple resources each with a correct ptql will probably require some coding. Check out the source of the JMX plugin for an easy to read example (org.hyperic.hq.product.jmx.MxServerDetector.java is a good starting place.)