snmp question

I have been reading books and article on snmp but
there is one point I can’t clarify.

I’m confuse by what is a manager/agent and how it interact with
snmpd and my software.

Let’s take an example: I have a variable which is system temperature.
My understanding is the manager coulc pool this variable.

When the manager pools the variable the request is sent to snmpd who
return the value of the variable. So I must write an agent/manager (confuse
what it should be call) that constantly set the variable but send the value
to snmpd??? That troubles me since snmpd writes variable in a file
(that’s not very desirable for system with flash, although I could set
the file to be in a ram disk)

For some reason I was expecting the snmpd to set to my program
a request for a read and not having to set the variable all the time.

I’m aware of the trap and inform mecanism existance although I’m not
certain if this is what I’m looking for?

Am I making any senses :wink: ?

  • Mario

This is oversimplified but it should help:

The agent (snmpd) runs on the device or machine to be managed. It acts as a
“server” in the client/server model.
The manager runs remotely on another machine and acts as a “client”. It sends
one of the following commands to the agent:

GET
GETNEXT
SET

where GET is used to request the value of particular data object on the agent’s
machine/device, GETNEXT is a query for the next logical data object in the
database and SET changes a data object’ value. An agent can also send an
asynchronous event, called a “trap” back to the manager.

SNMP defines how data objects are referenced. The manager specifies the data
object’s “object identifier(OID)” as a parameter in the command to the agent.
The database of data objects is specified in the Management Information Base
(MIB), which is a file or set of ASCII files encoded in an obscure definition
language called ASN.1. The MIB is organized in a tree-like manner similar to a
disk directory of files. Each node in the tree is assigned a number, according
to it’s position in the tree. A data object’s OID is a string of integers
separated by periods that is formed by traversing the tree from the root all the
way to the data object. For example, the standard data object, sysDescr, has an
OID of 1.3.6.1.2.1.1.1.0. An OID can be referenced symbolically by using the
node names in the MIB. This is similar to the way IP addresses can be
represented with host and domain names. The previous example could be
referenced as iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0.

In your example, the agent runs on the machine that has direct access to the
system temperature. This may be done by reading a register or however you do it
on your device. You will need to modify the agent to either read the system
temperature upon request by the agent or cache it in memory so that when the
manager asks you for it you already have it stored in memory. There’s no need
to save the value in a file. I’m not sure what you mean by that. You could also
modify the agent to issue a trap to the manager if the system temperature
reaches an undesirable level. Either way, the agent has to be able to access
the temperature data and send it to the manager.

By the way, you can use the standard SNMP tools for querying an agent:

snmpget
snmpgetnext
snmpset
snmpwalk

-Carlos

I have been reading books and article on snmp but
there is one point I can’t clarify.

I’m confuse by what is a manager/agent and how it interact with
snmpd and my software.

Let’s take an example: I have a variable which is system temperature.
My understanding is the manager coulc pool this variable.

When the manager pools the variable the request is sent to snmpd who
return the value of the variable. So I must write an agent/manager (confuse
what it should be call) that constantly set the variable but send the value
to snmpd??? That troubles me since snmpd writes variable in a file
(that’s not very desirable for system with flash, although I could set
the file to be in a ram disk)

For some reason I was expecting the snmpd to set to my program
a request for a read and not having to set the variable all the time.

I’m aware of the trap and inform mecanism existance although I’m not
certain if this is what I’m looking for?

Am I making any senses > :wink: > ?

  • Mario

“Carlos Ramirez” <cramirez@wgate.com> wrote in message
news:3A8AE93E.2FDE6764@wgate.com

This is oversimplified but it should help:

The agent (snmpd) runs on the device or machine to be managed. It acts as
a
“server” in the client/server model.
The manager runs remotely on another machine and acts as a “client”. It
sends
one of the following commands to the agent:

GET
GETNEXT
SET

where GET is used to request the value of particular data object on the
agent’s
machine/device, GETNEXT is a query for the next logical data object in the
database and SET changes a data object’ value. An agent can also send an
asynchronous event, called a “trap” back to the manager.

SNMP defines how data objects are referenced. The manager specifies the
data
object’s “object identifier(OID)” as a parameter in the command to the
agent.
The database of data objects is specified in the Management Information
Base
(MIB), which is a file or set of ASCII files encoded in an obscure
definition
language called ASN.1. The MIB is organized in a tree-like manner similar
to a
disk directory of files. Each node in the tree is assigned a number,
according
to it’s position in the tree. A data object’s OID is a string of integers
separated by periods that is formed by traversing the tree from the root
all the
way to the data object. For example, the standard data object, sysDescr,
has an
OID of 1.3.6.1.2.1.1.1.0. An OID can be referenced symbolically by using
the
node names in the MIB. This is similar to the way IP addresses can be
represented with host and domain names. The previous example could be
referenced as iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0.

That part I understand

In your example, the agent runs on the machine that has direct access to
the
system temperature. This may be done by reading a register or however you
do it
on your device. You will need to modify the agent to either read the
system

So snmpd is a “default agent”. If I want to add add my own variables that
are changed quite often I must write my own agent. The “snmpd” cannot
be extended (without changing its code) to handle my new variable?

temperature upon request by the agent or cache it in memory so that when
the
manager asks you for it you already have it stored in memory. There’s no
need
to save the value in a file. I’m not sure what you mean by that.

If I start snmpd and for example set the value …system.sysDescr. The new
value
is written by snmpd in the file /etc/snmp.conf. So if I was to slay and
restart snmpd
and do a get on the variable, it would return the last value that I just set
it to.

You could also
modify the agent to issue a trap to the manager if the system temperature
reaches an undesirable level. Either way, the agent has to be able to
access
the temperature data and send it to the manager.

By the way, you can use the standard SNMP tools for querying an agent:

snmpget
snmpgetnext
snmpset
snmpwalk

-Carlos

I have been reading books and article on snmp but
there is one point I can’t clarify.

I’m confuse by what is a manager/agent and how it interact with
snmpd and my software.

Let’s take an example: I have a variable which is system temperature.
My understanding is the manager coulc pool this variable.

When the manager pools the variable the request is sent to snmpd who
return the value of the variable. So I must write an agent/manager
(confuse
what it should be call) that constantly set the variable but send the
value
to snmpd??? That troubles me since snmpd writes variable in a file
(that’s not very desirable for system with flash, although I could set
the file to be in a ram disk)

For some reason I was expecting the snmpd to set to my program
a request for a read and not having to set the variable all the time.

I’m aware of the trap and inform mecanism existance although I’m not
certain if this is what I’m looking for?

Am I making any senses > :wink: > ?

  • Mario

So snmpd is a “default agent”. If I want to add add my own variables that
are changed quite often I must write my own agent. The “snmpd” cannot
be extended (without changing its code) to handle my new variable?

Actually, snmpd “is” the agent. If you want to add your own variables then you
must extend the agent. In QNX, you have a couple of options. You can go to
www.qnx.com, click on Free Software, search for snmp and then download
snmpv1.tgz. If you’re just adding one or two variables then this might work for
you. Bear in mind that this is only SNMP version 1 which is very weak in the
area of security. QNX’s version also doesn’t have a MIB compiler that lets you
generate C code from your new MIB. Maybe you don’t need either of these. This
version of the SNMP is based on the CMU-SNMP package which is very old and
outdated. I’m actually in the process of trying to port NET-SNMP which supports
SNMPv1, v2 and v3 and includes a MIB compiler. I plan on extending the agent
significantly and I need the added security so the QNX version won’t work for
me. However, the port is turning out to be quite painful.

If I start snmpd and for example set the value …system.sysDescr. The new
value
is written by snmpd in the file /etc/snmp.conf. So if I was to slay and
restart snmpd
and do a get on the variable, it would return the last value that I just set
it to.

First of all, the value system.sysDescr is supposed to be read-only. I’m not
sure why your agent is writing that file. When you extend an agent, you write
the specific code to handle the request for your private data. If your data is
writable via a SET command then you have to write the code that changes the
variable. It doesn’t necessarily have to be a file write. It might be writing
a register, such as the gain of the A/D converter associated with your
temperature sensor for example.

“Carlos Ramirez” <cramirez@wgate.com> wrote in message
news:3A8B00F6.6F682D04@wgate.com

So snmpd is a “default agent”. If I want to add add my own variables
that
are changed quite often I must write my own agent. The “snmpd” cannot
be extended (without changing its code) to handle my new variable?

Actually, snmpd “is” the agent. If you want to add your own variables
then you
must extend the agent. In QNX, you have a couple of options. You can go
to
www.qnx.com> , click on Free Software, search for snmp and then download
snmpv1.tgz. If you’re just adding one or two variables then this might
work for
you. Bear in mind that this is only SNMP version 1 which is very weak in
the
area of security. QNX’s version also doesn’t have a MIB compiler that
lets you
generate C code from your new MIB. Maybe you don’t need either of these.
This
version of the SNMP is based on the CMU-SNMP package which is very old and
outdated. I’m actually in the process of trying to port NET-SNMP which
supports
SNMPv1, v2 and v3 and includes a MIB compiler. I plan on extending the
agent
significantly and I need the added security so the QNX version won’t work
for
me. However, the port is turning out to be quite painful.

TCP/IP 5.0 has SNMP v2. It appeart both QRTP and QNX4 will share
the same stuff.

I’m using TCP/IP 5.0 (beta) to do my testing. But ultimetly I want
it for QNX6,

If I start snmpd and for example set the v
alue …system.sysDescr. The new
value
is written by snmpd in the file /etc/snmp.conf. So if I was to slay and
restart snmpd
and do a get on the variable, it would return the last value that I just
set
it to.

First of all, the value system.sysDescr is supposed to be read-only. I’m
not
sure why your agent is writing that file.

When you extend an agent, you write
the specific code to handle the request for your private data. If your
data is
writable via a SET command then you have to write the code that changes
the
variable. It doesn’t necessarily have to be a file write. It might be
writing
a register, such as the gain of the A/D converter associated with your
temperature sensor for example.

Ok I think I understand basicly the stuff in TCP/IP 5.0 is extremely limited
as I can’t really extend it so I’m kinda stuck right?

There is a API: snmp_open, snmp_read, snmp_send. I was hopping they
would allow me to extend, but I don’t see how I can receive read request.
They are use to write agent to to extend the snmpd agent. I’m beggining
to see the light now :wink:

I may give a shot a porting net-snmp to QNX6.

Thanks for your help!

I’m using TCP/IP 5.0 (beta) to do my testing. But ultimetly I want
it for QNX6,

Is this the “forever beta” or what? Any estimate of when this will be released
for QNX4? QNX6?