[ 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 5 May 2011 11:13, Dashang Trivedi <[email protected]> wrote:
> What I am thinking for snmp. My logic is if my shell script
> condition is true than I use command snmpset and in snmpd.conf I write
> notificationEvent highCpuUsageTrap TFONLINE-MIB::highCpuUsage
> TFONLINE-MIB::highCpuUsage
First problem - this line defines a notification event called
"highCpuUsageTrap",
using the OID TFONLINE-MIB::highCpuUsage.
OK so far
But then you say that this notification should contain a varbind containing
the value of TFONLINE-MIB::highCpuUsage
This object is defined as a NOTIFICATION TYPE, so it doesn't have a value.
It can only be used to *identify* a trap - it can not be used as a
payload varbind
> monitor -r 15 -s -u tfonlineInternal -e highCpuUsageTrap "Warn:
> High Cpu Usage" != TFONLINE-MIB::highCpuUsage
This line has the same problem - you are monitoring for changes in the
value of TFONLINE-MIB::highCpuUsage.
But this is a NOTIFICATION TYPE object, so doesn't *have* a value.
> if value is change than its send trap using trap2sink.
There is no value to change!
> For that I have to write MIB. I read all the instruction for writing MIB and
> I Write MIB.
> In my MIB I only use the NOTIFICATIONS MACRO
Which is the source of your problems.
You need to use both NOTIFICATION TYPE (for the objects defining the traps)
and OBJECT-TYPE (for the objects being monitored and those included in
the payload of the trap).
These need to be *different* objects.
> This is four macro information. mib is compile successfully that I check on
> http://www.simpleweb.org and in MIB Browser
> tfonline OBJECT-IDENTITY
> STATUS current
> DESCRIPTION ""
> ::= { tonline 2 }
>
> crSystem OBJECT IDENTIFIER ::= { tfonline 1 }
>
> sysAlerts OBJECT IDENTIFIER ::= { crSystem 1 }
>
> highCpuUsage NOTIFICATION-TYPE
> STATUS current
> DESCRIPTION ""
> ::= { sysAlerts 1 }
>
> highDiskUsage NOTIFICATION-TYPE
> STATUS current
> DESCRIPTION ""
> ::= { sysAlerts 2 }
>
> highMemUsage NOTIFICATION-TYPE
> STATUS current
> DESCRIPTION ""
> ::= { sysAlerts 3 }
>
> highBanUsage NOTIFICATION-TYPE
> STATUS current
> DESCRIPTION ""
> ::= { sysAlerts 4 }
> END
> Now HOW TO ADD THIS MIB.
First you need to define MIB objects that can monitor the values of interest.
(Or ideally, to see whether there are existing MIB objects that you can use
instead)
> I use mib2c and its generate template code. And .C
> and .H file I copied in mibgroup/
> I think I made mistake in this step which is EDIT code in .C file please
> suggest me for that...
> Which step I have to edit for NOTIFICATION-TYPE ...please suggest me sir..
That description is really too vague to be useful.
Exact command and exact code fragments (or even full code files)
are much more useful than a description such as "I use mib2c"
or "made mistake in .. editing code"
If we don't know exactly what you did (which mib2c template you used,
what the code looks like, what changes you made, etc), then we can't
really say what you did wrong.
But what I would say is that you should concentrate on getting the
objects that you want to monitor working first - *before* worrying about
the automatic monitoring, and generating traps.
Until you can issue an "snmpwalk" manually and see the values that
you are interested in, there is no point in even thinking about
automating this.
Tackle things one at a time!
Dave
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders