
hi
i'm trying to do a program takes the oid of a trap and shows the information of that trap, name, description. how could i do this?
i haven't find any example about how to do it, other problem that i have is that i almost know nothing about how snmp works, could you point.
Thanks.
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

Hi!
Diego> i'm trying to do a program takes the oid of a trap and shows the Diego> information of that trap, name, description. how could i do this?
The general problem is to get a module&identifier out of an OID. Libsmi can solve this query only for the modules that have been loaded. If you know the set of MIB modules that contain all the required information, then smiLoadModule() all those modules, then smiGetNodeByOID() the SmiNode of each notification OID you receive, and walk through the varbinds.
Unfortunately, there is no tutorial for libsmi, but the man pages and the programs in the tools directory may help to get on the right track.
Diego> i haven't find any example about how to do it, other problem Diego> that i have is that i almost know nothing about how snmp works, Diego> could you point.
The formal way to learn about SNMP is to read the appropriate RFCs. The (in my opinion) in the first step more efficient way, is to read a good book, and then use the RFCs as a reference. What `good' is, depends a little on your goal. My starting point was a former revision of:
@Book{Ros96, author = "M. T. Rose", title = "The Simple Book -- An Introduction to Internet Management, Revised Second Edition", edition = "2", publisher = "Prentice Hall", year = "1996", ISBN = "0-13-451659-1", }
-frank -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

On 21 May 2001 06:03:38 +0200, Frank Strauss wrote:
Hi!
Diego> i'm trying to do a program takes the oid of a trap and shows the Diego> information of that trap, name, description. how could i do this?
The general problem is to get a module&identifier out of an OID. Libsmi can solve this query only for the modules that have been loaded. If you know the set of MIB modules that contain all the required information, then smiLoadModule() all those modules, then smiGetNodeByOID() the SmiNode of each notification OID you receive, and walk through the varbinds.
i have don't the smiGetNodeByOID, when i print node->name, the only thing that i get is iso., i only get the first piece of the OID. What should i use to walk through?, i tried smiGetNextNode(node, node->nodekind), but all i get is a seg fault.
Unfortunately, there is no tutorial for libsmi, but the man pages and the programs in the tools directory may help to get on the right track.
Diego> i haven't find any example about how to do it, other problem Diego> that i have is that i almost know nothing about how snmp works, Diego> could you point.
The formal way to learn about SNMP is to read the appropriate RFCs. The (in my opinion) in the first step more efficient way, is to read a good book, and then use the RFCs as a reference. What `good' is, depends a little on your goal. My starting point was a former revision of:
@Book{Ros96, author = "M. T. Rose", title = "The Simple Book -- An Introduction to Internet Management, Revised Second Edition", edition = "2", publisher = "Prentice Hall", year = "1996", ISBN = "0-13-451659-1", }
-frank
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

Hi!
Diego> i'm trying to do a program takes the oid of a trap and shows the Diego> information of that trap, name, description. how could i do this?
The general problem is to get a module&identifier out of an OID. Libsmi can solve this query only for the modules that have been loaded. If you know the set of MIB modules that contain all the required information, then smiLoadModule() all those modules, then smiGetNodeByOID() the SmiNode of each notification OID you receive, and walk through the varbinds.
Diego> i have don't the smiGetNodeByOID, when i print node->name, the only Diego> thing that i get is iso., i only get the first piece of the OID. What
How did you retrieve this `node'?
Diego> should i use to walk through?, i tried smiGetNextNode(node, Diego> node-> nodekind), but all i get is a seg fault.
Traversing the nodes is done by smiGetFirstNode()/smiGetNextNode().
If you get seg faults, your libsmi installation is probably not ok. Libsmi does not work smoothly, if you use non-correct modules or if required (including imported) modules are missing. Ensure to get this fixed by using smilint. As long as smilint signals severe errors, do not expect your own program to work correctly.
-frank -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

On 22 May 2001 18:23:09 +0200, Frank Strauss wrote:
Hi!
Diego> i'm trying to do a program takes the oid of a trap and shows the Diego> information of that trap, name, description. how could i do this?
The general problem is to get a module&identifier out of an OID. Libsmi can solve this query only for the modules that have been loaded. If you know the set of MIB modules that contain all the required information, then smiLoadModule() all those modules, then smiGetNodeByOID() the SmiNode of each notification OID you receive, and walk through the varbinds.
Diego> i have don't the smiGetNodeByOID, when i print node->name, the only Diego> thing that i get is iso., i only get the first piece of the OID. What
How did you retrieve this `node'?
Diego> should i use to walk through?, i tried smiGetNextNode(node, Diego> node-> nodekind), but all i get is a seg fault.
Traversing the nodes is done by smiGetFirstNode()/smiGetNextNode().
If you get seg faults, your libsmi installation is probably not ok. Libsmi does not work smoothly, if you use non-correct modules or if required (including imported) modules are missing. Ensure to get this fixed by using smilint. As long as smilint signals severe errors, do not expect your own program to work correctly.
ok, i used smilint, and it gave some errros, now it works smoothly, but i have another question.
do i have to specify that i want to load a config file smi.conf or is it parsed upon initializacion (calling smiInit(NULL); would serve), i say this because if i put the mibs into the config file and comment the smiLoadModule lines the program fails to retrieve the nodes.
thanks again
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

Diego> do i have to specify that i want to load a config file smi.conf Diego> or is it parsed upon initializacion (calling smiInit(NULL); Diego> would serve), i say this because if i put the mibs into the Diego> config file and comment the smiLoadModule lines the program Diego> fails to retrieve the nodes.
From the smi_config man page:
int smiInit(const char *tag); [...] The smiInit() function should be the first SMI function called in an application. It initializes its internal structures. If tag is not NULL, the global configuration file and (on UNIX systems) a user configuration file are read implicitly, if existent. All global statements and those statements with a tag (a ``tag: '' prefix) that matches the tag argument are executed. (see also CONFIGUĀ RATION FILES below). smiInit() returns zero on success, or otherwise a negative value.
So, you probably want to use smiInit("") or smiInit("<my_app>").
-frank -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.
participants (2)
-
Diego Gonzalez
-
Frank Strauss