snmp_target_mib(3)
π snmp_target_mib β Erlang Module Definition π
okay bestie, welcome to the SNMP-TARGET-MIB era, this page is literally the whole module definition for snmp_target_mib in Erlang and you're gonna eat it up β¨
π NAME π
snmp_target_mib β Instrumentation Functions for SNMP-TARGET-MIB π
π¦ DESCRIPTION π¦
The module snmp_target_mib implements the instrumentation functions for the SNMP-TARGET-MIB, plus the functions for configuring the database. two jobs, one icon π
The configuration files are described in the SNMP User's Manual. go read it iykyk π
Legacy API functions add_addr/10 that does not specify transport domain, and add_addr/11 that has got separate IpAddr and PortNumber arguments still work as before for backwards compatibility reasons. yes queen, the old stuff still runs, we don't abandon our elders π«Ά
π§ DATA TYPES (the tiny teaser one) π§
See the data types in snmpa_conf. that's it, that's the whole section, go look π
πΈ DATA TYPES πΈ
π mms() :: 484..65535.
NOTE: "The maximum message size value associated with an entry in the snmpTargetAddrTable."
Integer32 (484..65535) β so yes, there's a floor, it does not go lower than 484, periodt π₯
π name() :: snmp_framework_mib:admin_string().
NOTE: "The locally arbitrary, but unique identifier associated with this snmpTargetAddrEntry."
SnmpAdminString (SIZE(1..32)) β arbitrary but unique, main character energy, no duplicates allowed in this group chat π
π params() :: snmp_framework_mib:admin_string().
NOTE: "The value of this object identifies an entry in the snmpTargetParamsTable."
SnmpAdminString (SIZE(1..32)) β it's giving "point me at a params entry" πΈ
π retry_count() :: 0..255.
NOTE: "This object specifies a default number of retries to be attempted when a response is not received for a generated message."
Integer32 (0..255) β when nobody answers, how many times do you text again π
π tag_list() :: string().
NOTE: "An octet string containing a list of tag values. Tag values are preferably in human-readable form." "To facilitate internationalization, this information is represented using the ISO/IEC IS 10646-1 character set, encoded as an octet string using the UTF-8 character encoding scheme described in RFC 2279."
OCTET STRING (SIZE (0..255)) β yes bestie, internationalization matters, RFC 2279 said so β¨
π tag_value() :: string().
NOTE: "An octet string containing a tag value. Tag values are preferably in human-readable form."
OCTET STRING (SIZE (0..255)) β one single tag value, cute and small π
π tmask() :: snmpa_conf:transportAddressMask().
NOTE: "The mask value associated with an entry in thesnmpTargetAddrTable. The value of this object must have the same length as the corresponding instance ofsnmpTargetAddrTAddress, or must have length 0."
OCTET STRING (SIZE (0..255)) β same length, or zero, there is no third option and the spec is not taking questions π
π₯ FUNCTIONS π₯
π add_addr/10 and add_addr/11
add_addr(Name, TDomain, TAddr, Timeout, Retry, TagList, Params,
EngineId, TMask, MMS) ->
{ok, Key} | {error, Reason}
when
Name :: name(),
TDomain :: snmpa_conf:transportDomain(),
TAddr :: snmpa_conf:transportAddress(),
Timeout :: snmp:time_interval(),
Retry :: integer(),
TagList :: tag_list(),
Params :: params(),
EngineId :: snmp_framework_mib:engine_id(),
TMask :: tmask(),
MMS :: snmp_framework_mib:max_message_size(),
Key :: term(),
Reason :: term();
(Name, Ip, Port, Timeout, Retry, TagList, Params,
EngineId, TMask, MMS) ->
{ok, Key} | {error, Reason}
when
Name :: name(),
Ip :: snmpa_conf:transportAddressWithoutPort(),
Port :: inet:port_number(),
Timeout :: snmp:time_interval(),
Retry :: integer(),
TagList :: tag_list(),
Params :: params(),
EngineId :: snmp_framework_mib:engine_id(),
TMask :: tmask(),
MMS :: snmp_framework_mib:max_message_size(),
Key :: term(),
Reason :: term().
Adds a target address definition to the agent config. Equivalent to one line in the target_addr.conf file. one function call = one config line, slay π«Ά
π add_params/5
add_params(Name, MPModel, SecModel, SecName, SecLevel) ->
{ok, Key} | {error, Reason}
when
Name :: name(),
MPModel ::
snmp_framework_mib:message_processing_model(),
SecModel :: snmp_framework_mib:security_model(),
SecName :: snmp_framework_mib:admin_string(),
SecLevel :: snmp_framework_mib:security_level(),
Key :: term(),
Reason :: term().
Adds a target parameter definition to the agent config. Equivalent to one line in the target_params.conf file. matching energy, iconic β¨
π configure/1
configure(ConfDir) -> snmp:void() when ConfDir :: string().
This function is called from the supervisor at system start-up. like, it just shows up when the system boots, no invitation needed πΈ
Inserts all data in the configuration files into the database and destroys all old rows with StorageType volatile. The rows created from the configuration file will have StorageType nonVolatile. so: read the files, nuke the volatile stuff, everything fresh is nonVolatile π
All snmp counters are set to zero. reset, clean slate, new era π₯
If an error is found in the configuration file, it is reported using the function config_err/2 of the error report module, and the function fails with the reason configuration_error. so yeah, errors get reported, not silently swallowed, and then boom, configuration_error π
ConfDir is a string which points to the directory where the configuration files are found. yes it's a plain string, yes it's a path, don't overthink it π
The configuration files read are: target_addr.conf and target_params.conf. those two, nobody else invited π¦
π delete_addr/1
delete_addr(Key) -> ok | {error, Reason}
when Key :: term(), Reason :: term().
Delete a target address definition from the agent config. bye bestie π
π delete_params/1
delete_params(Key) -> ok | {error, Reason}
when Key :: term(), Reason :: term().
Delete a target parameter definition from the agent config. also bye π
π reconfigure/1
reconfigure(ConfDir) -> snmp:void() when ConfDir :: string().
Inserts all data in the configuration files into the database and destroys all old data, including the rows with StorageType nonVolatile. no cap, it takes out the nonVolatile rows too β this one does not play π
Thus, the data in the SNMP-TARGET-MIB, after this function has been called, is the data from the configuration files. what you see is what the files say, that's the whole vibe check β
All snmp counters are set to zero. zeroed out again, always π§
If an error is found in the configuration file, it is reported using the function config_err/2 of the , and the function fails with the reason configuration_error. (yes, the page really ends that sentence like that, i'm just delivering the message fr fr π) still: it fails with configuration_error.
ConfDir is a string which points to the directory where the configuration files are found. same deal, a string path π
The configuration files read are: target_addr.conf and target_params.conf. same two files as configure/1, consistency is key π
π set_target_engine_id/2
set_target_engine_id(TargetAddrName, EngineId) -> boolean()
when
TargetAddrName :: name(),
EngineId ::
snmp_framework_mib:engine_id().
Changes the engine id for a target in the snmpTargetAddrTable. If notifications are sent as Inform requests to a target, its engine id must be set. like, mandatory mandatory, not optional, this is the requirement π―
okay and that's the whole page, you understood it, i'm so proud of you π
little sign-off moment: this whole thing comes from Ericsson AB, it's snmp 5.20.5, and it's the manual page for snmp_target_mib(3). read it, love it, go configure something iconic β¨π
π¦
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms