On Tue, Nov 19, 2013 at 10:19 AM, Moctar DIAKHITE <mdiakh...@elecdan.com>wrote:
> Hello everybody,
>
> I'm new at net-snmp coding. I'm writing a MIB module which include scalar
> data, tables and traps (notifications). I need to attach a notification to
> every single device. For scalar nodes this quite simple and I managed to
> perform it without many problems.
>
> My question is: "is it possible to implement dynamic notifications ?".
> This will consist typically of creating a notification for a newly added
> sensor or removing notification for inexistent sensors.
>
> The following example represent a table data describing monitored ip
> devices in my system. I'd like for example to attach a notification to the
> state of a given device.
>
> 571 -- *********************************************
> 572
> 573 ipDeviceNumber OBJECT-TYPE
> 574 SYNTAX INTEGER(0..64)
> 575 MAX-ACCESS read-only
> 576 STATUS current
> 577 DESCRIPTION
> 578 "Number of ip devices."
> 579 ::= { ipDevice 1}
> 580
> 581 ipDeviceTable OBJECT-TYPE
> 582 SYNTAX SEQUENCE OF IPDeviceEntry
> 583 MAX-ACCESS not-accessible
> 584 STATUS current
> 585 DESCRIPTION
> 586 "A list of ip device."
> 587 ::= { ipDevice 2 }
> 588
> 589 ipDeviceEntry OBJECT-TYPE
> 590 SYNTAX IPDeviceEntry
> 591 MAX-ACCESS not-accessible
> 592 STATUS current
> 593 DESCRIPTION
> 594 "An interface entry containing objects for ip devices."
> 595 INDEX { ipDeviceIndex }
> 596 ::= { ipDeviceTable 1 }
> 597
> 598 IPDeviceEntry ::=
> 599 SEQUENCE {
> 600 ipDeviceIndex INTEGER,
> 601 ipDeviceIP IpAddress,
> 602 ipDeviceState INTEGER
> 603 }
> 604
> 605 ipDeviceIndex OBJECT-TYPE
> 606 SYNTAX INTEGER(0..64)
> 607 MAX-ACCESS read-only
> 608 STATUS current
> 609 DESCRIPTION
> 610 "A unique value for each ip interface. Its value ranges between 1
> and the value of ipDev
> 611 ::= { ipDeviceEntry 1 }
> 612
> 613 ipDeviceIP OBJECT-TYPE
> 614 SYNTAX IpAddress
> 615 MAX-ACCESS read-only
> 616 STATUS current
> 617 DESCRIPTION
> 618 "IP device description."
> 619 ::= { ipDeviceEntry 2 }
> 620
> 621 ipDeviceState OBJECT-TYPE
> 622 SYNTAX INTEGER { not-responding(0), responding(1) }
> 623 MAX-ACCESS read-only
> 624 STATUS current
> 625 DESCRIPTION
> 626 "0 stands for not respond, while 1 stands for respond."
> 627 ::= { ipDeviceEntry 3 }
> 628
> 629
> 630 -- *********************************************
>
> Normally for a given scalar data I will have to declare a notification for
> this data like in the following example: *
> Object:*
>
> 248 batteryState OBJECT-TYPE
> 249 SYNTAX DisplayString
> 250 UNITS "Volt"
> 251 MAX-ACCESS read-only
> 252 STATUS current
> 253 DESCRIPTION
> 254 "Battery value."
> 255 ::= { periphStates 1 }*Notification:*
>
> 746 b
> attery
> Status NOTIFICATION-TYPE
> 747 OBJECTS { batteryState }
> 748 STATUS current
> 749 DESCRIPTION "sd card status."
> 750 ::= { sysnotifs 3}
>
>
Sure!
What information do you want to send in the trap?
For example:
deviceStatus NOTIFICATION-TYPE
OBJECTS { deviceIP, deviceState }
STATUS current
DESCRIPTION "device status change."
::= { sysnotifs 4}
The OBJECTS referred to in a trap can be either standalone scalars or
scalars in a row of a table. (only the indexes on the scalars look
different.) Then its up to you to include the right (specific)
scalar instance when you send your trap under the conditions you
specify.
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders