Node Health Report Enhancement: Tag-Based Dataset Handling
Background
Traditionally, when working with node_health_report, dataset names were hardcoded to calculate memory and cpu values. The old opReports implementation failed to account for variations in dataset naming conventions when performing memory calculations. This often resulted in inconsistent or incomplete reporting whenever dataset names varied across nodes.
Tag-Based Dataset Handling
To address these limitations, we have transitioned to a tag-based dataset identification system. With this approach, tags ensure that even when dataset names differ, CPU and memory metrics can still be retrieved consistently and reliably.
Benefits of the Tag-Based Approach
Removes dependency on exact dataset names
Ensures consistency across all nodes regardless of dataset naming conventions
Simplifies maintenance and future enhancements
Step 1: Adding Tags to Datasets in RRD section
To add tags to a node, modify the Model used for polling the OIDs. Tags can be added through the Model configuration. Currently, tag functionality is implemented for CPU and Memory datasets. The tags that have been added to code are cpu-util, mem-free, mem-used, mem-size, swap-free, swap-size, swap-used.
Example: The node Huawei-AR6121 uses the model HuaweiGlobal.
For memory metrics, the two datasets used in calculations are hwMemoryDevFree and hwMemoryDevSize. Therefore, tags must be added in the model where these OIDs are defined.
In these model examples the tags use the key 'tags'.
Memory Tags
'hwMemoryDevSize' => {
'graphtype' => 'mem-huawei',
'indexed' => 'true',
'threshold' => '',
'snmp' => {
'hwMemoryDevSize' => {
'oid' => '1.3.6.1.4.1.2011.6.3.5.1.1.2',
'tags' => ['mem-size']
},
'hwMemoryDevFree' => {
'oid' => '1.3.6.1.4.1.2011.6.3.5.1.1.3',
'tags' => ['mem-free']
},
},
}CPU Tags
'hwCpuDev' => {
'graphtype' => 'cpu-huawei',
'indexed' => 'true',
'threshold' => '',
'snmp' => {
'hwCpuDevDuty' => {
'oid' => '1.3.6.1.4.1.2011.6.3.4.1.2'
},
'hwAvgDuty1min' => {
'oid' => '1.3.6.1.4.1.2011.6.3.4.1.3'
},
'hwAvgDuty5min' => {
'oid' => '1.3.6.1.4.1.2011.6.3.4.1.4',
'tags' => ['cpu-util']
},
},
}Step 2: Apply and Validate Changes
After updating the Model with the new tags, follow these steps:
Restart the NMIS9 daemon.
sudo service nmis9d restart
Delete the model cache file. For example:
Model-HuaweiGlobal.jsonlocated at/usr/local/nmis9/var/nmis_system/model_cache
Run a Node Update operation manually using nmis-cli. Example:
/usr/local/nmis9/bin/nmis-cli act=schedule job.type=update job.node='Huawei-AR6121' job.verbosity=9 job.force=true job.output=/tmp/Huawei-AR6121
Verify tags in the database:
Run the following query in MongoDB to confirm that datasets appear with tags in the inventory collection:
db.getCollection("inventory ").find({
"node_name": "Huawei-AR6121",
"dataset_info.subconcept": "hwMemoryDevSize"
})Example result for memory datasets:
"dataset_info" : [
{
"dataset_tags" : [
{
"name" : "hwMemoryDevFree",
"tags" : ["mem-free"],
"source" : "model"
},
{
"name" : "hwMemoryDevSize",
"tags" : ["mem-size],
"source" : "model"
}
],
"subconcept" : "hwMemoryDevSize",
"datasets" : ["hwMemoryDevFree", "hwMemoryDevSize"]
}
]
db.getCollection("inventory").find({
"node_name" : "Huawei-AR6121",
"dataset_info.subconcept" : "hwCpuDev"
})Example result for CPU datasets:
"dataset_info" : [
{
"dataset_tags" : [
{
"name" : "hwAvgDuty5min",
"tags" : ["cpu-util],
"source" : "model"
}
],
"subconcept" : "hwCpuDev",
"datasets" : ["hwCpuDevDuty", "hwAvgDuty1min", "hwAvgDuty5min"]
}
]Step 3: Run Reports
Once tags have been confirmed in the inventory collection, run the reports via the opReports GUI.