tsmi compile / trishul-smi compiletsmi compile [OPTIONS] MIB [MIB ...]
Compile one or more MIBs and all their transitive dependencies.
Arguments
| Argument | Description |
|---|---|
MIB ... |
One or more MIB names (e.g. IF-MIB IP-MIB). Omit to auto-discover every MIB file found in --mib-dir directories. |
Options
| Option | Default | Description |
|---|---|---|
-o / --output-dir |
./mibs-output |
Directory to write output files |
-f / --format |
json |
Output format: json or pysnmp. Repeat for multiple. |
-d / --mib-dir |
— | Local MIB directory. Repeat for multiple. Searched before HTTP. |
--online |
off | Fetch missing MIBs from HTTP sources (pysnmp.com + mibbrowser.online). Off by default. |
-s / --source |
— | Custom HTTP URL template (@mib@ replaced with MIB name). Implies --online. Repeat for multiple. |
--cache-dir |
~/.cache/trishul-smi |
Compiled-module cache directory. Pass "" to disable. |
--cache-ttl-days |
7 |
Cache TTL in days. 0 = never expire. |
--max-mib-size |
10485760 |
Maximum MIB source size in bytes. |
--timeout |
30.0 |
HTTP timeout in seconds. |
--retries |
3 |
HTTP retry count on transient failure. |
--no-texts |
off | Omit description, organization, and contact text from output for leaner files. Structural metadata (OIDs, dates, types) is always preserved. |
-v / --verbose |
— | Show output file paths per module. |
--help |
— | Show help and exit. |
Exit codes: 0 all compiled — 1 any failure — 2 bad option or no source configured.
Examples
# Compile from a local directory (no HTTP)
tsmi compile IF-MIB -d /usr/share/snmp/mibs
# Fetch from the internet
tsmi compile IF-MIB --online
# Both formats, custom output directory
tsmi compile IF-MIB IP-MIB -f json -f pysnmp --online -o ./out
# Local directory first, fall back to HTTP
tsmi compile IF-MIB -d /usr/share/snmp/mibs --online
# Compile every MIB found in a directory (no explicit names)
tsmi compile -d /usr/share/snmp/mibs -f json -f pysnmp
# Disable the disk cache
tsmi compile IF-MIB --online --cache-dir ""
# Show per-module output paths
tsmi compile IF-MIB --online --verbose
# Lean output without description text (works for both json and pysnmp)
tsmi compile IF-MIB --online --no-texts
Sample output
Compiling IF-MIB → ./mibs-output (json)
Status Module
✅ IANAifType-MIB
✅ IF-MIB
2 compiled
tsmi convert / trishul-smi converttsmi convert FILE.py [OPTIONS]
Reverse-convert a compiled PySNMP .py MIB module back to JSON using Python’s ast module — no SMI grammar required.
Arguments
| Argument | Description |
|---|---|
FILE.py |
Path to a compiled PySNMP .py MIB file |
Options
| Option | Default | Description |
|---|---|---|
-o / --output-dir |
./mibs-output |
Directory to write the JSON output file |
--help |
— | Show help and exit. |
Examples
# Convert a compiled IF-MIB.py back to JSON
tsmi convert IF-MIB.py
# Write to a custom directory
tsmi convert IF-MIB.py -o ./converted
What is extracted: OID paths, object types, syntax (resolving _Name_Type wrappers to their base class), max_access, status, and description text. Imports and TEXTUAL-CONVENTION class bodies are not reconstructed.
tsmi version / trishul-smi versiontsmi version
Print the installed version and exit.
-f json)One .json file per MIB module:
{
"module": "IF-MIB",
"language": "SMIv2",
"generated_by": "trishul-smi",
"generated_at": "2026-05-06T12:00:00Z",
"imports": {
"SNMPv2-SMI": ["MODULE-IDENTITY", "OBJECT-TYPE"]
},
"objects": {
"ifIndex": {
"oid": "1.3.6.1.2.1.2.2.1.1",
"oid_path": [1, 3, 6, 1, 2, 1, 2, 2, 1, 1],
"object_type": "OBJECT-TYPE",
"class": "objecttype",
"nodetype": "column",
"syntax": "InterfaceIndex",
"max_access": "read-only",
"status": "current",
"description": "A unique value ..."
}
},
"types": {
"InterfaceIndex": {
"class": "textualconvention",
"base_type": "Integer32",
"display_hint": "d",
"status": "current",
"description": "..."
}
},
"notifications": {},
"module_metadata": {
"lastupdated": "2000-06-14",
"revisions": [{"date": "2000-06-14", "description": "..."}],
"organization": "IETF Interfaces MIB Working Group",
"contactinfo": "...",
"description": "..."
}
}
-f pysnmp)One .py file per MIB module, loadable by pysnmp’s MibBuilder:
# IF-MIB MIB module
# Generated by trishul-smi
mibBuilder = MibBuilder()
(ModuleIdentity, ObjectType,) = mibBuilder.importSymbols('SNMPv2-SMI', ...)
ifMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 31,))
mibBuilder.exportSymbols('IF-MIB', **{'ifMIB': ifMIB})