GetDCI

Started by Nikk, April 30, 2014, 11:59:51 AM

Previous topic - Next topic

Nikk

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

Victor Kirhenshtein

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

Nikk

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

Victor Kirhenshtein

Looks like typo - you use = instead of == for comparison.

Best regards,
Victor

Nikk

Really, thank you for the obvious mistake :)

Nikk

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).

Victor Kirhenshtein

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

Nikk

It could be, but I don't have no direct access to that server to check it. Thank you!

Victor Kirhenshtein

You can query FileSystem.Total(E:) using nxget to check it.

Best regards,
Victor

Nikk

Sorry for late answer, been busy.

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