安裝配置整理之 net-snmp

來源:互聯網
上載者:User

標籤:local

安裝

在http://www.net-snmp.org/download.html選擇最新版本進行下載

wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6/net-snmp-5.6.tar.gz

tar -xvf net-snmp-5.6.tar.gz

cd net-snmp-5.6

./configure --prefix=/usr/local/net-snmp --with-default-snmp-version="2" --with-logfile=/usr/local/net-snmp/log/snmplog.log --with-persistent-directory=/var/net-snmp

注
--prefix 安裝的路徑
--with-default-snmp-version 預設的版本
--with-logfile 記錄檔的路徑
--with-persistent-directory 固定資料存放區目錄


make && make install

cp EXAPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf

vi snmpd.conf

60 #       sec.name  source          community
61 com2sec local     localhost       COMMUNITY
62 com2sec mynetwork NETWORK/24      COMMUNITY



修改為    

60 #       sec.name  source          community
61 com2sec local     localhost       public
62 com2sec mynetwork NETWORK/24      public

把裡面的mynetwork/24 改成需要查看snmp資訊的主機ip 地址

   把community 改成你設定的值

   然後儲存退出



編輯/etc/rc.local添加為自啟動  
  添加下面一行:
  /usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf &
設定環境變數,編輯/etc/profile
  在export前添加下面一行
  PATH=/usr/local/net-snmp/bin:/usr/local/net-snmp/sbin:$PATH

檢查

使用 ps -aux | grep snmpd查看snmpd的進程是否啟動
netstat -an |grep 161 //查看snmp是否啟動

使用如下命令從本機檢查snmp是否得到系統資料

snmpwalk -v 2c -c public localhost

如果返回的不是Time out,而是系統資訊就說明net-snmp安裝成功


本文出自 “王升的遊泳池” 部落格,請務必保留此出處http://wangsheng1.blog.51cto.com/29473/1594828

安裝配置整理之 net-snmp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.