#mib #tool #snmp

snmptools

SNMP common tools

14 releases

0.1.3 Dec 29, 2024
0.1.2 Dec 28, 2024
0.0.11 Jul 10, 2023
0.0.10 Jun 2, 2022

#910 in Network programming

Download history 1/week @ 2025-01-14 21/week @ 2025-02-04 39/week @ 2025-02-18 24/week @ 2025-02-25 7/week @ 2025-03-04 9/week @ 2025-03-11 5/week @ 2025-03-18 18/week @ 2025-03-25 75/week @ 2025-04-01 34/week @ 2025-04-08 34/week @ 2025-04-15 55/week @ 2025-04-22 30/week @ 2025-04-29

173 downloads per month
Used in snmp2

Apache-2.0

11KB
227 lines

snmptools

Unsafe Rust functions, based directly on net-snmp library for those, which are not Rust-native yet.

Methods:

  • Converts SNMP OIDs to MIB names and vice-versa

Required crate features:

  • static (default) - compiles the binary with libnetsnmp.so dep or compile static lib inside (a bit faster)

  • dynamic - loads libnetsnmp.so dynamically (more cross-platform)

Example

Prepare the system

apt-get install libsnmp-dev snmp-mibs-downloader
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);

Dependencies

~1.7–7MB
~52K SLoC