Discussion:
mib problem
Chirag
2002-04-09 06:50:03 UTC
Permalink
hi,

i have created the following MIB tree from the ucd example tree.....i have put this TRIAL-MIB.txt in the shared ./mibs/ folder and when i run the snmptranslate command for trialSSSimpleString.... i get the the oid .1.3.6.1.4.1.1.1.1.1 (command used : snmptranslate -m ALL -IR trialSSSimpleString )

now when i try to get the default value of tha oid.....

Command : snmpget -m ALL localhost public snmptranslate -m .1.3.6.1.4.1.1.1.1.1.0
Output : Cannot find module (.1.3.6.1.4.1.1.1.1.1.0): At line 0 in (none)
snmptranslate: Unknown Object Identifier (Sub-id not found: (top) -> )

Command : snmpget -m ALL -v 2c localhost public .iso.org.dod.internet.private.enterprises.trialMIB.trialMIBObjects.trialScalerSet.trialSSSimpleString.0
Output : .iso.org.dod.internet.private.enterprises.trialMIB.trialMIBObjects.trialScalerSet.trialSSSimpleString.0: Unknown Object Identifier (Sub-id not found: trialMIBObjects -> trialScalerSet)

What do i do to include my new MIB and do i have to compile it ? How ? Is the following MIB okie ?

-- Definition of the MIB

TRIAL-MIB DEFINITIONS ::= BEGIN

IMPORTS
enterprises FROM RFC1155-SMI
MODULE-IDENTITY FROM SNMPv2-SMI
MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF;

trialMIB MODULE-IDENTITY
LAST-UPDATED "9911030000Z" -- 30 Aug 1999, midnight
ORGANIZATION "UCDavis"
CONTACT-INFO "
Author: Wes Hardaker
University of California at Davis
"
DESCRIPTION "A simple mib for demonstration purposes.
"
::= { enterprises 1 }

trialMIBObjects OBJECT IDENTIFIER ::= { trialMIB 1 }

trialScalarSet OBJECT IDENTIFIER ::= { trialMIBObjects 1 }

trialSSSimpleString OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"This is a simple test string. It does nothing more than
return its current value, and changes values only when set by
an incoming SNMP set request."
DEFVAL { Hello World }
::= { trialScalarSet 1 }

END

Thanx
chirag
Dave Shield
2002-04-09 07:18:14 UTC
Permalink
Firstly - please do not be so impatient. You have just posted the
same request twice in just over an hour. Given that I've only recently
arrived at work, and many of the core developers will probably still
be asleep. Given that you are not paying anything towards the support
of this package, expecting an immediate response is somewhat unreasonable.
Post by Chirag
snmpget -m ALL localhost public snmptranslate -m .1.3.6.1.4.1.1.1.1.1.0
That is a very strange command to give.

Why on earth do you list 'snmptranslate' as a parameter to 'snmpget'?
At that point in the command line, snmpget is expecting the name of
a MIB object instance, not another command.

Also, if you've said '-m ALL', that will load all the available MIBs,
so there's no need to use -m again to load a file explicitly.
You've said "snmpget .... -n .1.3.6.1.4.1.1.1.1.1.0" which means
"load the MIB file (module) called .1.3.6.1.4.1.1.1.1.1.0"
Since this is an OID, rather than the name of a module, it's not
too surprising that the library can't do this.


Just specify the OID you want:

snmpget -m ALL localhost public .1.3.6.1.4.1.1.1.1.1.0


Dave

P.S: *Please* - no HTML mail. Thanks.
Dave Shield
2002-04-09 11:02:37 UTC
Permalink
[ 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. ]
Also the commands i gave u were not run.... i dont know how did it appear
command was : snmpget -m ALL localhost public .1.3.6.1.4.1.1.1.1.1.0
response : Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Then it looks as if the agent does not implement that particular OID.
Failed object: enterprises.CellcloudMib.1.1.1.0
Strange. .1.3.6.1.4.1.1 is assigned to 'NxNetworks'.
CellCloud appears to be an Indian-based mobile telephone company,
and they don't seem to have any particular interest in SNMP. I don't
know why they appear to be using someone else's enterprise number.

You probably need to search your MIB files for this token,
to see if that indicates where this erroneous usage comes from.

Dave
Dave Shield
2002-04-09 12:40:35 UTC
Permalink
1) I have to create my MIB but under which node should i create my nodes.
Under your assigned enterprise subtree.
I thought i will create under enterprise but i think we have to register
for that
Correct.
(which we dont want to do) until the product is a success.
Why not?
It's free to register, and you don't have to release your MIBs until
you're happy that things are working. So there's no good reason not
to start off using a properly-assigned OID as the base for all your
future work.

Within that, it's totally up to you how you organise things?
You could define one tree for released products, and one for internal
development. Or just start at 1 and work your way up. Or whatever else
seems sensible.
But you might as well do everything under a properly-assigned root.

See
http://www.iana.org/cgi-bin/enterprise.pl

Dave
Dave Shield
2002-04-10 08:03:36 UTC
Permalink
I have registered for the enterprise OID. But till i get one....
suppose i internally want to use some dummy enterprise oid (on my LAN) for
testing. Can I use any OID ?
On your own LAN, you can do whatever you like - just make sure nothing
gets out into the wider Internet. You should find that your official
enterprise number arrives very quickly.
HOw do i compile the ucd-snmp agent ?
configure
make
make install
I am
using SNMP_MIB compiler 0.06 but when i give the argument of mibcompiler as
mib file name of whole path... it does not recognise.
Errr.... that's not particularly clear. Can you please state the *exact*
command line you're giving, and the exact error message.
Are you sure this is a ucd-snmp tool?
What is the MIB compiler ?
Please see the FAQ entry
"Where can I find a MIB compiler?"
snmptranslate recognises the text names in my MIB and gives me an OID
but when i use snmpget or snmpset, always "nosuchname" error comes ?
Please see the FAQ entry
"How do I add a MIB to the agent?"
How do i overcome this ?
Basically, you need to write code to implement this MIB.
It doesn't happen automagically.

Dave
Dave Shield
2002-04-10 12:06:29 UTC
Permalink
when i give
snmpgetnext -OS -p 9999 localhost public trialMIB::trialSSSimpleString.0
the result is
trialMIB::trialSSSimpleString.0: Unknown Object Identifier
Have you put the trialMIB file in the (installed) mibs directory?
But when i try snmpget or snmpwalk or snmpgetnext.... i get all the values
correctly.
Eh? You've just said it doesn't work - and now you say it does.
David Confused!

Exactly what are you trying, and what does it return here?
One more problem when i try to set this leaf trialSSSimpleString.0
snmpset -OS -p 9999 localhost public trialSSSimpleString.0 s hello
i always get Timeout: No Response from localhost
Access Control. Almost certainly.
You need to set up the agent to accept SET requests from localhost
using an appropriate community string. (In general, using "public"
for SET request is regarded as a Bad Idea)

See the various FAQ entries on access control for more info.

Dave
Dave Shield
2002-04-11 06:13:06 UTC
Permalink
I copied the file to /usr/local/share/snmp directory.
Try copying it to /usr/local/etc/snmpd.conf
nexia
Timeout: No Response from localhost
sysDescr is not actually meant to be writable
(though ome versions of the UCD agent got this wrong)
Try with 'sysLocation' instead.
1) Do i have to do something else after creating the file and copying to the
right directory so that it reads configuration from new snmpd.conf ?
Just start (or re-start) the agent.
But I think you've got it in the wrong directory.
4) What would be the precise procedure to allow snmpset permissions to all
MIBs?
The 'rwcommunity' will allow SET access to all writable objects.
But remember that not all objects are writable (and just because
an object has 'read-create' or 'read-write' access in the MIB file,
doesn't automatically mean that this has been implemented).


Dave
Dave Shield
2002-04-11 09:00:06 UTC
Permalink
.1.3.6.1.4.1.10.1.1.1.0
enterprises.ucdavis.memory.memIndex.0 = 0
What could be the possible error..... how come a snmpgetnext on my MIB leaf
can return me hte ucdavis memory info ?
Presumably since that's the next accessible object.
Given that you can see the UCDavis tree, it's unlikely that access
control is at fault. So the problem is probably related to your
particular MIB module.

Are you sure that it's included in the agent? Try walking
the mrTable, and check that it's mentioned there.

If there's any debugging code in your module (and even if
there isn't), try running the agent with debugging turned up full,
and see if you can spot anything suspicious

snmpd -p 9999 -f -L -Dall

Failing that, you'll probably have to fire up your debugger,
and try to track things down that way.

Dave
Dave Shield
2002-04-17 09:07:13 UTC
Permalink
I'd tend to agree with Vishal - I suspect that your agent doesn't
include this object. But walking the tree won't really do anything
more than just confirm that this doesn't work.

I'd suggest that you work through the checklist at

http://www.net-snmp.org/tutorial/agent/CheckList


The other thing to check is access control. Make sure
you can see other object from your agent - not just the
system group.

Dave
Dave Shield
2002-04-18 06:43:05 UTC
Permalink
1) Where is the definition of all the parameters passed in
vavar_extensible_disk ? I mean what does vp, name, length etc mean...so that
i can exploit it better
Have you read the agent tutorial (shipped as AGENT.txt and available at


This describes these parameters.
2) Why are the following functions used in the sysORTable.c
register_sysORTable_sess
unregister_sysORTable_sess
register_sysORTable
They're part of setting up and maintaining this particular table.
If you're just interested in an example of table handling in general,
you can ignore them.
3) I have read that name[*length - 1] gives u the last OID.... from the
example i understood that i will get the last row no. from this... but i m
not quite sure how does a string array return me a no.
row_count = name[*length - 1] - 1;
What makes you think it's a string array?
The parameter list includes

oid *name
^^^

and the 'oid' type is integer based.
6) Lastly i want to know..... that once i make a slight change in my
simpleTableMib.c .... do i have to go thru all the steps of ./configure,
make and make install ?
If you've already used 'configure' to add this mib module, you don't
have to re-run configure every time. You only use configure when the
list of mib modules changes.
If you're editing the same file, then just run 'make' - and that
should only recompile the file(s) you changed.
You don't need to install every time either - just run the agent in
situ. That works fine.
7) Another mailing list problem is that i always receive two Dave Shield
mails with the same subject and reply....
That's because I'm replying direct to you (since you asked the question),
and copying the response to the mailing list (so that others can see it,
learn or correct me, and so the response is archived).

Dave
Dave Shield
2002-04-19 08:41:13 UTC
Permalink
What shud i add in the following code to populate say n no. of rows.
int TABLE_SIZE = 0;
int TABLE_SIZE = 3;
TABLE_SIZE = name[*length - 1] - 1;
int index = name[*length - 1] - 1;
long_ret = TABLE_SIZE+1;
long_ret = index+1;
*var_len = strlen(string[i++]);
return((u_char *) string);
*var_len = strlen( string[index] );
return((u_char*) string[index] );
why dont we need to give break in the above switch case statements?
Because you're explicitly returning from the routine.
'break' indicates that the flow of control should skip to
the end of the 'switch' statement. If you've already
returned from the routine, you can't pick up again at the
end of the switch.

Dave
Dave Shield
2002-05-01 07:42:02 UTC
Permalink
[ Sorry for the delay in responding to this ]
# snmpset -p 9999 localhost private .1.3.6.1.4.1.10.1.1.1.0 s chirag
Error in packet.
Reason: (noSuchName) There is no such variable name in this MIB.
enterprises.trialMIB.trialMIBObjects.trialScalarSet.trialSSSimpleString.0
# snmpget -p 9999 localhost public .1.3.6.1.4.1.10.1.1.1.0
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
enterprises.trialMIB.trialMIBObjects.trialScalarSet.trialSSSimpleString.0
It looks suspiciously as if the code implementing your MIB module has
not been included within the agent. There's a checklist of possible
problems on the project web site, at

http://www.net-snmp.org/tutorial/agent/CheckList.html

Maybe working through that might help track down the cause.
# snmpgetnext -p 9999 localhost public
.1.3.6.1.4.1.10.1.1.1.0
enterprises.ucdavis.memory.memIndex.0 = 0
What could be the possible error..... how come a snmpgetnext on my MIB leaf
can return me hte ucdavis memory info ?
Well if the agent doesn't include your MIB objects (as indicated by the GET
example), getnext will search for the next object that *is* included, which
is clearly the first ucdavis one.

Dave
Dave Shield
2002-05-01 08:32:02 UTC
Permalink
where do i get the
output of these generic and specific traps ?
They go to wherever you've configured as trap destinations.
(e.g. using 'trapsink' in the snmpd.conf file)
I think it ideally goes to
port 161....
Actually the standard trap destination port is 162.
but how do i sense that a trap has come to this port ?
You need to run a trap handler application (e.g. snmptrapd) that listens
on this port.
Suppose i
start my snmptrapd at port 7777 and i want the trap from send_easy_trap() to
this port so that i can see them....what do i do ? where do i specify before
send_easy_trap() in my c program to send the traps to port 7777?
It's not set in the C program - it's set in the snmpd.conf file.
Try
trapsink localhost public 7777

Dave
Dave Shield
2002-05-09 06:34:02 UTC
Permalink
But what do i do if i have to access the data from a agent sitting in the
LAN of the remote city ? Will i have to create a proxy agent which will
collect data from LAN nodes and then send to Mngt Server thru external IP
address node?
It depends on the precise organisation of your (remote) network.
If this uses internal private IP addresses, then yes - you'll probably
need to do something like using a proxy server, or Network Address
Translation, or something similar.
If the remote network uses "normal" IP addresses, but is protected
by a firewall, then you'll need to configure the firewall to allow
SNMP traffic from your management system.

Either way, you're probably better off talking to the people who run
the remote network. They'll be much more familiar with the setup there,
and what would be needed for a new application service than we are.

Dave
Dave Shield
2002-05-13 12:31:05 UTC
Permalink
Where will the code go in this generated c file...if i
want to send a trap every 5 minutes ?
You need to define a new routine that should be invoked regularly
(containing the trap generation code, plus anything else you need to
do either before or afterwards).
Then use the 'snmp_alarm' routines to call this routine every
five minutes.

Dave
Dave Shield
2002-05-22 14:16:02 UTC
Permalink
Sorry for the delay in responding to this.
1) When we use SNMP_TRAP_ENTERPRISESPECIFIC as the first param in
send_trap_vars....what number should we give as the second parameter ?
..... Is this number the last
number(::=) of the NOTIFICATION-TYPE OID ? In my case should it be 2 ?
Correct.
2) What is the significance of OBJECTS in NOTIFICATION-TYPE definition ?
This specifies the VarBind(s) that ought to be included in the trap.
Currently i have only one object included ie. mytrialSSSimpleString. So i
assume that when i send the variable list in
send_enterprise_trap_vars()..... i can send the OID/type/value of the
include OBJECT only.
Close.
It means that you ought to include this object as the first (or only)
varbind in the list. You (the agent implementer) are at liberty to add
additional varbinds if they might be useful.
But i see that the variable list takes in the value of
any oid and value ?
Yup - this is a general purpose API, so doesn't try to hamstring the
MIB module implementer as what they can/can't send.
If this is so then what does OBJECTS mean?
The OBJECTS clause lists the objects that the MIB designer felt to
be useful in this situation. The MIB module implementer must take
account of this, by including these objects as a minimum.
3) Does generic traps assume all objects in its definition ?
Sorry - I don't understand the question.
4) Below is what i implement when calling the trap....can the third
parameter in send_enterprise_trap_vars() can any OID ? or should it contain
the OID which defines NOTIFICATION-TYPE only ?
Close - it should contain the "base OID" of the notification object
I.e. without the final subid (i.e. mytrialMIBObjects)
This final subid goes in the 'specific trap' field.

This is a bit confusing, because you're mixing the SMIv2 style of
defining notifications, with the SNMPv1 style of traps.
It's simpler to follow (if more coding) to use the SNMPv2 trap
generation API, where everything is done with varbinds.
I get a trap with whatever
oid i give.....
Yup. As far as the agent is concerned, these are all just OIDs.
It sends what it's told to send, and assumes you know what you're doing :-)
Is there any
inbuilt function which will help me see the PDUs in readable form fr the
socket ?
Try using the 'apps' code files as a starting point. These receive PDUs
(either in response to a request, or snmptrapd listens for incoming
traps all the time).

Dave

Loading...