snmp_target_mib(3erl)

πŸ“¦
version 25.3.2.8 Β· 4 versions
, in ubuntu noble

πŸ’… snmp_target_mib β€” the Erlang module definition, bestie edition

okay so this is snmp_target_mib(3erl), and before you ask β€” yes, it's an Erlang module definition page, and yes, it's lowkey iconic. It lives in the snmp manual (version 5.13.5, courtesy of Ericsson AB), and we're gonna walk through it together like we're studying for the same quiz. grab a lil snack πŸ“


✨ NAME ✨

snmp_target_mib β€” literally the instrumentation functions for SNMP-TARGET-MIB. that's the whole name. short, sweet, slays. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so the module snmp_target_mib implements the instrumentation functions for the SNMP-TARGET-MIB, plus functions for configuring the database. two jobs, both handled, main character energy fr fr.

the configuration files are described in the SNMP User's Manual β€” go read that if you want the deets, i'm not gonna make stuff up.

now, the legacy API tea β˜•: there's add_addr/10 which does not specify a transport domain, and add_addr/11 which has got separate IpAddr and PortNumber arguments. both of these still work as before, for backwards compatibility reasons. so if you see them in the wild, don't panic β€” they're vintage, not broken. πŸ™ˆ


πŸŽ€ DATA TYPES πŸŽ€

see the data types in snmpa_conf. that's it, that's the section. go look, i'll wait. πŸ’–


🌈 EXPORTS 🌈

⭐ configure(ConfDir) -> void()

Types:

ConfDir = string()

this function is called from the supervisor at system start-up. very "hello i'm awake now" of it.

what it does: 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 volatile ones get yeeted, the fresh config rows are keepers. ✨

all snmp counters are set to zero. zeroed. reset. fresh start. 🫢

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, it doesn't just quietly suffer β€” it tells on itself.

ConfDir is a string which points to the directory where the configuration files are found.

the configuration files read are: target_addr.conf and target_params.conf. those two. no others. πŸ’…


⭐ reconfigure(ConfDir) -> void()

Types:

ConfDir = string()

okay so this is configure's bolder sister. inserts all data in the configuration files into the database and destroys all old data β€” including the rows with StorageType nonVolatile. no survivors. 😭 the rows created from the configuration file will have StorageType nonVolatile.

so like, the data in the SNMP-TARGET-MIB after this function has been called is the data from the configuration files. periodt. that's the whole vibe.

all snmp counters are set to zero. again. zero. πŸŒ€

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.

ConfDir is a string which points to the directory where the configuration files are found.

the configuration files read are: target_addr.conf and target_params.conf. same duo as before. πŸŽ€


⭐ set_target_engine_id(TargetAddrName, EngineId) -> boolean()

Types:

TargetAddrName = string()
EngineId = string()

changes the engine id for a target in the snmpTargetAddrTable.

heads up bestie: if notifications are sent as Inform requests to a target, its engine id must be set. not optional. not a suggestion. set it. πŸ”₯

⭐ add_addr(Name, Domain, Addr, Timeout, Retry, TagList, Params, EngineId, TMask, MMS) -> Ret

Types:

Name = string()
Domain = transportDomain()
Addr = transportAddress()          % Default port is 162
Timeout = integer()
Retry = integer()
TagList = string()
ParamsName = string()
EngineId = string()
TMask = transportAddressMask()     % Depends on Domain
MMS = integer()
Ret = {ok, Key} | {error, Reason}
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 line, same energy. πŸ¦‹


⭐ delete_addr(Key) -> Ret

Types:

Key = term()
Ret = ok | {error, Reason}
Reason = term()

delete a target address definition from the agent config. bye bestie πŸ‘‹


⭐ add_params(Name, MPModel, SecModel, SecName, SecLevel) -> Ret

Types:

Name = string()
MPModel = v1 | v2c | v3
SecModel = v1 | v2c | usm
SecName = string()
SecLevel = noAuthNoPriv | authNoPriv | authPriv
Ret = {ok, Key} | {error, Reason}
Key = term()
Reason = term()

adds a target parameter definition to the agent config. equivalent to one line in the target_params.conf file. matching set, we love a coordinated moment. πŸŽ€βœ¨


⭐ delete_params(Key) -> Ret

Types:

Key = term()
Ret = ok | {error, Reason}
Reason = term()

delete a target parameter definition from the agent config. gone, archived, not coming back. πŸ’€


and that's the whole page, no notes. this lil masterpiece is brought to you by Ericsson AB, from snmp 5.13.5, dated back in the day, and it's snmp_target_mib(3erl) all the way down. mwah πŸ’‹ go configure something cute. πŸ§šπŸ’œ

πŸ“¦ where this page comes from