Discussion:
unsorted-external data access model
(too old to reply)
Mike Smith
2016-01-27 20:19:19 UTC
Permalink
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
Fernández Piñas, David
2016-01-28 10:56:36 UTC
Permalink
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:***@cellwatch.com]
Enviado el: miércoles, 27 de enero de 2016 21:19
Para: net-snmp-***@lists.sourceforge.net
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.
Fernández Piñas, David
2016-01-28 12:44:22 UTC
Permalink
If you already had a code that was working and implementing a MIB, then you don't need to run again mib2c, because mib2c will generate what you already have, from the MIB definition, without the code additions somebody performed to connect the generated code with the data of your application. I don't know what problem your current code has, but you need to fix it and you don't need to run mib2c, because you will not solve the problem by doing this, you won't get anything new if the MIB definition is the same.

-----Mensaje original-----
De: Mike Smith [mailto:***@cellwatch.com]
Enviado el: jueves, 28 de enero de 2016 13:17
Para: Fernández Piñas, David
Asunto: RE: unsorted-external data access model

Thanks for your reply, but I'm afraid I don't understand your suggestion, nor how it relates to my problem: I already have a MIB that at least was previously working; now I'm attempting to develop an agent that links my MIB to the actual data. When running `mib2c` against this MIB, it outputs linking code with descriptions that don't match the actual code it produced. The mismatch confuses me, and I don't understand how I'm meant to employ that specific auto-produced code, i.e., where the entry and exit points reside, so I don't understand how to connect my parts of data-fetching code.

I wonder if there is a break in `mib2c`...

=mike


-----Original Message-----
From: Fernández Piñas, David [mailto:***@indra.es]
Sent: Thursday, January 28, 2016 5:57 AM
To: net-snmp-***@lists.sourceforge.net
Subject: RE: unsorted-external data access model

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:***@cellwatch.com] Enviado el: miércoles, 27 de enero de 2016 21:19
Para: net-snmp-***@lists.sourceforge.net
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
Net-snmp-***@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

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.

Loading...