Mike,
I don't know what kind of MIB are you trying to develop. It would be nice if
you could post it. I had a similar problem and I decided to implement a so
called command line MIB like this:
+--CommandLineMib(5)
+--CommandLineModule(1)
| +--CommandLineGroup(1)
|
+-- -RW- String CommandLine(2)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- EnumVal CommandProgress(3)
| Values: ok(1), error(2), pending(3)
+-- -R-- String CommandResult(4)
Textual Convention: DisplayString
Size: 0..255
With mib2c I generated the corresponding .c and .h files, then I added extra
code to do a system(CommandLine) when doing an snmpset to CommandLine and to
get the command result in CommandResult. I compiled it as an standalone
subagent application with net-snmp-config --compile-subagent spdCommandLineMib
spdCommandLineMib.c
When I execute the obtained standalone subagent (./CommandLine), it registers
with the master SNMP agent and then I can do things like this:
$ snmpset -v 2c -c private localhost CommandLine.0 = "pwd"
COMMAND-LINE-MIB::CommandLine.0 = STRING: pwd
$ snmpget -v 2c -c public localhost CommandResult.0
COMMAND-LINE-MIB::CommandResult.0 = STRING: /
References I followed and read (in order of access):
http://www.net-snmp.org/docs/readmefiles.html
http://www.net-snmp.org/wiki/index.php/Tutorials
http://www.net-snmp.org/wiki/index.php/FAQ:Coding_01
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent
http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mib_module/
http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/example-demon.c
HTH,
David
De: Mike Smith [mailto:[email protected]]
Enviado el: miércoles, 27 de enero de 2016 21:19
Para: [email protected]
Asunto: unsorted-external data access model
I'm a complete novice to SNMP, and have had to assume responsibility on a
development abandoned by a former associate. I want to develop a subagent to
handle data requests, and my data is accessible from another
process/application that communicates via a private messaging API. Thus, I
believe the "unsorted-external" model is a best-fit. However, I'm very
confused by the data flow required. Using the mib2c generator, I got a couple
of ReadMe text files describing parts of the process, but now I'm more confused
than ever!
The ReadMe describing the generated code refers several times to
"<...>_loop_init_context()" function, but no such function exists anywhere else
except in a comment within <...>_data_access.c. Is this a function I'm meant
to create? If so, why isn't there at least a place-holder indicating where it
should be or when to call it?
=mike smith
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
contiene información de carácter confidencial exclusivamente dirigida a su
destinatario o destinatarios. Si no es vd. el destinatario indicado, queda
notificado que la lectura, utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente. En el caso de haber
recibido este correo electrónico por error, se ruega notificar inmediatamente
esta circunstancia mediante reenvío a la dirección electrónica del remitente.
Evite imprimir este mensaje si no es estrictamente necesario.
This email and any file attached to it (when applicable) contain(s)
confidential information that is exclusively addressed to its recipient(s). If
you are not the indicated recipient, you are informed that reading, using,
disseminating and/or copying it without authorisation is forbidden in
accordance with the legislation in effect. If you have received this email by
mistake, please immediately notify the sender of the situation by resending it
to their email address.
Avoid printing this message if it is not absolutely necessary.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users