Query PowerShell via Agent

Started by Anders, August 02, 2012, 10:06:53 AM

Previous topic - Next topic

Anders

Hi,

I wonder if it would be possible to execute a PowerShell command via the agent and return the output result to NetXMS for monitoring? For example, I'd like to send the following PowerShell query to my Exchange 2010 server, in order to find out how many e-mails currently are waiting delivery in mail queue:

Get-Queue -Sort-Order:-MessageCount -Result:1 | fl -Property MessageCount

Maybe there is a better solution for what I'm attempting?

Thanks!

Anders


Victor Kirhenshtein

Hi!

You can define external parameter in agent. Add the following line to your nxagentd.conf:

ExternalParameter = Exchange.MessageCount:powershell -Command "& {Get-Queue -Sort-Order:-MessageCount -Result:1 | fl -Property MessageCount}"

Part before : is a name for new parameter, you can set it whatever you want.

Restart agent, do configuration poll on a node, and you should see new parameter in parameters oist and be able to collect it as any other agent's parameter.

Best regards,
Victor

Anders