Overview
model_tool.pl is a command-line tool for developing, testing, and validating NMIS device models. It discovers SNMP capabilities, checks model structure, and validates models against schema definitions.
Location: ~/admin/model_tool.pl
Version: Part of NMIS 9 core
Command-Line Options
Set debugging level:
1: Basic debug info2: Detailed debug with data structures3: Verbose debug with schema details4: Maximum verbosity
Display model errors and warnings.
Path to configuration directory (default: uses NMIS config).
Discovery Operations
Node Discovery
Discover SNMP MIBs supported by a node and identify applicable models.NMIS node name to discover. Node must exist and be active.
Output file for detailed discovery results (TAB-delimited CSV format).
Name for auto-generated model. If specified, creates
Model-<name>.nmis.Regular expression to exclude Common-* models from auto-generated model.
- Connects to node via SNMP
- Tests all known SNMP OIDs from model files
- Identifies supported MIBs and model sections
- Reports which models and sections apply to the device
- Optionally generates a new model file
Model Validation
Check Models
Validate model structure and syntax across all models.Enable model checking mode.
Directory containing models to check:
models or models-default.- Model file syntax and structure
- RRD variable name length (max 19 characters)
- Required sections and properties
- Graph type definitions and files
- SNMP OID validity
- Model schema compliance
- Reference integrity
Schema Operations
Check Schema
Validate models against the schema definition.Enable schema validation. Requires
Model-Schema.nmis file.- Primary:
conf/Model-Schema.nmis - Fallback:
conf-default/Model-Schema.nmis
Generate Schema
Create or update the model schema file based on existing models.Enable schema generation mode. Overwrites existing schema file.
Schema checking is automatically disabled during schema generation.
Advanced Operations
Check All Nodes
Load all active nodes and validate their model assignments.Enable nodes checking mode.
- Verify all nodes can load their assigned models
- Identify model compatibility issues
- Detect missing or invalid model references
Model Structure Validation
RRD Variable Names
RRD (Round Robin Database) variable names must be ≤19 characters due to RRDtool limitations. Valid:Graph Type Validation
Eachgraphtype referenced in a model must have a corresponding Graph-*.nmis file.
Model Section:
Graph-bits.nmisGraph-abits.nmisGraph-maxbits.nmisGraph-util.nmisGraph-autil.nmis
SNMP OID Resolution
OIDs must be resolvable vianmis_mibs.oid file or be numeric.
Valid Formats:
Output Files
Discovery Output File
Generated withfile=<path> during discovery. TAB-delimited CSV format.
Columns:
node: Node namenodeModel: Assigned modelType:systemorsystemHealthFile: Model filenamePath: Model section pathSupported:YESorNOSNMP_Object: MIB object nameSNMP_OID: Numeric OIDOID_Used: OID queriedresult: SNMP response value
Generated Model File
Created whenmodel=<name> is specified during discovery.
Location: <nmis_models>/Model-<name>.nmis
Structure:
Configuration Files
Model Schema
File:conf/Model-Schema.nmis or conf-default/Model-Schema.nmis
Defines valid model structure, keywords, and their relationships.
Structure:
MIB OID Mapping
File:<mib_root>/nmis_mibs.oid
Maps symbolic MIB names to numeric OIDs.
Format:
Common Use Cases
Developing a New Model
Troubleshooting Model Issues
Creating Common Models
Maintaining Model Quality
Error Types
MODEL ERROR
Structural or syntax errors in model files. Examples:SCHEMA ERROR
Schema validation failures. Examples:Exit Codes
- 0: Success
- 1: Error (missing node, invalid arguments)
- -1: Invalid directory
Environment Variables
None required. Uses NMIS configuration.Limitations
- Discovery requires active SNMP connectivity
- Large SNMP tables may timeout (adjust
max_repetitionsin node config) - Schema validation requires up-to-date schema file
- Discovery is limited to ~10,000 MIB tests per run
- RRD variable names limited to 19 characters (RRDtool restriction)
Tips and Best Practices
Model Development
- Always discover before creating: Run discovery to understand device capabilities
- Use common models: Extract shared functionality into Common-* models
- Validate early and often: Check models after each significant change
- Test with real devices: Discovery against actual hardware reveals issues
- Follow naming conventions: Keep RRD variable names short and descriptive
Discovery Optimization
- Start with basic discovery: Use
debug=1initially - Enable detailed output: Use
debug=2to see SNMP responses - Save discovery results: Always use
file=to preserve output - Use common_exclude wisely: Exclude sections you know aren’t needed
Validation Workflow
- Local validation first: Check models locally before deploying
- Schema compliance: Enable schema checking for strict validation
- Test node loading: Use
nodes=trueto verify all nodes load correctly - Review graph types: Ensure all graph files exist
See Also
- nmis-cli - System operations
- node_admin.pl - Node management
- NMIS Model Development Guide
- NMIS SNMP Configuration
- RRDtool Documentation