Re: timeticks in second and send a easy trap

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 18/12/2007, Tako Chang <[email protected]> wrote:
> > So this MIB is written in SMIv1?
> > That's pretty much obsolete by now.  You should really be looking at
> > writing MIBs in SMIv2 (i.e. NOTIFICATION-TYPE definitions)
>
> Sorry, I will amend it!

If you are going to switch to SMIv2, then make sure you change
the *whole* MIB - not just the TRAP->NOTIFICATION definition.

The content is broadly similar, but the detailed syntax is slightly
different.  If you've got a house style, then it's probably more
important to stick with that.   But if you are defining policy for
your organisation, then you should definitely use SMIv2 rather
than SMIv1 unless you have explicit reasons to choose otherwise.

> But if i use NOTIFICATION-TYPE, can I send message as a SNMPv1 trap?

Yes.

> I don't realize the relationship between SMIv2 and SNMPv2

Essentially none.
SMIv1 and SMIv2 are two (subtly) different ways of defining management
information.   The information that is defined is effectively the same - it's
just a slightly different way of writing it.

You can send/query SMIv1-defined information using SNMPv2 (or SNMPv3).
You can send/query SMIv2-defined information using SNMPv1



> > "send_easy_trap" isn't really sufficient for your requirements here.
> > You should probably look at using 'send_enterprise_trap_vars()'
> > in order to specify your Enterprise OID value.
> >
> > Dave
> >
>
> [MIB]
> myMibTrap ::= { enterprise 920 }
>
> demoTrap       NOTIFICATION-TYPE
> STATUS         current
> DESCRIPTION     "Send a message to the manager when the DHCP setting is
>                              chaged"
> ::= { myMibTrap 1 }
> [/MIB]

One suggestion - I'd insert an extra definition between myMibTrap and demoTrap:

> myMibTrap  ::= { enterprise 920 }
> myMibTrap0 ::= { myMibTrap 0 }
> demoTrap       NOTIFICATION-TYPE  ...
> ::= { myMibTrap0 1 }

That will keep the SNMPv1<->SNMPv2 translations consistent.



> int specific = 1;
> oid  trapOid = { SNMP_OID_ENTERPRISES, 920 };
> oid flagOid = { PRIVATE_OID_DHCP_FLAG };
> struct variable_list varList;

> send_enterprise_trap_vars( SNMP_TRAP_ENTERPRISESPECIFIC,
>     specific, trapOid, sizeof(trapOid), varList);
>
> Is the above code right ?

Nearly.
You need to pass a *pointer* to varList, rather than the struct itself.


> and does some useful function to set the variable_list

snmp_set_var_objid()  to set the name
snmp_set_var_typed_value() or
snmp_set_var_typed_integer() to set the value

Dave

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.