Guess the answer depends on if you want to create a DCI (as you mentioned a transform script) that collects these top 5/top 10 at regular intervals or if you just want a script/tool you can execute at any given time to provide you with the data.
Not sure about the prior, but for the latter you have a couple of options.
It won't exactly be a top 5, as it will list all systems that match, but you can simply sort the result and look at the top 5 rows. That's the easy solution. Doesn't work for your "between 9pm and 11pm" though.
The more complex solution would be to write a script that goes through all relevant nodes and queries the DCI values (possibly by going via template, as per your previous post https://www.netxms.org/forum/general-support/adding-together-oids-from-many-different-nodes-within-a-tempate/). The per-system results (and system names) are placed in an array (would be easier if you could have arrays with strings as keys, but I believe it's only non-negative integers). You can sort the array as you add items or fill the array first followed by you implementing your favourite sorting algorithm (there may be a built-in way to sort an array, but I couldn't see one on https://wiki.netxms.org/wiki/NXSL_Function_Reference). Finally you only return the top 5 results.
Why go through that hassle when you can use a Summary Table? Because a small adjustment will allow you to get your 9pm-11pm solution, which I assume means "average value between any given time". You'd have to adjust the script to use the GetAvgDCIValue function instead of GetDCIValue and pass it the start and end time in UNIX Epoch format. If you call this script via an Object tool, you could have the Console pop up with window to ask you for the start/end time instead of you having to modify the script each time.
Sorry, no actual script from me for that one...
Not sure about the prior, but for the latter you have a couple of options.
- Summary Table
- Scripts
It won't exactly be a top 5, as it will list all systems that match, but you can simply sort the result and look at the top 5 rows. That's the easy solution. Doesn't work for your "between 9pm and 11pm" though.
The more complex solution would be to write a script that goes through all relevant nodes and queries the DCI values (possibly by going via template, as per your previous post https://www.netxms.org/forum/general-support/adding-together-oids-from-many-different-nodes-within-a-tempate/). The per-system results (and system names) are placed in an array (would be easier if you could have arrays with strings as keys, but I believe it's only non-negative integers). You can sort the array as you add items or fill the array first followed by you implementing your favourite sorting algorithm (there may be a built-in way to sort an array, but I couldn't see one on https://wiki.netxms.org/wiki/NXSL_Function_Reference). Finally you only return the top 5 results.
Why go through that hassle when you can use a Summary Table? Because a small adjustment will allow you to get your 9pm-11pm solution, which I assume means "average value between any given time". You'd have to adjust the script to use the GetAvgDCIValue function instead of GetDCIValue and pass it the start and end time in UNIX Epoch format. If you call this script via an Object tool, you could have the Console pop up with window to ask you for the start/end time instead of you having to modify the script each time.
Sorry, no actual script from me for that one...
