How to establish information exchange and subroutine execution between a Network Management System and a process, throught a SNMP Agent?

StackOverflow https://stackoverflow.com/questions/23659257

  •  22-07-2023
  •  | 
  •  

Question

The big Picture:

The goal is to make (C++) subroutines, provided by processes, executable by a SNMP NMS (Network Management System), through a SNMP Agent on the one hand.

On the other hand Processes needs the ability to tell their State (e.g. initializing, active, stopped) and log messages to a SNMP NMS, through a SNMP Agent.

The most promising approach i found is to implement a C++ Net-SNMP Subagent, whitch provide a small API.

e.g.

  • setCallback(Callback c)
  • logMsg(String s)
  • setState(State st)

The relevant Processes could implement these API and pass callback objects, set the actual state and log messages.

The point is that the subroutines, provided by the callback objects, need to be described in the MIB (Management Information Base) to make them accessible by the NMS. Since the concrete subroutines are not known at compile time i´m looking for a way to translate the signature of the subroutine into a SMIv2 (ASN.1) description to extend the MIB at runtime.

Do you know a framework, tool or approach which meets the requirements or a technique to make subroutines "available" in a SNMP Agent MIB ?

Is it even possible to extend the Agent MIB at runtime ?

Was it helpful?

Solution

Extending a MIB at runtime would defeat the purpose of having a MIB. The MIB is supposed to tell the manager what variables are available, and if the variable set changes dynamically, the MIB does not provide this information to the manager.

I'm sure it could be solved somehow, if the manager could regularly fetch the MIB file by FTP when needed, and was able to dynamically adapt to the MIB contents, but I've not seen an NMS capable of that. Even it is possible, I'd strongly advise against such a breach of convention. There are RFCs about how to make changes to a MIB module, and you'd be violating them for sure.

I think the best you could do is have the list of subroutines in a Table (which the Agent is allowed to dynamically change during runtime). Then, make a scalar read/write variable "runSubroutine" where the Manager could set the index value of the subroutine it wants to run. Put arguments and return values in other variables. The Manager would do an SNMP walk of the subroutines table, find the index of the one it wants to run, and then send an SNMP set command with the arguments and subroutine index.

In the end, that might work, but please for the love of Knuth, consider using a real RPC protocol instead of trying to squeeze such capabilities into SNMP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top