Skip to content

Instantly share code, notes, and snippets.

@jonnystorm
Created March 24, 2017 20:24
Show Gist options
  • Save jonnystorm/aa39a241a375975ce78b2a390fdf991f to your computer and use it in GitHub Desktop.
Save jonnystorm/aa39a241a375975ce78b2a390fdf991f to your computer and use it in GitHub Desktop.
USM engineId discovery - false starts
iex> SNMP.start
{:ok, #PID<0.175.0>}
iex> cred = SNMP.credential [:v3, :no_auth_no_priv, "admin"]
[version: :v3, sec_model: :usm, sec_level: :noAuthNoPriv, sec_name: 'admin']
iex> SNMP.get([1,3,6,1,2,1,1,5,0], URI.parse("snmp://192.0.2.3"), cred)
14:30:12.544 [debug] Will register agent snmp://192.0.2.3 with target [130, 219, 114, 183, 132, 30, 20, 148, 117, 155, 154, 175, 231, 194, 102, 115, 99, 57, 90, 71] and config [engine_id: [128, 0, 0, 0, 6], address: [192, 0, 2, 3], port: 161, tdomain: :transportDomainUdpIpv4, version: :v3, sec_model: :usm, sec_level: :noAuthNoPriv, sec_name: 'admin'].
14:30:12.549 [info] SNMPM default user callback received handle_error:
ReqId: -1
Reason: {:failed_processing_message, {:securityError, :usmStatsUnknownEngineIDs}}
UserData: :undefined
14:30:17.547 [error] Timeout!
{:error, :etimedout}
iex> :snmpa_supervisor.start_sub_sup [db_dir: '/home/jstorm']
{:ok, #PID<0.192.0>})
iex> :ets.info :snmp_agent_table
[read_concurrency: false, write_concurrency: false, compressed: false,
memory: 483, owner: #PID<0.192.0>, heir: :none, name: :snmp_agent_table,
size: 14, node: :nonode@nohost, named_table: true, type: :set, keypos: 1,
protection: :public]
iex> :snmpm.which_agents
[[130, 219, 114, 183, 132, 30, 20, 148, 117, 155, 154, 175, 231, 194, 102, 115,
99, 57, 90, 71]]
iex> :snmpa.discovery [130, 219, 114, 183, 132, 30, 20, 148, 117, 155, 154, 175, 231, 194, 102, 115,
...> 99, 57, 90, 71], :test
** (exit) exited in: :gen_server.call(:snmp_master_agent, {:discovery, [130, 219, 114, 183, 132, 30, 20, 148, 117, 155, 154, 175, 231, 194, 102, 115, 99, 57, 90, 71], :test, [], [], :snmpa_discovery_handler_default, :undefined}, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(stdlib) gen_server.erl:212: :gen_server.call/3
iex> :snmpa_supervisor.start_master_sup [db_dir: '/home/jstorm', dir: '/home/jstorm']
** (EXIT from #PID<0.185.0>) shutdown: failed to start child: :config
** (EXIT) {:not_found, :dir}
iex> :snmp_misc.get_option :dir, []
** (throw) {:error, {:not_found, :dir}}
(snmp) snmp_misc.erl:209: :snmp_misc.get_option/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment