NetXMS Support Forum

English Support => General Support => Topic started by: wuwei on February 24, 2021, 02:58:10 PM

Title: DCI from table element
Post by: wuwei on February 24, 2021, 02:58:10 PM
Hello,
is it possible to create a DCI from a table element?

I would have a DCI that gives me the version of an installed program (from table System.InstalledProducts) so that I will be able to create a symmary table with installed version for all clients.

Thank you.
Title: Re: DCI from table element
Post by: Victor Kirhenshtein on February 24, 2021, 03:23:22 PM
Hi,

you can use script DCI that will read table value either directly from agent or from table DCI and extract version of product of interest. For example, this script accepts package name as argument and return it's version, directly reading table from agent:

packages = $node->readAgentTable("System.InstalledProducts");
if (packages == null)
   return null;
for(p : packages->rows)
{
   name = p->get(0);
   if (name == $ARGS[1])
      return p->get(1);
}
return null;


Best regards,
Victor
Title: Re: DCI from table element
Post by: wuwei on February 25, 2021, 12:35:26 PM
Thank you very much Victor
Title: Re: DCI from table element
Post by: Dawid Kellerman on February 17, 2022, 12:58:53 PM
Hi would some one you be so kind as to show how do I pass the argument to the script
I have it in the scripts but I set the ARG to "ProductVersionWantName" since I dont know or could not find how to pass the argument when setting the DCI
Regards Dawid
Title: Re: DCI from table element
Post by: Filipp Sudanov on February 17, 2022, 06:16:30 PM
If you are using Script DCI to call the script, script parameters can be given in brackets after script name in parameter field.
Title: Re: DCI from table element
Post by: Dawid Kellerman on February 18, 2022, 09:05:48 AM
Thank you Filipp
I went though all of the brackets yes I was lazy.. {}[]()

Passing arguments to scripts.

(http://screenshot%20from%202022-02-18%2008-59-15.png)

Picture being a thousand words
Title: Re: DCI from table element
Post by: jdowney on February 18, 2022, 12:19:22 PM
Thanks for this have used this for our own netxms.