Last active
May 23, 2017 09:44
-
-
Save alexnavis/4bd8a5e3b6c924f72ad51036f5e990ac to your computer and use it in GitHub Desktop.
SNMP Elixir / Erlang v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:snmpm.start() | |
:snmpm.register_user('v3_default_user', :snmpm_user_default, nil, []) | |
# Public SNMP simulator - http://snmpsim.sourceforge.net/public-snmp-simulator.html | |
engine_id = "80004fb805636c6f75644dab22cc" |> Base.decode16!(case: :mixed) |> :binary.bin_to_list | |
user_name = 'usr-md5-none' | |
password = 'authkey1' | |
auth_key = :snmp.passwd2localized_key(:md5, password, engine_id) | |
ip_address = {104,236,166,95} | |
:snmpm.verbosity(:all, :trace) | |
:snmpm.register_usm_user(engine_id, user_name, [auth: :usmHMACMD5AuthProtocol, auth_key: auth_key, priv: :usmNoPrivProtocol, priv_key: []]) | |
:snmpm.register_agent('v3_default_user', 'v3_agent', [engine_id: engine_id, address: ip_address, version: :v3, sec_model: :usm, sec_name: user_name, sec_level: :authNoPriv ]) | |
# warm - up to sync engineBoot and engineTime for the first to cache the value in SNMPM ets tables | |
:snmpm.sync_get('v3_default_user', 'v3_agent', [], 2000) | |
:snmpm.sync_get('v3_default_user', 'v3_agent', [[1,3,6,1,2,1,1,1,0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment