Can a script DCI return multiple variables/DCIs?
-
Dear community
I'm looking for a way to create a Dashboard with all BGP sessions that are down from multiple devices. The way I'm doing it is creating independent DCIs under the NetXMS server that return tables and other variables and then include the data in a Dashboard. Is it possible to return multiple variables using the same script? For example, return a table, an integer DCI, a string, etc. The idea would be to use a single script instead of multiple ones.
Probably there is better way to achieve same report
Your input would be appreciate it
Thank you
-
There are multiple ways to achieve that.
If it's ok for you to query data multiple times - just extract common code into a script in the library, then use it in the transformation / wrapper scripts:// Library script "lib1" function collect() { // collect data and return as array of records } // transformation script on the DCI or source script: records = lib1::collect(); return records[0]; // add logic here // for tables: records = lib1::collect(); t = Table(); // or use $1 if it's transformation script t->addColumn("col1"); // required only when creating table from scratch t->addColumn("col2"); for (r : records) { // add logic here row = t->addRow(); t->set(row, 0, r[0]); t->set(row, 1, r[1]); }Another option is to create table DCI, then use this DCI as data source for any other, e.g.:
// GetDCIValue() and GetDCIValueByDescription() might be usefull (see https://www.netxms.org/documentation/nxsl-latest/#_data_collection) t = GetDCIValueByName($node, "My.Table.DCI"); // result will be either String or Table object return t->findRowByInstance("peer1")->get("col1"); // you can use either column names or indexes in get() -
Another option could be to create push DCIs use PushDCIData(). You can e.g. do this from a transormation script of of another DCI.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login