| Crates.io | snmptools |
| lib.rs | snmptools |
| version | 0.2.0 |
| created_at | 2022-06-02 03:16:36.47476+00 |
| updated_at | 2025-11-19 13:34:32.716747+00 |
| description | SNMP common tools |
| homepage | |
| repository | https://github.com/alttch/snmptools |
| max_upload_size | |
| id | 598629 |
| size | 28,768 |
Unsafe Rust functions, based directly on net-snmp library for those, which are not Rust-native yet.
Methods:
Required crate features:
static (default) - compiles the binary with libnetsnmp.so dep or compile static lib inside (a bit faster)
dynamic - loads libnetsnmp.so or libnetsnmp.dylib dynamically (more cross-platform, not support windows system)
Prepare the system
# Linux
apt-get install libsnmp-dev snmp-mibs-downloader
# MacOS
brew install net-snmp
use snmptools::{Oid};
snmptools::init(&snmptools::Config::new().mibs(&["./ibmConvergedPowerSystems.mib"])).unwrap();
let snmp_oid = Oid::from(&[1, 3, 6, 1, 4, 1, 2, 6, 201, 3]).unwrap();
let name = snmptools::get_name(&snmp_oid).unwrap();
assert_eq!(name, "IBM-CPS-MIB::cpsSystemSendTrap");
let snmp_oid2 = snmptools::get_oid(&name).unwrap();
assert_eq!(snmp_oid, snmp_oid2);