An open API service indexing awesome lists of open source software.

https://github.com/kassane/snmp.d

net-snmp bindings for D
https://github.com/kassane/snmp.d

bindings d dlang net-snmp snmp snmp-client

Last synced: 19 days ago
JSON representation

net-snmp bindings for D

Awesome Lists containing this project

README

          

# snmp.d

[![CI](https://github.com/kassane/snmp.d/actions/workflows/ci.yml/badge.svg)](https://github.com/kassane/snmp.d/actions/workflows/ci.yml)

D bindings for [net-snmp](http://www.net-snmp.org/). Supports SNMPv1/v2c/v3, MIB loading, and subagents.

## Requirements

- **net-snmp** ≥ 5.9 — `sudo apt install libsnmp-dev` / `brew install net-snmp`
- **D frontend** ≥ 2.111 (LDC or DMD)

> **macOS:** net-snmp is keg-only. Add to your environment:
> ```sh
> export LDFLAGS="-L$(brew --prefix net-snmp)/lib"
> export CPPFLAGS="-I$(brew --prefix net-snmp)/include"
> ```

## Usage

Add in your `dub.json`|`dub.sdl`:
```sh
dub add snmp-d
```

## Modules

| Module | Provides |
|--------|----------|
| `snmp.session` | `SNMPSession` — `get`, `getNext`, `getBulk` |
| `snmp.pdu` | `SNMPResponse` — `foreach`, `length` |
| `snmp.varbind` | `VarBind` — cursor over response variables, value extractors |
| `snmp.oid` | `OID` — parse, compare, format, prefix checks |
| `snmp.v3` | `SNMPV3Session` — SNMPv3 USM auth/priv |
| `snmp.mib` | `MIB` — load MIB files, resolve named OIDs |
| `snmp.agent` | `SNMPAgent` — embedded agent / AgentX subagent |
| `snmp.types` | Enums: `SNMPVersion`, `PDUType`, `SNMPError`, `ASNType` |
| `c.net_snmp` | Raw ImportC declarations |

## Examples

```sh
cd examples
dub build :snmp_get # ./build/examples_snmp_get [host] [community]
dub build :snmp_walk # ./build/examples_snmp_walk [host] [community]
```

## License

[BSL-1.0](LICENSE)