The TopN exporter loads data in one of two ways, each entry in opcharts_topn_properties tells it which to use.
- From NMIS threshold data
- From opCharts Resource models
After the data is loaded the script put's it into an ordered array, then takes the TopN nodes for this "resource" and loads the last 1h of data for each of these using NMISx / opCharts Resource model which is used to display sparklines in the TopN table in opCharts.
In this step, the exporter goes through each node, for each node, if it is active, checks each of the entries in opcharts_topn_properties.
From NMIS threshold data
The loop looks up the value in the -node file "status" section, if the property and method of the entry match one of the current opcharts_topn_properties entry, the value is grabbed and considered for TopN.
Example opcharts_topn_properties for threshold data:
From opCharts Resource Models
When the method is listed as "resource", the script looks for the specified resource for each node, if it is found each index is iterated through and the current value is grabbed and considered for TopN.
Example opcharts_ton_properties entry for resource data:
This attribute can have three possible values, these mostly control the links created for each row in the TopN table.
If the value is index_id, then the value in the "index" attribute of the "status" section will be used to look-up NMISx resource sparkline data, otherwise the first resource will be used (so basically it's not indexed)/
- resource_id - the link will go to the resource, eg "cpu", so all graphs in that resource will be shown by opCharts. This does not map into the resource model, eg, for a CiscoRouter it links to nodes/asgard/resources/nodehealth as that is where the CPU data is stored. This is figured out by using the 'type' attribute in the "status" section.
- index_id - the link will go to the resource index, all graphs for that resource/index shown (eg asgard/resources/interface/indicies/10 )
- dataset_id - the link will go to the resource/dataset, so graphs for that specific dataset will be shown ( eg asgard/resources/nodehealth/datasets/MemoryUsedIO), I can't find anything actually using this setting at the moment.
Load last 1h of data
After the values are loaded and TopN list is figured out "addSummaryData" is called which loops through the TopN lists, using NMISx it loads the resource and requests the last 1h of data and adds these values as an array into the data atttribute of the output data. The suffix for the attribute is also looked up and added to the output data.
The topn data is then saved to <omk_topn>, one file per opcharts_topn_properties entry.