snmpa_mib_data(3)

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

πŸ’– snmpa_mib_data β€” the vibe guide πŸ’–

okay bestie, welcome to snmpa_mib_data, a page from the snmp manual (Erlang Module Definition, if we're being precise πŸ’…). this one's the behaviour module for the SNMP agent mib-server data module. it's giving "interface contract but make it ✨" and honestly? iconic.


🌸 NAME 🌸

snmpa_mib_data β€” behaviour module for the SNMP agent mib-server data module. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜•: this module defines the behaviour of the SNMP agent mib-server data module. any module that wants to be snmpa_mib_data-compliant has to export these functions, no skips, no excuses, fr fr:

  • new/1
  • close/1
  • sync/1
  • load_mib/4
  • unload_mib/4
  • lookup/2
  • next/3
  • register_subagent/3
  • unregister_subagent/2
  • which_mib/2
  • which_mibs/1
  • whereis_mib/2
  • dump/2
  • info/1
  • backup/2
  • code_change/4

the semantics of them and their exact signatures are explained below πŸ‘‡ bestie read them, i'm not writing them twice.

heads up! the data extracted from the imported (loaded) mibs is stored partly by the mib-server and partly by the symbolic-store server. if you wanna see how that actually plays out, go peek at the default mib-server data module, snmpa_mib_data_tttn. iykyk ✨

πŸŽ€ DATA TYPES πŸŽ€

  • filename() :: file:filename().
  • mib_view() :: [mib_view_elem()].
  • mib_view_elem() :: {SubTree :: snmp:oid(), Mask :: [non_neg_integer()], Inclusion :: mib_view_inclusion()}.
  • mib_view_inclusion() :: 1 | 2.
  • mib_view_mask() :: [non_neg_integer()].

✨ CALLBACKS ✨

πŸ’« backup(State, BackupDir)

do a backup of the mib-server data. self-care for your mibs πŸ’–

note: it's implementation dependent (and also dependent on which mib-storage is used) whether a backup is even possible. no cap.

πŸ’« close(State)

close the mib-storage. bye bestie πŸ‘‹

πŸ’« code_change(Direction, Vsn, Extra, State)

perform a code-change (upgrade or downgrade). glow up or glow down, either way we're doing it 🌈

see gen_server for more info regarding the Vsn and Extra arguments.

πŸ’« dump(State, Destination)

dump the mib-server data to stdio (Destination = io) or the specified file.

πŸ’« info(State)

retrieve misc info for the mib data.

this is a utility function used to inspect, for instance, memory usage, in a simple way. super handy for a lil vibe check 🫢

πŸ’« load_mib(State, FileName, MeOverride, TeOverride)

load the mib specified by the Filename argument into the mib-server. the MeOverride and TeOverride arguments specify how the mib-server shall handle duplicate mib- and trap- entries. let it in, bestie πŸšͺ✨

πŸ’« lookup(State, Oid)

find the mib-entry corresponding to the Oid. if it is a variable, the Oid must be <Oid for var>.0 and if it is a table, Oid must be

(yes, the sentence in the source literally trails off there β€” i'm not gonna invent an ending, that would be lying and lying is NOT the vibe 😭)

πŸ’« new(MibStorage)

create a new mib-server data instance. baby's first mib data 🍼✨

πŸ’« next(State, Oid, MibView)

finds the lexicographically next oid. it's giving "next in line, no cutting" πŸ”₯

πŸ’« register_subagent(State, Oid, Pid)

register the subagent, process, handling part of the mib-tree. welcome to the team 🫢

πŸ’« sync(State)

synchronize (write to disc, if possible) the mib-server data.

this depends on the mib_storage option, and will only have an effect if the mib-storage option has an actual disc component (such as dets, or ets with a file). so like, if there's no disc component, this is just me yelling into the void πŸ’€

πŸ’« unload_mib(State, FileName, MeOverride, TeOverride)

unload the mib specified by the Filename argument from the mib-server. the MeOverride and TeOverride arguments specify how the mib-server shall handle duplicate mib- and trap- entries. eviction notice served πŸ’…

πŸ’« unregister_subagent(State, PidOrOid)

unregister the subagent, handling part of the mib-tree, as specified by the oid() or pid/0 (PidOrOid).

when unregistering the subagent using an oid(), the pid/0 of the process handling the sub-tree is also returned. two birds, one callback 🐦🐦

πŸ’« whereis_mib(State, MibName)

retrieve the mib file for the mib. where is that mib? found her πŸ”πŸ‘‘

πŸ’« which_mib(State, Oid)

retrieve the mib-file to which a given oid() belongs. mystery solved πŸ•΅οΈβ€β™€οΈ

πŸ’« which_mibs(State)

retrieve all loaded mib-files. the whole squad, assembled 🌈


and that's the whole page, bestie, no notes πŸ’– this beauty comes to you from Ericsson AB, shipping as part of snmp 5.20.5, and it's filed under snmpa_mib_data(3) β€” slay, drink water, and go read snmpa_mib_data_tttn next βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from