linux嵌入式编程高手历程系列11-net snmp

来源:互联网 发布:linux的dd命令如何退出 编辑:程序博客网 时间:2024/06/05 20:17

    

1。下载netsnmp

官网http://www.net-snmp.org/

目前最新版本是5.4.1,交叉编译有问题。项目使用版本5.2.4。

2。编译安装 

./configure --with-cc=mips-linux-gcc --host=mips-linux --with-ar=mips-linux-ar /
--disable-dlopen --target=mips-linux --disable-dlclose --disable-dlerror --enable-mini-agent /
--with-endianness=little --with-ld=mips-linux-ld /
--with-openssl=no --with-cflags="-O2 -static" /
--oldincludedir=/usr/local --prefix=/usr/local --exec-prefix=/usr/local /
--with-persistent-directory=/usr/local

make

make install   //这一条命令要用root用户执行

文件太大,strip一下。mips-linux-strip snmpd

下面出自官方文档:

QUICK INSTRUCTIONS
==================

  1) Run ./configure
     (type "./configure --help" for a quick usage summary.)
     (--prefix=PATH will change the default /usr/local installation path.)
     (see "Compilers and Options" on changing the compiler to use)

  2) Optionally edit include/net-snmp/net-snmp-config.h
     (due to prompting done by the configure script, this is very rarely
      necessary.)

  3) make

  4) Run the next command as root:
  5) make install

  6) configure the agent
     (either using 'snmpconf' or by crafting an snmpd.conf file manually.
      The file 'EXAMPLE.conf' may be a suitable starting point)

Note: By default, everything will be installed in /usr/local.
      (see below for more instructions)

3。snmpd

将 EXAMPLE.conf文件复制,并重命名为 snmpd.conf

./snmpd -c snmpd.conf &  //运行snmpd

CONFIGURATION FILES

snmpd checks for the existence of and parses the following files:

/usr/local/etc/snmp/snmp.conf
Common configuration for the agent and applications. See snmp.conf(5) for details.
/usr/local/etc/snmp/snmpd.conf
/usr/local/etc/snmp/snmpd.local.conf
Agent-specific configuration. See snmpd.conf(5) for details. These files are optional and may be used to configure access control, trap generation, subagent protocols and much else besides.
In addition to these two configuration files in /usr/local/etc/snmp, the agent will read any files with the names snmpd.conf and snmpd.local.conf in a colon separated path specified in the SNMPCONFPATH environment variable.
/usr/local/share/snmp/mibs/
The agent will also load all files in this directory as MIBs. It will not, however, load any file that begins with a '.' or descend into subdirectories.

 

4.

原创粉丝点击