How to use one agent mib-2 system values in another agent trap ?

Frank Fock Frank.Fock____t-online.de
Thu Apr 26 00:12:27 CEST 2001


Hi Eitan,

I would prefer approach (A) too.

Regards,
Frank

Eitan Pilipski wrote:

> Hi,
>
> I want to send Trap with mib-2 system objects (for example sysName) from my
> private agent.
> My agent is running on Solaris machine with another native Solaris agent
> that already implements mib-2, so I want to "use" the Solaris agent sysName
> value in my agent Trap.
>
> I created the following Trap object in my ASN:
>
> adsTestRequestOnAlarmEvent NOTIFICATION-TYPE
> OBJECTS { sysName }
> STATUS current
> DESCRIPTION " "
> ::= { adsTestRequestAlarm 1 }
>
> ( I'm importing from SNMPv2-MIB)
>
> The code generated by agentgen is:
>
> void adsTestRequestOnAlarmEvent::generate(Vbx* vbs, int sz, const OctetStr&
> context)
> {
>          //--AgentGen BEGIN=adsTestRequestOnAlarmEvent::generate
>          //--AgentGen END
>          if (sz < 1) {
>                  LOG_BEGIN(ERROR_LOG | 1);
>                  LOG("adsTestRequestOnAlarmEvent: too few var binds (given)
> (expected)");
>                  LOG(sz);
>                  LOG(1);
>                  LOG_END;
>                  return;
>          }
>          if (!(vbs[0].get_oid().in_subtree_of("1.3.6.1.2.1.1.5.0"))) {
>                  LOG_BEGIN(ERROR_LOG | 1);
>                  LOG("adsTestRequestOnAlarmEvent: wrong var bind (no.)
> (given) (expected)");
>                  LOG(1l);
>                  LOG(vbs[0].get_printable_oid());
>                  LOG("1.3.6.1.2.1.1.5.0");
>                  LOG_END;
>                  return;
>          }
>          NotificationOriginator::generate(vbs, sz,
> oidAdsTestRequestOnAlarmEvent, "", context);
> }
>
> Obviously, the method is checking for the OID, but since it's not
> implemented in my agent the bind will fail.
>
> My question is what is the right approach to solve this issue:
> A. to override adsTestRequestOnAlarmEvent::generate and to open a request
> to Solaris agent (running on port 161)
> B. to implement mib-2 in my agent
> C. ?
>
> I'm in favor of option 1, but I was wondering if there is a better way ?
> Thanks
>
> Eitan P.
> Ext. 57327




More information about the AGENTPP mailing list