snmp_community_mib(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

✨ NAME ✨

okay so bestie, this is the manual page for snmp_community_mib(3) β€” an Erlang module definition, and the module itself is snmp_community_mib, aka Instrumentation Functions for SNMP-COMMUNITY-MIB. yes that is a mouthful, no we are not scared of it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the module snmp_community_mib is the one that implements the instrumentation functions for the SNMP-COMMUNITY-MIB, plus the functions you need for configuring the database. multitasking icon, honestly πŸ‘‘

and the configuration files it reads? those are described in the SNMP User's Manual. iykyk, go read that one too 🫢


πŸ’– DATA TYPES πŸ’–

  • context_name() :: snmp_framework_mib:admin_string(). β€” a human readable string. it's giving SnmpAdminString ✨
  • index() :: snmp_framework_mib:admin_string(). β€” SnmpAdminString (SIZE(1..32)). yes the size matters, keep it in range bestie πŸ“
  • name() :: string(). β€” OCTET STRING (SIZE(1..64)). again: sizes are real, respect them πŸ™ˆ
  • security_name() :: snmp_framework_mib:admin_string(). β€” SnmpAdminString 🌸
  • transport_tag() :: snmp_target_mib:tag_value(). β€” SnmpTagValue πŸŽ€

πŸ‘‘ FUNCTIONS πŸ‘‘

🌟 add_community

add_community(Idx, CommName, SecName, EngineId, CtxName,
                    TransportTag) ->
                       {ok, Key} | {error, Reason}
                       when
                           Idx :: index(),
                           CommName :: name(),
                           SecName :: security_name(),
                           EngineId :: snmp_framework_mib:engine_id(),
                           CtxName :: context_name(),
                           TransportTag :: transport_tag(),
                           Key :: term(),
                           Reason :: term().

adds a community to the agent config β€” literally equivalent to one single line in the community.conf file. one line!! so efficient 🌈

and okay listen, the EngineId argument? with it, you can override the configured engine-id (that's the one from SNMP-FRAMEWORK-MIB). yes, override. no cap πŸ”₯


🌟 configure

configure(ConfDir) -> snmp:void() when ConfDir :: string().

this function gets called from the supervisor at system start-up. the supervisor said "you're up" and this function said "bet" πŸ’…

here's the tea: it 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 ✨

also, all snmp counters are set to zero. fresh start energy, we love that for them 🧚

if an error is found in the configuration file, it gets reported using the function config_err/2 of the error, report module β€” and then the function itself fails with reason configuration_error 😭 so like, it's not silently ghosting you, it's yelling, respectfully.

ConfDir is a string that points to the directory where the configuration files are found πŸ“

and the configuration file it reads is: community.conf πŸ‘ˆ that's the one, don't forget it


🌟 delete_community

delete_community(Key) -> ok | {error, Reason}
                         when Key :: term(), Reason :: term().

deletes a community from the agent config. that's it. bye bestie πŸ‘‹πŸ’€


🌟 reconfigure

reconfigure(ConfDir) -> snmp:void() when ConfDir :: string().

the sequel to configure, and it goes harder. it inserts all data in the configuration files into the database and destroys all old data, including the rows with StorageType nonVolatile. not just volatile this time β€” everything. periodt πŸ’…

so the rows created from the configuration file will have StorageType nonVolatile.

and like, the consequence of that? thus β€” yes i said thus β€” the data in the SNMP-COMMUNITY-MIB, after this function has been called, is from the configuration files. full reset to factory vibes, main character energy πŸ‘‘

all snmp counters are set to zero again too. clean slate 🌸

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 reason configuration_error 😭 same drama, same reason.

ConfDir is a string which points to the directory where the configuration files are found πŸ“

and the configuration file read is: community.conf πŸŽ€


okay tiny reminder bestie: configure only clears the volatile rows, but reconfigure clears nonVolatile rows too. that's the whole difference. don't mix them up, i'm begging πŸ™ˆ

that's the whole page!! every flag, every type, every signature, every file, all accounted for, we ate and left no crumbs πŸ“

Ericsson AB made this one, and it's shipping with snmp 5.20.5 β€” this was snmp_community_mib(3), mwah, love u, bye πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from