现在的位置: 首页 > 综合 > 正文

Linux下安装net snmp

2018年04月16日 ⁄ 综合 ⁄ 共 3207字 ⁄ 字号 评论关闭

 

1.SNMP 你可以在http://www.net-snmp.org/查得。
snmp的详细安装过程
2安裝前的準備工作
MRTG 為使用 Perl 程式寫成的,並且使用到 zlib 、 gd 及 png 的函式庫(zlib 用來壓縮圖表、gd 用來繪製圖表),且由於 MRTG 乃使用 SNMP 協定,並且最後是以 HTTP 的網頁型態輸出成圖表,因此,你需要確定
Linux 主機中已經含有下列的套件:
perl  (perl-5.0xx 以上)
zlib  (zlib-1.1.3-xx 以上)
gd  (gd-1.3.xx 以上)
libpng
apache
確定的方法就以 RPM 來確認吧:
rpm -qa | grep perl
rpm -qa | grep zlib
rpm -qa | grep gd
rpm -qa | grep libpng
另外的另外,由於 MRTG 的圖表顯示是以 HTTP 的型態(Web 的型態)來顯示的,因此,你也必須安裝好了 Apache 這個套件,如果沒有安裝好的話,請到這個網頁的 Linux 架站文件去看看吧!以下,我們使用了預設的 Apache 路徑,為 /usr/local/apache/htdocs 這個路徑來安裝 mrtg 輸出的圖表,要注意,如果沒有 apache 的話,那就沒有辦法顯示圖表了(雖然可以執行 MRTG !!)
其實在 Linux 安裝完畢之後,上面的幾個(除了 apache 可能會更新之外)套件都已經安裝好了!所以你可以直接來安裝 MRTG 囉!(基本上,我們這個網頁的 RedHat 6.1 已經包含了這些套件了,所以如果你在安裝的時候是選擇 All 的話,那就直接安裝下列的套件吧)

--------------------------------------------------------------------------------

開始安裝 MRTG
由於 MRTG 是透過 SNMP 通訊協定來要求資料,因此你的 Linux 上面需要先安裝相關的軟體,通常我們都是安裝 ucd-snmp 這套軟體的,那就來安裝吧!
下載 ucd-snmp-4.2.1.tar.gz, mrtg-2.9.17.tar.gz ;
  
安裝 ucd-snmp-4.2.1.tar.gz: [root @tsai /root]# cd /usr/local/src
[root @tsai src]# cp /root/ucd-snmp-4.2.1.tar.gz .
[root @tsai src]# tar -zxvf ucd-snmp-4.2.1.tar.gz
[root @tsai src]# cd ucd-snmp-4.2.1
[root @tsai ucd-snmp-4.2.1]# ./configure --prefix=/usr/local/snmp
.......(過程我就省略了)
         ************** Configuration Section **************
        You are about to be prompted by a series of questions.  Answer
them carefully, as they determine how the snmp agent and related
applications are to function.

        After the configure scrīpt finishes, you can browse the newly
created config.h file for further - less important - parameters to
modify.  Be careful if you re-run configure though since config.h will
be over written.

-Press return to continue- (這裡按 enter 吧)

disabling above prompt for future runs...  yes
checking System Contact Information...
  

*** System Contact Information:

        Describes who should be contacted about the host the agent is
running on.  This information is available in the MIB-II tree.  This
Can Also Be Over-Ridden Using The "syscontact" Syntax In The Agent'S
Configuration Files.

System Contact Information (root@):root@tsai.adsldns.org (這裡輸入你的 e-mail)
setting System Contact Information to...  root@tsai.adsldns.org
checking System Location...
  

*** System Location:

        Describes the location of the system.  This information is
available in the MIB-II tree.  This Can also be over-ridden using the
"syslocation" syntax in the agent's configuration files.

System Location (Unknown):RedHat 6.1 (這裡可以隨便輸入,不正確也沒關係)
setting System Location to...  RedHat 6.1
checking Location to write logfile...
  

*** Logfile location:

        Enter the default location for the snmpd agent to dump
information & errors to.  If not defined (enter the keyword "none"
at the prompt below) the agent will use stdout and stderr instead.
(Note: This value can be over-ridden using command line options.)

Location to write logfile (/var/log/snmpd.log):(按 enter 即可)
setting Location to write logfile to...  /var/log/snmpd.log
checking Location to write persistent information...
  

*** snmpd persistent storage location:

        Enter a directory for the snmp library to store persistent
data in the form of a configuration file.

Location to write persistent information (/var/ucd-snmp):(按 enter 即可)

[root @tsai ucd-snmp-4.2.1]# make
[root @tsai ucd-snmp-4.2.1]# make install

上面輸入的資訊,在進行 MRTG 的製圖時,會顯示在圖表上面,不過,這也是可以改的資訊,所以,如果不小心輸入錯誤也沒關係的。這樣就將 ucd-snmp 安裝妥當了!
  
啟動 ucd-snmp :
直接在 shell 下面打上 /usr/local/snmp/sbin/snmpd 即可!或者直接加在 /etc/rc.d/rc.local 當中,就可以自動開機時啟動了

 
启动完成后,你就可以用LR的snmp去监控linux的更详细的内容

 

转自:http://www.51testing.com/?uid-5534-action-viewspace-itemid-10944

抱歉!评论已关闭.