Re: timeticks in second and send a easy trap

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
    [ First - *please* don't mail me privately, without copying
     any responses to the mailing list.  I don't have the time
     or inclination to offer private, unpaid, SNMP consultancy.
     Keep discussions to the list, where others can both learn
     and offer advice.  Thanks.   ]


On 17/12/2007, Tako Chang <[email protected]> wrote:
> > > I find that TimeTicks is a basic type in snmp
> > > but it uses "1/100 second" as its unit.
> > >
> >    Simply define an INTEGER-valued object, and specify
> > a UNITS clause of "seconds".
> >
> > See (for example):
> >     IP_MIB::ipReasmTimeout
>
> I querry ipReasmTimeout.0 and get IP-MIB::ipReasmTimeout.0 = INTEGER: 0
> Actually, I want it to be parsed into a readable format like ?? Days ?? hr
> ?? min ??sec

That's something you will have to implement for yourself.
As far as basic SNMP is concerned, you have a choice
between the standard type TickTicks (in 1/100s), which
most toolkit should be able to interpret.
   Or else an INTEGER-based value, which you will need
to convert into a suitable printable format yourself.   There's
nothing standard that would give you that for one-second
measurement.


   The closest would be the DateAndTime pseudo-type,
though this really refers to clock time, rather than time
intervals.




> > > I define a trap in my MIB
> >
> > What is the actualy definition of the trap/notification?

>
> flagEnable     OBJECT-TYPE
> SYNTAX       INTEGER{
>              enable(1),
>              disable(2)
> }
> ACCESS        read-write
> STATUS       mandatory
> ::= { testMIB 1 }
>
>  demoTrap     TRAP-TYPE
> ENTERPRISE      ipavSTBCommonTrap
> VARIABLES       {
>            flagEnable
> }
> DESCRIPTION     "Send a message to the manager when the DHCP setting is
> chaged"
> ::= 1

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)




> flagEnable is a global variable and can be access by MY_API
> My_registercb( testTrap() ) will register a callback to MY_API and when the
> value of flagEnable
> is changed by MY_API,  testTrap() will be executed.
>
> so, I plan to write send_easy_trap() in this function,

"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

-------------------------------------------------------------------------
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.