Using script for title and group in Performance view

Started by gkaudewitz, August 12, 2026, 12:26:01 PM

Previous topic - Next topic

gkaudewitz

Configuring an Instance-DCI there is the possibility to configure the display the values of the discoverd DCIs within Performance-tab.
Is there a possibility to configure the values in two or more groups depending on a script that fills the values for title and group?
I tried something like in attached file, but it did not work.

Best regards

Alex Kirhenshtein

Hi,

No - Title and Group do not take scripts. Neither field goes through a macro engine on the server: the whole Performance View block is stored with the DCI as-is, and the client substitutes a small fixed set of placeholders when it draws the tab. That is the entire mechanism, so there is nothing to hook a script into.

Two separate things are off in the screenshot. %[...] is a real macro syntax, but it belongs to the text expansion used for event and alarm messages, notification text and object tools - and there the form is %[scriptName], without the script: prefix. The script: prefix belongs to %{script:name}, which is a template macro for DCI name, description and instance fields, expanded when the DCI is created from a template - once per node, not per discovered instance. You combined the two, and neither engine is applied to Performance View fields.

What the fields do accept, substituted by the client at render time:

  • Title - {instance}, {instance-name}, {node-name}
  • Group - {instance}, {instance-name} (no {node-name} here)
  • Name in legend - {instance}, {instance-name}, {node-name}

Leave Title or Name in legend empty and the DCI description is used instead. Charts are grouped by the substituted Group value, so instances that produce identical text land on one graph.

For splitting instances into two or more groups there are two ways.

Simplest approach is one master DCI per group: copy the instance discovery DCI, give each copy a fixed Group name, and let each instance filter script accept only the instances belonging to that group. The group stays static text and the script only decides membership, so each group can also have its own title, colors and time range.

If you want to keep a single master DCI and let the script decide, use the instance display name as the carrier - the filter script sets it, and Group reads it back:

if ($1 ilike "*volt*")
   return [true, $1, "Voltage"];
return [true, $1, "Current"];

Second element of the array is the instance value ({instance}), third is the instance display name ({instance-name}). Set both Group and Title to {instance-name} and Name in legend to {instance} - instances the script labelled "Voltage" end up on one graph titled Voltage, "Current" on another.

Two caveats: {instance-name} then carries the group label everywhere it is shown, Last Values and DCI descriptions included, so use {instance} where you need the instance itself; and group matching is exact, case included.

Filling these fields from a script is not possible today, and the macros that do work are not in the documentation - the Performance view section only mentions grouping by identical Group text. I raised https://github.com/netxms/netxms-doc/issues/69 to get them written down. If script-driven titles are important for your setup, say so and I will open a feature request for it.