Snmp.Agent (elixir_snmp v0.1.0) View Source

Use this module to generate an Agent module you can insert in your supervision tree.

DSL

See Snmp.Agent.DSL.

Configuration

When using this module, you need to provide :otp_app option. Agent environment will be get with: Application.get_env(<otp_app>, <agent_module>).

  • versions (optional, default: [:v3]): a list of versions to enable for this agent amongst :v1, v2 and v3.
  • transports (optional, default: ["127.0.0.1", "::1"]): a list of possible transports definitions. See Snmp.Transport.agent_transport/0.
  • security: defines a list of users. See Snmp.Mib.UserBasedSm.user/0 for format.

Example

  defmodule Agent do
    use Snmp.Agent, otp_app: :my_app

    # Mandatory MIBs
    mib MyApp.Mib.Standard
    mib MyApp.Mib.Framework

    # Application MIBs
    mib MyMib

    # VACM model
    view :public do
      include [1, 3, 6, 1, 2, 1]
    end

    view :private do
      include [1, 3, 6]
    end

    access :public,
      versions: [:v1, :v2c, :usm],
      level: :noAuthNoPriv,
      read_view: :public

    access :secure,
      versions: [:usm],
      level: :authPriv,
      read_view: :private,
      write_view: :private,
      notify_view: :private
  end

Link to this section Summary

Functions

Generates an SNMP agent module

Returns a specification to start this module under a supervisor.

Resolve OID into dot separated names

Starts SNMP agent

Returns MIB tree as stream

Link to this section Types

Specs

handler() :: module()

Link to this section Functions

Link to this macro

__using__(args)

View Source (macro)

Generates an SNMP agent module

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

oid_to_dot(:snmp.oid()) :: String.t()

Resolve OID into dot separated names

Specs

start_link(handler()) :: GenServer.on_start()

Starts SNMP agent

Specs

stream(:snmp.oid()) :: Enum.t()

Returns MIB tree as stream