Model System Overview
NMIS uses device models to define how network equipment is monitored. Models specify:
- SNMP OID mappings - Which OIDs to collect
- Data structures - How to organize collected data
- Collection definitions - What metrics to gather
- Thresholds - Alert conditions
- Display mappings - How data appears in UI
Model Locations
models-default/
Shipped models from Opmantek:
- Pre-built vendor models - Cisco, Juniper, etc.
- Protected from upgrades - Maintained by Opmantek
- Base directory:
/usr/local/nmis9/models-default/
From Config.nmis:38:
'directories' => {
'<nmis_default_models>' => '<nmis_base>/models-default'
}
models-custom/
Customer-specific models:
- Custom device models - Site-specific models
- Model overrides - Customizations of default models
- Preserved during upgrades - User changes maintained
- Base directory:
/usr/local/nmis9/models-custom/
From Config.nmis:40:
'directories' => {
'<nmis_models>' => '<nmis_base>/models-custom'
}
Model Selection
NMIS automatically selects models based on:
- sysObjectID - SNMP system object identifier
- sysDescr - System description string
- Vendor - Device manufacturer
- Model - Specific device model
Model precedence:
- models-custom/ (highest priority)
- models-default/ (fallback)
Model Structure
Models are Perl hash structures:
%hash = (
'systemHealth' => {
'sys' => {
'standard' => {
'snmp' => {
'sysDescr' => {
'oid' => '1.3.6.1.2.1.1.1.0',
'title' => 'Description'
},
'sysUpTime' => {
'oid' => '1.3.6.1.2.1.1.3.0',
'title' => 'Uptime',
'calculate' => 'return func::convUpTime($r);'
}
}
}
}
}
);
Model Components
System Health
Collects device-level metrics:
- CPU utilization
- Memory usage
- Temperature sensors
- Fan status
- Power supplies
Interface Data
Collects interface metrics:
- Traffic counters
- Errors and discards
- Utilization
- Status (up/down)
Model Schema
Model-Schema.nmis defines the valid structure and data types for models.
Schema Keywords
From Model-Schema.nmis:1:
%hash = (
'keywords' => {
'Description' => {
'locations' => [
'interface/nocollect',
'interface/collect',
'storage/nocollect'
],
'types' => ['string'],
'special' => 1
},
'calculate' => {
'types' => ['string'],
'special' => 1
}
}
);
Threshold Definitions
From Model-Schema.nmis:73:
'Critical' => {
'name' => 'Critical',
'parents' => ['threshold'],
'types' => ['integer', 'real'],
'values' => ['95', '3000', '50', '98']
}
Model Policy
Model-Policy.nmis controls which data collection sections are active.
From Model-Policy.nmis:44:
999 => { # Default fallback
systemHealth => {
'cdp' => 'true',
'lldp' => 'true',
'bgpPeer' => 'true',
'ospfNbr' => 'true',
'entityMib' => 'true',
'fanStatus' => 'true',
'tempStatus' => 'true',
'diskIOTable' => 'true'
}
}
Policy Rules
Policies can filter by node attributes:
10 => {
IF => {
'node.name' => ['router1', 'router2'],
'node.location' => '/DataCenter/'
},
systemHealth => {
'bgpPeer' => 'true',
'ospfNbr' => 'true'
}
}
OID Mapping
SNMP OID Definition
'memoryUsed' => {
'oid' => '1.3.6.1.4.1.9.9.48.1.1.1.5',
'sysObjectName' => 'ciscoMemoryPoolUsed',
'title' => 'Memory Used'
}
Indexed OIDs
For table data:
'ifDescr' => {
'oid' => '1.3.6.1.2.1.2.2.1.2',
'title' => 'Interface Description'
}
Data Calculations
Calculate Field
Transform collected data:
'calculate' => '$r / 1000' # Convert to seconds
From Model-Schema.nmis:441:
'sysUpTime' => {
'calculate' => '$r = int($r/100); $r = func::convUpTime($r);'
}
Common Calculations
Temperature conversion:
'calculate' => '${r}/10' # Divide by 10
Percentage calculation:
'calculate' => 'CVAR1=MemoryUsed; CVAR2=MemoryTotal; return ($CVAR1/$CVAR2 * 100);'
IP address format:
'calculate' => '$r =~ s/^0x//; $r = join ".", map { hex } $r =~ /../g;'
Control Filters
Collection Control
From Model-Schema.nmis:881:
'control' => '$sysObjectName =~ /7206|6509/'
Control expressions determine if data is collected:
By device type:
'control' => '$nodeType eq "router"'
By interface speed:
'control' => '$ifSpeed >= 1000000000' # 1Gbps+
By storage type:
'control' => 'CVAR=hrStorageType; $CVAR =~ /Fixed Disk/'
NoCollect Rules
From interface collection:
'nocollect' => {
'Description' => '^#|loopback|NO COLLECT',
'ifOperStatus' => 'down',
'ifType' => 'softwareLoopback'
}
Alerts and Thresholds
From Model-Schema.nmis:1250:
Alert Definition
'alerts' => {
'ciscoMemoryPool' => {
'memoryUtilisation' => {
'element' => 'MemPoolName',
'event' => 'High Memory Utilisation',
'level' => 'Warning',
'test' => '$r > 80',
'value' => 'CVAR1=memUsed;CVAR2=memFree;int($CVAR1 / ($CVAR1 + $CVAR2) * 100)',
'threshold' => {
'Warning' => 80,
'Minor' => 85,
'Major' => 90,
'Critical' => 95,
'Fatal' => 99
}
}
}
}
Threshold Levels
- Normal - 0-69%
- Warning - 70-79%
- Minor - 80-84%
- Major - 85-89%
- Critical - 90-95%
- Fatal - 96-100%
Common Model Types
Interface Model
'interface' => {
'sys' => {
'standard' => {
'indexed' => 'true',
'snmp' => {
'ifIndex' => {
'oid' => '1.3.6.1.2.1.2.2.1.1',
'title' => 'Interface Index'
},
'ifDescr' => {
'oid' => '1.3.6.1.2.1.2.2.1.2',
'title' => 'Interface Name'
},
'ifSpeed' => {
'oid' => '1.3.6.1.2.1.2.2.1.5',
'title' => 'Interface Speed'
}
}
}
},
'rrd' => {
'interface' => {
'snmp' => {
'ifInOctets' => {
'oid' => '1.3.6.1.2.1.2.2.1.10',
'option' => 'counter,0:U'
},
'ifOutOctets' => {
'oid' => '1.3.6.1.2.1.2.2.1.16',
'option' => 'counter,0:U'
}
}
}
}
}
CPU Model
'rrd' => {
'cpu' => {
'snmp' => {
'avgBusy5' => {
'oid' => '1.3.6.1.4.1.9.2.1.58.0',
'option' => 'gauge,0:100'
}
},
'threshold' => 'cpu',
'graphtype' => 'cpu'
}
}
Memory Model
'rrd' => {
'memory' => {
'indexed' => 'true',
'snmp' => {
'memUsed' => {
'oid' => '1.3.6.1.4.1.9.9.48.1.1.1.5',
'option' => 'gauge,0:U'
},
'memFree' => {
'oid' => '1.3.6.1.4.1.9.9.48.1.1.1.6',
'option' => 'gauge,0:U'
}
}
}
}
Creating Custom Models
1. Copy Base Model
cp /usr/local/nmis9/models-default/Model-Generic.nmis \
/usr/local/nmis9/models-custom/Model-CustomDevice.nmis
2. Modify Model
Edit the custom model:
%hash = (
'system' => {
'nodeModel' => 'CustomDevice',
'nodeVendor' => 'CustomVendor',
'sys' => {
'standard' => {
'snmp' => {
'sysObjectID' => {
'replace' => {
'1.3.6.1.4.1.9999' => 'CustomDevice'
}
}
}
}
}
}
);
3. Test Model
/usr/local/nmis9/bin/nmis-cli \
act=update \
node=testdevice \
debug=true
Always test custom models on non-production nodes first. Invalid model syntax can prevent data collection.
Model Inheritance
Common Models
From Model-Schema.nmis:664:
'common-model' => {
'values' => [
'database',
'threshold',
'lldp',
'entityMib',
'interface',
'Cisco-cpu',
'Cisco-memory'
]
}
Models can reference common sections:
'systemHealth' => {
'sys' => {
'entityMib' => {
'common-model' => 'entityMib'
}
}
}
Model Debugging
Enable Model Debug
/usr/local/nmis9/bin/nmis-cli \
act=collect \
node=router1 \
debug=9
View Model Loading
Check which model was selected:
grep 'Loading Model' /usr/local/nmis9/logs/nmis.log
Validate Model Syntax
perl -c /usr/local/nmis9/models-custom/Model-CustomDevice.nmis