NetXMS Support Forum

English Support => General Support => Topic started by: Nikk on April 30, 2014, 11:59:51 AM

Title: GetDCI
Post by: Nikk on April 30, 2014, 11:59:51 AM
Hi,

I was wondering whether i can achieve this or not:

I have dci's who shows free disk space and dci's who shows total disk space. For one node there are more than one disk.
What i want is, when alarm ir raised from free disk space threshold, i want to pass the total disk value to event too.
I can achieve this with script:
Quotereturn GetDCIValue($node, FindDCIByName($node, "Filesystem.Total(C:)"));
but this is for one dci with disk C.
So is there a way to use this one script or event for more than one disk, or I must create new script and event for each disk?

Regards,
Nikk
Title: Re: GetDCI
Post by: Victor Kirhenshtein on May 05, 2014, 04:37:26 PM
Hi!

In the script you have access to DCI's "instance" field (via $event->instance). If you have correct disk name in that field (and it will be populated automatically if DCI in question was created by instance discovery) you can form correct DCI name for FindDCIByName.

Best regards,
Victor
Title: Re: GetDCI
Post by: Nikk on May 07, 2014, 03:33:25 PM
Thanks for solution!

So I tried it, stumpled upon instance discovery filter script. I wanted to get only C and D disks.
I tried this script:
Quoteif (substr($1,1,1) = "C") || (substr($1,1,1) = "D")
{
   return true;
}
else
{
   return false;
}


Seems like i don't get something, please guide me to right path :)

Nikk
Title: Re: GetDCI
Post by: Victor Kirhenshtein on May 07, 2014, 06:10:16 PM
Looks like typo - you use = instead of == for comparison.

Best regards,
Victor
Title: Re: GetDCI
Post by: Nikk on May 12, 2014, 10:05:20 AM
Really, thank you for the obvious mistake :)
Title: Re: GetDCI
Post by: Nikk on May 12, 2014, 12:10:38 PM
Anyway, i'm still getting the other disks (see 1. screen), maybe the script isn't right.

Then i tried your script:
Quotevalue = AgentReadParameter($node, "FileSystem.Total(" . $1 . ")");
return (value != null) && (value > 0);

And get rid only of Disk A:, but no disk E: (see 2. screen).
Title: Re: GetDCI
Post by: Victor Kirhenshtein on May 12, 2014, 07:50:04 PM
Script looks correct. Could it be that disk E: has non-zero total space (could be the case if this is CD drive with disk inserted or any other read-only device)?

Best regards,
Victor
Title: Re: GetDCI
Post by: Nikk on May 14, 2014, 09:42:54 AM
It could be, but I don't have no direct access to that server to check it. Thank you!
Title: Re: GetDCI
Post by: Victor Kirhenshtein on May 14, 2014, 05:57:41 PM
You can query FileSystem.Total(E:) using nxget to check it.

Best regards,
Victor
Title: Re: GetDCI
Post by: Nikk on May 29, 2014, 08:50:11 PM
Sorry for late answer, been busy.

I checked with nxget and it returned non-zero value.