NetXMS Support Forum

English Support => General Support => Topic started by: Stardust on February 12, 2016, 12:44:06 PM

Title: Send different DCI values from the same node (or not?)
Post by: Stardust on February 12, 2016, 12:44:06 PM
Hello,

I'm generating an event when disk space is low -> no problem.

I generate a Treshold when FileSystemFreePerc < 10%.
On the message field of Event configuration I write: "Low disk space of %n : %4 %% (limit %3 %%)" and then send it by mail.

But how can I send the value of another parameter like FileSystem.Total of the same node? (or of another? I see that each parameter have ID).


Regards
Title: Re: Send different DCI values from the same node (or not?)
Post by: Victor Kirhenshtein on February 12, 2016, 12:52:46 PM
Hi,

you can use scripts for that. You can insert return value of script from script library using %[script_name] macro, and in a script you can use AgentReadParameter to read data directly from agent or GetDCIValueByName/GetDCIValueByDescription to get value of another DCI.

Best regards,
Victor
Title: Re: Send different DCI values from the same node (or not?)
Post by: Stardust on February 12, 2016, 05:57:55 PM
Thanks for the reply,

I've done:

sub Free()
{
   
   value = AgentReadParameter($node, "FileSystem.Free(" . $1 . ")");
   return (value != null) && (value > 0);
}


In a script library.

(I wanted that the script work on the actual "instance" letter Drive, is that possible?)



Then, in event message "%[NameInTheLibrary]" doesn't work.


Title: Re: Send different DCI values from the same node (or not?)
Post by: Victor Kirhenshtein on February 12, 2016, 07:09:04 PM
Hi,

there are few errors:

1. you should place your code within main() function or not use functions at all;
2. If this is threshold violation event, then instance will be passed as event's parameter #6, and can be accessed as $event->parameters[6]
3. Expression

return (value != null) && (value > 0);

will return 0 (false) or 1 (true) which is probably not what you want.

Script that will return value of FileSystem.Free for current instance or N/A if it cannot be obtained can looks like following:


value = AgentReadParameter($node, "FileSystem.Free(" . $event->parameters[6] . ")");
return (value != null) ? value : "N/A";


Best regards,
Victor
Title: Re: Send different DCI values from the same node (or not?)
Post by: Stardust on February 19, 2016, 07:17:08 PM
Thanks !!  ;D