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 >
> ?