Robert 

Thank you for your help.
About this problem, I've got an answer from Taylor Ben 3 days ago.
He suggested me to replace the apt-get installed snmpd (/usr/sbin/snmpd)  
with my compiled snmpd.
And it worked.

By the way, if I remove apt-get installed snmpd, it also works.
/snmp.me/sbin/snmpd -Lsd -c /snmp.me/etc/snmpd.conf

Your solution looks like work also, I will test it on another virtual machine.
> --prefix=/usr/local/test \
> --with-persistent-directory=/usr/local/test/var/net-snmp \  
> --with-logfile=/usr/local/test/var/log/snmpd.log
> Use the -C option to ignore the default configuration file

Regards
Yan

-----Original Message-----
From: NetSNMP Mailbox [mailto:net-snmp-m...@freesnmp.com] On Behalf Of Robert 
Story
Sent: Wednesday, November 23, 2016 4:36 AM
To: fx YAN BING <yan.b...@fujixerox.co.jp>
Cc: net-snmp-coders@lists.sourceforge.net; yanbin...@outlook.com
Subject: Re: start snmpd failed if using user-specific config file

On Thu, 17 Nov 2016 07:20:04 +0000 fx wrote:
FYB> PROBLEM:
FYB> I downloaded the net-snmp 5.7.3 source, compiled and installed snmp 
FYB> on my Ubuntu 16.04. Before this I also installed snmp, snmpd, 
FYB> snmptrapd through apt-get install command.

If you are installing your own, I strongly recommend that you use prefixes to 
completely separate the two installations. e.g.

 --prefix=/usr/local/test \
 --with-persistent-directory=/usr/local/test/var/net-snmp \  
--with-logfile=/usr/local/test/var/log/snmpd.log


FYB> Then, the problem comes again. The /snmp.me/sbin/snmpd also refers 
FYB> to the system config file (/etc/snmp/snmpd.conf). I hope to specify 
FYB> the user config file(/snmp.me/etc/snmpd.conf) by the -c option, But 
FYB> it always failed.

You need the -C option to ignore the default configuration file (or use 
--prefix during configure to change its path).

Robert

------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to