All Projects → jonnystorm → snmp-elixir

jonnystorm / snmp-elixir

Licence: MPL-2.0 license
An SNMP client library for Elixir

Programming Languages

elixir
2628 projects
shell
77523 projects

Projects that are alternatives of or similar to snmp-elixir

Snmpcollector
A full featured Generic SNMP data collector with Web Administration Interface for InfluxDB
Stars: ✭ 216 (+700%)
Mutual labels:  snmp
Sharpsnmplib
Sharp SNMP Library- Open Source SNMP for .NET and Mono
Stars: ✭ 247 (+814.81%)
Mutual labels:  snmp
virgin-media-hub3
Python API and command line interface to the Virgin Media Hub 3 broadband router
Stars: ✭ 63 (+133.33%)
Mutual labels:  snmp
Onesixtyone
Fast SNMP Scanner
Stars: ✭ 218 (+707.41%)
Mutual labels:  snmp
Fusioninventory For Glpi
FusionInventory plugin for GLPI
Stars: ✭ 241 (+792.59%)
Mutual labels:  snmp
snmpman
Easy massive SNMP-agent simulation with the use of simple YAML files
Stars: ✭ 28 (+3.7%)
Mutual labels:  snmp
Laitos
Top geek's chindogu - personal assistant over satellite/telephone/SMS/chatbot, plus web infrastructure servers (web & mail, ad-free DNS, web proxy, SNMP, etc)
Stars: ✭ 191 (+607.41%)
Mutual labels:  snmp
GPONMonitor
GPON Monitoring tool for Dasan Networks GPON OLTs
Stars: ✭ 26 (-3.7%)
Mutual labels:  snmp
Snmpsim
SNMP Simulator
Stars: ✭ 242 (+796.3%)
Mutual labels:  snmp
aiosnmp
aiosnmp is an asynchronous SNMP client and trap server for use with asyncio.
Stars: ✭ 36 (+33.33%)
Mutual labels:  snmp
Keepalived
Keepalived
Stars: ✭ 2,877 (+10555.56%)
Mutual labels:  snmp
Collectd
The system statistics collection daemon. Please send Pull Requests here!
Stars: ✭ 2,700 (+9900%)
Mutual labels:  snmp
proxmox toolbox
A toolbox to get the firsts configurations of Proxmox VE / BS done in no time
Stars: ✭ 158 (+485.19%)
Mutual labels:  snmp
Mylg
Network Diagnostic Tool
Stars: ✭ 2,538 (+9300%)
Mutual labels:  snmp
Mikrotik-Router-Monitoring-System
SNMP based Router Monitoring System for Mikrotik Routers
Stars: ✭ 29 (+7.41%)
Mutual labels:  snmp
Librenms
Community-based GPL-licensed network monitoring system
Stars: ✭ 2,567 (+9407.41%)
Mutual labels:  snmp
ansible-snmp-exporter
Provision SNMP metrics exporter for prometheus monitoring
Stars: ✭ 18 (-33.33%)
Mutual labels:  snmp
snmp notifier
A webhook to relay Prometheus alerts as SNMP traps, because sometimes, you have to deal with legacy
Stars: ✭ 33 (+22.22%)
Mutual labels:  snmp
fapro
Fake Protocol Server
Stars: ✭ 1,338 (+4855.56%)
Mutual labels:  snmp
Synology-NAS-monitoring
influxDB, Grafana, snmp and telegraf
Stars: ✭ 140 (+418.52%)
Mutual labels:  snmp

snmp-elixir

Build Status

An SNMP client library for Elixir.

This is my effort to replace the terrible but useful net-snmp-elixir with a facile Elixir wrapper for OTP's harrowing SNMP API.

Many thanks to Dave Martin for his post, without which I may never have bothered returning to this problem.

Usage in CLI

iex> SNMP.start
iex>
iex> v2_cred =
...>   SNMP.credential(
...>     %{version: :v2, community: "public"}
...>   )
%SNMP.CommunityCredential{
  community: 'public',
  sec_model: :v2c,
  version: :v2
}
iex>
iex> {:ok, base_oid} =
...>   SNMP.resolve_object_name_to_oid(:sysName)
{:ok, [1, 3, 6, 1, 2, 1, 1, 5]}
iex>
iex> %{uri: URI.parse("snmp://an-snmp-host.local"),
...>   credential: v2_cred,
...>   varbinds: [%{oid: base_oid ++ [0]}],
...> } |> SNMP.request
{ :ok,
  [ %{oid: [1, 3, 6, 1, 2, 1, 1, 5, 0],
      type: :"OCTET STRING",
      value: "an-snmp-host"
    }
  ]
}
iex>
iex> v3_cred =
...>   SNMP.credential(
...>     %{version: :v3,
...>       sec_name: "user",
...>       auth: :sha,
...>       auth_pass: "authpass",
...>       priv: :aes,
...>       priv_pass: "privpass",
...>     }
...>  )
%SNMP.USMCredential{
  auth: :sha,
  auth_pass: 'authpass',
  priv: :aes,
  priv_pass: 'privpass',
  sec_level: :authPriv,
  sec_model: :usm,
  sec_name: 'nms',
  version: :v3
}
iex> %{uri: URI.parse("snmp://an-snmp-host.local"),
...>   credential: v3_cred,
...>   varbinds: [%{oid: "ipAddrTable"}],
...> } |> SNMP.walk
...> |> Enum.take(1)
[ %{oid: [1, 3, 6, 1, 2, 1, 4, 20, 1, 1, 192, 0, 2, 1],
    type: :IpAddress,
    value: [192, 0, 2, 1],
  }
]

Installation

Add :snmp_ex to mix.exs:

defp deps do
  [ { :snmp_ex, "~> 0.4.0" } ]
end

Any of the following defaults may be overridden in your config.exs.

config :snmp_ex,
  timeout: 5000,
  max_repetitions: 10,
  engine_discovery_timeout: 1000,
  mib_cache:      "priv/snmp/mibs",
  snmp_conf_dir:  "priv/snmp/conf",
  snmpm_conf_dir: "priv/snmp",
  snmpc_verbosity: "silence",
  mib_sources: ["/usr/share/snmp/mibs"]

snmpc_verbosity can be set to different values, see the erlang docs on which values you can use.

Finally, ensure the :snmp OTP application is available in your development environment. Some Linux distributions, such as CentOS, provide separate packages for individual OTP services and tools. Check for erlang-snmp if this is a concern. As for production, the release process will ensure :snmp is automatically included in the resulting tarball.

Why another wrapper?

net-snmp-elixir was my experimental hack to get something that worked. I didn't expect it to become one of the top Google results for "elixir snmp" but it is, which scares me. Elixir may be the best language for network interaction in existence, but we still need worthy SNMP support.

Contributing

This project will accept (merge/rebase/squash) all contributions. Contributions that break the build will be reverted.

For details, please see Why Optimistic Merging Works Better.

TODO

  • SNMPv3 USM (AES support requires OTP >=23; see corresponding pull request for details.)
  • USM engine discovery
  • SNMP tables
  • MIB name resolution
  • Basic SNMP operations (GET, GET-NEXT, WALK, SET)
  • Bulk SNMP operations
  • Process management (supervision, :snmpm agents)
  • Make it decent
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].