News:

We really need your input in this questionnaire

Main Menu

CPU instance discovery

Started by Legoman, July 14, 2016, 10:47:08 AM

Previous topic - Next topic

Legoman

Hi,

I considered this great product, thank you for the job.

I try to add CPU usage on template and I would like to add a CPU usage per CPU with instance discovery (the same way I've done with disk usage and FileSystem.MountPoints). Is it possible ?

Thank you.

Alex Kirhenshtein

Yes, it's possible.

Create script which query System.CPU.Count from the node and return indexes it as array (e.g. 4 cpu == [0, 1, 2, 3]), then use this script in instance discovery.

tomaskir

Here is the script I use:

cpuCount = AgentReadParameter($node, "System.CPU.Count");

if (cpuCount == null || cpuCount == 1)
  return null;

array cpuArray;

for (i = 0; i < cpuCount; i++)
  cpuArray[i] = i;

return cpuArray;

Legoman

Excellent. It works ! Thank you.

rainerh

Hello,

I tried the script, but it does not work:

Configuration like this:

General:
   Description = Average CPU {instance} utilization for last Minute
   Data Parameter = System.CPU.Usage({instance})    from NetXMS Agent (Integer)

Instance Discovery:
   Instance Discovery method = Script
   next line = System.CPU.Count
   Instance discovery filter script = your script

Thank you
Rainer

zsing82

Create the script in the Script Library.

Open the DCI in the template and go to Instance Discovery.
Instance discovery method = Script
Next line = name of script in Script Library
Instance discovery filter script should be left blank.  Your script will be called from the Script Library as long you entered the script name in the line above.

Force an instance discovery poll to see if it works.

rainerh

Thank you, now the script and instance discovery works fine