Permalink
Browse files

added snmp_ext

  • Loading branch information...
mbj
mbj committed Feb 21, 2005
1 parent 9376230 commit dc57a1eb44673dde5fd3f82d4eb365ae2c3c21cf
View
@@ -0,0 +1,3 @@
+include ../../support/subdir.mk
+
+
@@ -0,0 +1,20 @@
+General
+-------
+ Acts as a subagent towards the snmp master agent, and as a SNMP
+ v1/v2c manager towards the real SNMP agent. This setup is useful
+ when you want to have a master-subagent relation, but the agent
+ doesn't support SMUX or AgentX. The foreign SNMP agent must be
+ configured to send traps to this process. There is one process per
+ agent connection.
+
+ NOTE: Two-phase SET cannot be implemented! This means that in the
+ worst case, we'll have to send a undoFailed. In the normal case,
+ where the subagent implements a whole MIB tree, each SET request to
+ the master agent will contain either no or all varbinds to this
+ subagent.
+
+
+TODO
+----
+ o handle timeouts (and retransmits ?)
+ o test!
View
@@ -0,0 +1,24 @@
+This is an implementation of AgentX (RFC2741) for the OTP snmp agent.
+
+Configuration
+-------------
+Add to snmp_ext.conf
+
+ %% To start as a master
+ {agentx, master}. %% behave as an AgentX master
+ {agentxListenIp, {A,B,C,D}}. %% default is {127,0,0,1}
+ {agentxListenPort, int()}. %% default is 705
+ {agentxTimeout, int()}. %% default is 15000 (ms)
+
+ %% To start as a agent
+ {agentx, agent}. %% behave as an AgentX agent
+ {agentxMasterIp, {A,B,C,D}}. %% default is {127,0,0,1}
+ {agentxMasterPort, int()}. %% default is 705
+ {agentxTimeout, int()}. %% default is 15000 (ms)
+
+
+TODO
+----
+An agent could be implemented as a specific snmp_net_if process, I
+think. The MPD and VAC would be dummies. This should be easy.
+Registration and index allocation etc should be done a function calls.
View
@@ -0,0 +1,40 @@
+This is an implementation of SMUX (RFC1227) for the OTP snmp agent.
+
+Configuration - not yet used
+-------------
+Add to snmp_ext.conf
+
+ {smux, true}. %% turn on SMUX; behave as a SMUX master
+ {smuxListenIp, {A,B,C,D}}. %% default is {127,0,0,1}
+ {smuxListenPort, int()}. %% default is 199
+ {smuxTimeout, int()}. %% default is 15000 (ms)
+ {smuxSecret, string()}. %% default is no checking
+
+Start
+-----
+1. start snmp master agent
+2. snmp_smux_admin:start_link({127,0,0,1}, 1999, snmp_master_agent,
+ 15000, undefined).
+ this will start the SMUX master process and register it with the erlang
+ snmp_master_agent. it will listen for SMUX requests on 127.0.0.1:1999
+
+
+Limitations
+-----------
+The agent does not handle the priority field. When a register request
+is received, the subtree is registered, and priority 0 is returned.
+
+Registration deletions are not handled. All registrations are removed
+when the SMUX connection is closed though.
+
+read-only and read-write registrations are handled in the same way.
+
+The SMUX MIB is not implemented.
+
+
+FIXME
+-----
+ - snmp_mib must handle EXIT from subagent, call
+ snmp_mib_data:unregister_subagent on exit
+ o make simple-minded option to SMUX, which makes one vb packets
+ to each subagent
View
No changes.
View
@@ -0,0 +1,44 @@
+MODULES = \
+ snmp_agent_adapter \
+ snmp_agentx \
+ snmp_smux \
+ snmp_smux_admin \
+ snmp_smux_server \
+ SMUX \
+ RFC1155-SMI
+
+ERL_FILES = $(MODULES:%=%.erl)
+
+HRLS = SMUX.hrl
+
+HRL_FILES = $(HRLS:%=%.hrl)
+
+TARGET_FILES = $(MODULES:%=../ebin/%.beam)
+
+all: $(TARGET_FILES)
+
+SMUX.erl: SMUX.asn RFC1155-SMI.asn1db
+ erlc -bber_bin +optimize $<
+
+SMUX.hrl: SMUX.asn RFC1155-SMI.asn1db
+ erlc -bber_bin +optimize $<
+
+RFC1155-SMI.asn1db: RFC1155-SMI.asn
+ erlc -bber_bin +optimize $<
+
+RFC1155-SMI.erl: RFC1155-SMI.asn
+ erlc -bber_bin +optimize $<
+
+../ebin/%.beam: %.erl $(HRLS)
+ erlc $(ERLC_FLAGS) -o ../ebin $<
+
+clean:
+ rm -f $(TARGET_FILES)
+ rm -f SMUX.hrl
+ rm -f SMUX.erl
+ rm -f SMUX.asn1db
+ rm -f SMUX.beam
+ rm -f RFC1155-SMI.asn1db
+ rm -f RFC1155-SMI.erl
+ rm -f RFC1155-SMI.hrl
+ rm -f RFC1155-SMI.beam
@@ -0,0 +1,118 @@
+ RFC1155-SMI DEFINITIONS ::= BEGIN
+
+ EXPORTS -- EVERYTHING
+-- internet, directory, mgmt,
+-- experimental, private, enterprises,
+ ObjectName, ObjectSyntax, SimpleSyntax,
+ ApplicationSyntax, NetworkAddress, IpAddress,
+ Counter, Gauge, TimeTicks, Opaque, DisplayString;
+
+ -- the path to the root
+
+-- internet OBJECT IDENTIFIER ::= { iso org(3) dod(6) 1 }
+
+-- directory OBJECT IDENTIFIER ::= { internet 1 }
+
+-- mgmt OBJECT IDENTIFIER ::= { internet 2 }
+
+-- experimental OBJECT IDENTIFIER ::= { internet 3 }
+
+-- private OBJECT IDENTIFIER ::= { internet 4 }
+-- enterprises OBJECT IDENTIFIER ::= { private 1 }
+
+
+ -- definition of object types
+
+ -- names of objects in the MIB
+
+ ObjectName ::=
+ OBJECT IDENTIFIER
+
+ -- syntax of objects in the MIB
+
+ ObjectSyntax ::=
+ CHOICE {
+ simple
+ SimpleSyntax,
+
+ -- note that simple SEQUENCEs are not directly
+ -- mentioned here to keep things simple (i.e.,
+ -- prevent mis-use). However, application-wide
+ -- types which are IMPLICITly encoded simple
+ -- SEQUENCEs may appear in the following CHOICE
+
+ application-wide
+ ApplicationSyntax
+ }
+
+ SimpleSyntax ::=
+ CHOICE {
+ number
+ INTEGER,
+
+ string
+ OCTET STRING,
+
+ object
+ OBJECT IDENTIFIER,
+
+ empty
+ NULL
+ }
+
+ ApplicationSyntax ::=
+ CHOICE {
+ address
+ NetworkAddress,
+
+ counter
+ Counter,
+
+ gauge
+ Gauge,
+
+ ticks
+ TimeTicks,
+
+ arbitrary
+ Opaque
+
+ -- other application-wide types, as they are
+ -- defined, will be added here
+ }
+
+
+ -- application-wide types
+
+ NetworkAddress ::=
+ CHOICE {
+ internet
+ IpAddress
+ }
+
+ IpAddress ::=
+ [APPLICATION 0] -- in network-byte order
+ IMPLICIT OCTET STRING (SIZE (4))
+
+ Counter ::=
+ [APPLICATION 1]
+ IMPLICIT INTEGER (0..4294967295)
+
+ Gauge ::=
+ [APPLICATION 2]
+ IMPLICIT INTEGER (0..4294967295)
+
+ TimeTicks ::=
+ [APPLICATION 3]
+ IMPLICIT INTEGER (0..4294967295)
+
+ Opaque ::=
+ [APPLICATION 4] -- arbitrary ASN.1 value,
+ IMPLICIT OCTET STRING -- "double-wrapped"
+
+
+ DisplayString ::= OCTET STRING (SIZE (0..255))
+
+
+
+ END
Oops, something went wrong.

0 comments on commit dc57a1e

Please sign in to comment.