Discussion:
problem with net-snmp setup and access
Amar S. Bhatti
2001-02-15 19:02:36 UTC
Permalink
Hello folks

I have just downloaded ucd-snmp 4.2-3 rpms from sourceforge site

this is what I have in my system right now

ucd-snmp-4.2-3
ucd-snmp-utils-4.2-3
ucd-snmp-devel-4.2-3

now that I try to run the daemon snmpd by

$/etc/rc.d/init.d/snmpd start

I get

/etc/rc.d/init.d/snmpd: /etc/init.d/functions: No such file or directory
Starting snmpd: /etc/rc.d/init.d/snmpd: daemon: command not found

I am not sure what is causing this problem....

In addition I have been reading the man page about snmpd.conf

according to the man page this has to be located in /usr/local/share/snmp/

and the only file I have is in

/etc/snmp/snmpd.conf

These are the things I have added in the file

## sec.name source community
com2sec local localhost public
com2sec ourhost_1 default ourcommunity
com2sec ourhost_2 NETWORK/24 ourcommunity

## group.name sec.model sec.name
group linuxboxes any local
group linuxboxes v1 ourhost_1
group linuxboxes v1 ourhost_2


## incl/excl subtree mask
#view all included .1 80

## -or just the mib2 tree-

view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

## context sec.model sec.level prefix read write notif
#access MyROGroup "" any noauth 0 all none none
#access MyRWGroup "" any noauth 0 all all all
access linuxboxes "" any noauth exact all none none

these are the additions made to the file after reading the commented examples
in this file. After reading snmpd.conf man page. It is described that this file
should be found in /usr/share/snmp/ however I could not find this file there.

I manually created a snmpd.conf file in /usr/share/snmp/

However when I try to access my machine using

$snmpwalk myhost_1 ourcommunity | more

I get timeout : no response from myhost_1

any help will be greatly appreciated, since I am frustrated at what is causing
this failure.

Regards,

Amar
Gang Zheng
2001-02-15 22:50:56 UTC
Permalink
Post by Amar S. Bhatti
/etc/rc.d/init.d/snmpd: /etc/init.d/functions: No such file or directory
This is because the "/etc/rc.d/init.d/snmpd" script cannot find the file
"/etc/init.d/functions". You should edit the script
"/etc/rc.d/init.d/snmpd", find the ocurrance of "/etc/init.d/functions" and
change it to "/etc/rc.d/init.d/functions".
Post by Amar S. Bhatti
Starting snmpd: /etc/rc.d/init.d/snmpd: daemon: command not found
Once you edit the "/etc/rc.d/init.d/snmpd" file as above, you should not see
this error message again. (Actually the "daemon" command is one of the
functions defined in the "/etc/rc.d/init.d/functions" file.)
Post by Amar S. Bhatti
However when I try to access my machine using
$snmpwalk myhost_1 ourcommunity | more
I get timeout : no response from myhost_1
This is probably because the snmpd daemon has not been started on myhost_1.

- Gang Zheng
Amar S. Bhatti
2001-02-16 13:36:58 UTC
Permalink
Post by Gang Zheng
Post by Amar S. Bhatti
/etc/rc.d/init.d/snmpd: /etc/init.d/functions: No such file or directory
This is because the "/etc/rc.d/init.d/snmpd" script cannot find the file
"/etc/init.d/functions". You should edit the script
"/etc/rc.d/init.d/snmpd", find the ocurrance of "/etc/init.d/functions" and
change it to "/etc/rc.d/init.d/functions".
Thanks for the answer I have edited the /etc/rc.d/init.d/snmpd to reflect the
exact location of functions file.
Post by Gang Zheng
Post by Amar S. Bhatti
Starting snmpd: /etc/rc.d/init.d/snmpd: daemon: command not found
Once you edit the "/etc/rc.d/init.d/snmpd" file as above, you should not see
this error message again. (Actually the "daemon" command is one of the
functions defined in the "/etc/rc.d/init.d/functions" file.)
Post by Amar S. Bhatti
However when I try to access my machine using
$snmpwalk myhost_1 ourcommunity | more
I get timeout : no response from myhost_1
This is probably because the snmpd daemon has not been started on myhost_1.
No this is not correct, even when I had the snmpd deamon started I still got
that message, the question is if I am on the machine that I am trying to use
snmpwalk command on, then I should access the machine as localhost not by its
IP address or hostname, correct ? The IP address should only be used if I am
trying to access this machine from another system....

LAter

Amar
Post by Gang Zheng
- Gang Zheng
Dave Shield
2001-02-16 15:17:11 UTC
Permalink
Post by Amar S. Bhatti
Post by Gang Zheng
Post by Amar S. Bhatti
However when I try to access my machine using
$snmpwalk myhost_1 ourcommunity | more
I get timeout : no response from myhost_1
This is probably because the snmpd daemon has not been started on myhost_1.
No this is not correct, even when I had the snmpd deamon started I still got
that message,
OK - then the most likely next cause is that the agent doesn't recognise
the community name that you are using.

Please see the FAQ entries:

Requests always seem to timeout, and don't give me anything back
I can see the system group, but nothing else
and
I don't understand the new access control stuff


Or make sure that you have set the community name using 'rocommunity'
in the snmpd.conf file.
Post by Amar S. Bhatti
the question is if I am on the machine that I am trying to use
snmpwalk command on, then I should access the machine as localhost not by its
IP address or hostname, correct ? The IP address should only be used if I am
trying to access this machine from another system....
Depending on how you've got the access control configured, then it might
not matter. The agent will receive requests, and return the results,
regardless of whether you specify the loopback 'localhost' address, or
the systems's real name or IP address.

The only place where this might make a difference, is if 'localhost'
is granted different access rights to the rest of the local network.

Again, see the access control stuff mentioned above.

Dave
Didier Chabanol
2001-02-16 15:38:41 UTC
Permalink
Hello,

I'm develloping a sub agent using agentX. Some read/write values supported by
this agent
are stored in a configuration file (agentxd.conf).
To help me in this devellopement I've taken as example the system_mib.c
source. Some
values as syslocation or contactName are read-write and stored in snmpd.conf.
But I have noticed that when we do a set on this values they are not saved in
snmpd.conf.

My question is :
Is there a function (like snmpd_register_config_handler) that allow to manage
set request on
a value that is stored in a configuration file ?

Regards,

Didier Chabanol
FERMA
Dave Shield
2001-02-16 16:12:23 UTC
Permalink
Post by Didier Chabanol
Is there a function (like snmpd_register_config_handler) that allow to
manage set request on
a value that is stored in a configuration file ?
Sort of.
The approach that has been used is to define a callback, that's used
for storing various persistent data.

So as part of your module initialisation, you can register a callback
for this:

snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
store_myData, NULL);


and then define a suiteable calback handler:

int
store_myData(int majorID, int minorID, void *serverarg,
void *clientarg)

This can then use the routine 'snmpd_store_config()' to write
out lines to go in the persistent version of snmpd.conf.

See target/snmpTargetAddrEntry.c for an example of this in action.

Dave
Jyothi V
2001-02-19 07:11:15 UTC
Permalink
Hi,
Does this handler
int
store_myData(int majorID, int minorID, void *serverarg,
void *clientarg)
be able to store all the different values of instances of an object.
In my agaent implementation, I have made use of the
"snmpd_register_config_handler"
to read the initial values i.e. at the startup of the agent from the
snmpd.conf using the tokens. I am actually initialising all the instances(
the no. of instances is fixed before hand in this case) of one object to the
same value at the start up. Now while shut down I want to store all the
different values of different instances. So that at the next startup I can
still have the values just before the shutdown. How do I do this?
Thanks in advance.
Jyothi
-----Original Message-----
From: Dave Shield [mailto:***@csc.liv.ac.uk]
Sent: Friday, February 16, 2001 9:42 PM
To: Didier Chabanol
Cc: net-snmp-***@lists.sourceforge.net
Subject: Re: Set on a value stored in configuration file
Post by Didier Chabanol
Is there a function (like snmpd_register_config_handler) that allow to
manage set request on
a value that is stored in a configuration file ?
Sort of.
The approach that has been used is to define a callback, that's used
for storing various persistent data.

So as part of your module initialisation, you can register a callback
for this:

snmp_register_callback(SNMP_CALLBACK_LIBRARY,
SNMP_CALLBACK_STORE_DATA,
store_myData, NULL);


and then define a suiteable calback handler:

int
store_myData(int majorID, int minorID, void *serverarg,
void *clientarg)

This can then use the routine 'snmpd_store_config()' to write
out lines to go in the persistent version of snmpd.conf.

See target/snmpTargetAddrEntry.c for an example of this in action.

Dave
Dave Shield
2001-02-19 09:15:06 UTC
Permalink
Post by Jyothi V
Does this handler
int
store_myData(int majorID, int minorID, void *serverarg,
void *clientarg)
be able to store all the different values of instances of an object.
It can do whatever you want it to do.

If you want to save the value of a single object, you can do so.
If you want to save a whole slew of values, you can do so.
If you want to put the agent into an infinite loop, you're a
mean-spirited, dirty low-down rat :-), but you can do so.

Think of this routine as a "this office is closing" call.
It's your chance to tidy up, and save everything you'll need tomorrow.
Post by Jyothi V
In my agaent implementation, I have made use of the
"snmpd_register_config_handler"
to read the initial values i.e. at the startup of the agent from the
snmpd.conf using the tokens. I am actually initialising all the instances(
the no. of instances is fixed before hand in this case) of one object to the
same value at the start up.
Hold on a second - I think you're mixing two concepts here:

The config handler is how you (the module implementor) allow a system
administrator to specify certain characteristics of the module setup or
behaviour.
You (the system administrator) are then making use of this handler
to initialise the instances appropriately.

But these are you acting in two somewhat different roles.

For a clean design, you (the module designer) should try and avoid *forcing*
yourself (the system administrator) to specify too much in the config file.
Ideally, the module should work "sensibly" with no config setup at all.
(Even if "sensibly" might mean a null action, as with some of the UCD
specifics).
The config directives are more usefully concerned with fine-tuning
the operation of the module. This may not be possible (it's difficult
to comment without some knowledge of what you're actually doing!), but
it's an ideal to keep in mind.
Post by Jyothi V
Now while shut down I want to store all the
different values of different instances. So that at the next startup I can
still have the values just before the shutdown. How do I do this?
Yes - you can do this.
Simply contruct the various config lines that you wish to save, and call
'snmpd_store_config()' with each of them in turn.

Note that you can use a different "internal format" config directive if
you wish. Although the persistent version of snmpd.conf is handled in the
same way as any other, it's not usually edited or viewed manually.
So ease of comprehension is not as high a priority as it would be with the
more "public" directives. If you want to dump things in a more compact,
programmatically-accessible syntax, then this is quite reasonable.

But fundamentally, you can dump as much out as you wish, in whatever
form is most convenient to you.

Dave

Loading...