Hi,
First, here is a description of my problem:
The following MIB will be used in my description:
[...]
+-- egisavia (.1.3.6.1.4.1.4512)
'-+-- project1 (.1.3.6.1.4.1.4512.1)
|-+-- module1 (.1.3.6.1.4.1.4512.1.1)
| |-- info11 (.1.3.6.1.4.1.4512.1.1.1)
| '-- info12 (.1.3.6.1.4.1.4512.1.1.2)
'-+-- module2 (.1.3.6.1.4.1.4512.1.2)
|-- info21 (.1.3.6.1.4.1.4512.1.2.1)
|-- info22 (.1.3.6.1.4.1.4512.1.2.2)
'-- info23 (.1.3.6.1.4.1.4512.1.2.3)
Consider that project1 is composed of two Managed Resources (module1 and
module2) and a SNMP subagent communicating with these modules through sockets.
For each of those MR, two or three MO attributes are defined to report modules'
activity (each of those are scalars and read-only).
Also consider that module1 can be enabled or disabled and module2 is always
running.
My need is the following:
1) Build a SNMP subagent using Net-SNMP, where module2 infos (when registered
to Master Agent) *shall* always be available. If not, my SNMP subagent shall
return an error, so far, I managed to do so.
2) The next requirement is that when module1 is enabled (running) "module1",
"info11" and "info12" (previously registered to Master Agent) *shall* be
visible/available to NMS. If module1 is disabled, "module1", "info11" and
"info12" *shall* be hidden/available to NMS.
At the moment, I'm successful in registering all my MO attributes, returning
errors in case the subagent is unable to contact module2.
But I'm unsuccessful in unregister/"hide" "module1" MO attributes when it is
disabled.
To do so (unregister/"hide" MOs), I tried several things:
a) The simplest was to return any "SNMP_ERR_*" when I wanted to inform the NMS
that the requested node was not available. Of course and unfortunately snmpwalk
on ".1.3.6.1.4.1.4512.1" stop listing the MIB at the first error and does not
display any information. This is certainly not what I want. In this particular
case, I want snmpwalk to display "info21", "info22" and "info23".
b) I also tried returning values such as "SNMP_NOSUCHOBJECT" which does not
seemed to be an error value but leads to same result.
c) I tried to find information on the web to unregister MO attributes when
"module1" was disabled. I didn't find much information, only two or three tips.
But at the moment, deregistration ended in SIGSEV when I try to re-register my
"module1" MOs after 1 register and 1 deregister. Not very interesting :o\
Here is the code use for Registration, first:
<code>
print_debug(stderr, "+++ REGISTERING rootFilesysStatus.");
/* Create an handler registration structure */
reginfo =
netsnmp_create_handler_registration(p_scalar->name,
p_scalar->handle,
p_scalar->objectId,
p_scalar->objectIdLen,
p_scalar->mode);
/* Store additional infos to the handler registration structure */
reginfo->my_reg_void = p_data;
/* Register an instance helper handler */
netsnmp_register_scalar(reginfo);
</code>
And for Deregistration:
<code>
if (reginfo != NULL)
{
print_debug(stderr, "--- DEREGISTERING rootFilesysStatus.");
registered = 0;
netsnmp_handler_registration_free(reginfo);
}
else
{
print_debug(stderr, "!!! rootFilesysStatus == null.");
}
</code>
Here is the story. Can anyone, please, help me on this ?
Thanks a lot for any help.
Regards,
--
Alexandre BEAUGY
EUROGICIEL Ingenierie Company
Real-time/UNIX Software Engineer
________________________________________
EGISAVIA Toulouse
4 bis, rue Paul Mesplé - BP 20603
31106 TOULOUSE CEDEX 1
Tel: +33.5.62.24.56.01 - Fax: +33.5.62.24.49.64
[EMAIL PROTECTED]
http://www.sofreavia.fr/
Before printing this email, assess if it is really needed.
Ce message et toutes les pièces jointes (ci-après le « message ») sont
confidentiels et établis à lintention exclusive
de ses destinataires. Toute utilisation de ce message non conforme à sa
destination, toute diffusion ou toute publication,
totale ou partielle, est interdite, sauf autorisation expresse. Si vous recevez
ce message par erreur, merci de le
détruire sans en conserver de copie et den avertir immédiatement lexpéditeur.
Internet ne permettant pas de garantir
lintégrité de ce message, EGIS SA et ses filiales déclinent toute
responsabilité au titre de ce message sil a été
modifié, altéré, déformé ou falsifié. Par ailleurs et malgré toutes les
précautions prises pour éviter la présence de virus
dans nos envois, nous vous recommandons de prendre, de votre côté, les mesures
permettant d'assurer la non-introduction
de virus dans votre système informatique.
This email message and any attachments (the email) are confidential and
intended only for the recipient(s) indicated.
If you are not an intented recipient, please be advised that any use,
dissemination, forwarding or copying of this email
whatsoever is prohibited without EGIS SA and its subsidiaries's prior written
consent. If you have received this email
in error, please delete it without saving a copy and notify the sender
immediately. Internet emails are not necessarily
secured, and declines responsibility for any changes that may have been made
to this email after it was sent.While we
take all reasonable precautions to ensure that viruses are not transmitted via
emails, we recommend that you take your
own measures to prevent viruses from entering your computer system.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders