Templates & Instance Discovery

Started by zsing82, March 16, 2014, 04:53:45 AM

Previous topic - Next topic

zsing82

Is it possible to use Instance Discovery within a DCI configured to a Template?  I've tried to configure this according to youTube videos and instructions on the Wiki, but it seems the DCIs never get created on the actual node after applying Template when using Instance Discovery.

I'm running 1.2.12 on Windows 2008 with SQL 2008.  Any help would be appreciated.

zsing82

#1
OK, one of the things I'm trying to do is collect bandwidth consumption from Windows hosts and servers running NetXMS Agent.

Here's what I have:
A template named "Agents" with Automatic Apply script as
return $node->isAgent;

Template "Agents" contain multiple DCIs.  I have 2 specific DCIs:
Number of input bytes on interface {instance}
Number of output bytes on interface {instance}


with source being "NetXMS Agent"; data type "UnsignedInt64"; and parameters as follows:
Net.Interface.BytesIn64({instance})
Net.Interface.BytesOut64({instance})


The "Instance Discovery" page is where I think I'm getting something wrong.  For both DCIs, I have "Agent List" as discovery method and List Name is "Net.InterfaceList".  This list returns the ifIndex, IP Address, ifType, MAC Address, and ifDesc.
I'd like to transform the list results so that only ifIndex is returned to {instance}, but I have no idea how to do that.  Is this even possible using Templates?

P.S.  I'd also like to perform similar action with FileSystem.FreeSpace%, etc...

Victor Kirhenshtein

Hi!

You can transform instance values in instance filtering script. Fltering script can return an array consisting of two elements - true/false flag and new instance value. For extracting interface index from interface list you can use the following script:


if ($1 ~= "^([0-9]+) .*")
{
   return %(true, $1);  // at this point $1 contains first matching group
}
return false;


Best regards,
Victor

zsing82

Thank you very much for your help!  That worked perfectly.  I never would've figured out that script

Haari

Hello,

tried to do the same Thing like zsing82 but i'm always getting an error:

Status of DCI 98 (NetXMS Agent: Net.Interface.BytesIn64()) changed to UNSUPPORTED

It seems that there is something wrong with the "instance". the filtering script is exactly the one from victors post.

I tried something similar with my hdd's and "FileSystem.MountPoints" as Instance List. This list works and delivers me all the wanted Information. But for the Network Interfaces i end up with this "unsupported"-error.

Any ideas?

Kind Regards
Haari

tomaskir

Quote from: Haari on October 20, 2014, 02:07:34 PM
Hello,

tried to do the same Thing like zsing82 but i'm always getting an error:

Status of DCI 98 (NetXMS Agent: Net.Interface.BytesIn64()) changed to UNSUPPORTED

It seems that there is something wrong with the "instance". the filtering script is exactly the one from victors post.

I tried something similar with my hdd's and "FileSystem.MountPoints" as Instance List. This list works and delivers me all the wanted Information. But for the Network Interfaces i end up with this "unsupported"-error.

Any ideas?

Kind Regards
Haari
Attach a screenshot of how your DCI is configured please.

Victor Kirhenshtein

It could be that your agent does not support 64 bit interface counters (they are supported only on Windows Vista and later). Then you have to use Net.Interface.BytesIn.

Best regards,
Victor

Haari

Hi,

here come the screenshots from my DCI.
The OS is WIN 7 Prof. (64 Bit)

Using "nxget -l <host> Net.InterfaceList" on the Server delivers 2 Interfaces with IP and other informations. So for me it seems correct.

Sorry if this is a dumb question but we are currently checking if netxms could be an alternative for our already outdated NAGIOS Installation. Cause of this i'm trying a lot of things to check what's possible an what might not.

Best regards
Haari


Victor Kirhenshtein

That's very strange. I just test it just in case, and it works as expected. Let's try to delete all DCIs already created and create new one from scratch to be sure that everything is correct, and then run configuration poll so instance discovery will occur.

Best regards,
Victor

tomaskir

Just an update - since this topic is the top google result for NetXMS Agent Instance discovery.

With 2.0 there is a new agent list "Net.InterfaceNames" which contains all interface names present on a node.
You can use this list as instance discovery source, without a need for any filtering script.

Screenshots attached.