nagios筆記【搭建】

來源:互聯網
上載者:User

標籤:nagios 安裝 配置

   最近搭建了兩次nagios,第一次工作忙碌沒有記錄下過程;這次抽了時間簡單的記錄了搭建過程。

   系統版本:centos 6.3 64位

   軟體版本:nagios-3.4.3.tar.gz

                   nagios-plugins-1.4.16.tar.gz

                   nrpe.tar.gz

                   httpd-2.2.23.tar.gz

                   php-5.4.10.tar.gz

    這次嘗試了利用yum安裝的http,php;可惜到最後沒有成功,鑒於老大那裡急著要只有編譯安裝了httpd和php(nagios3.0版本需要php的支援)。

開始:

    1:檢查依賴安裝

rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel如果沒有安裝請執行:yum -y install gcc glibc glibc-common gd gd-devel xinetd openssl-devel

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/48/4E/wKiom1QGzcTTkITqAAIC7Jqq1Qo350.jpg" title="1.jpg" alt="wKiom1QGzcTTkITqAAIC7Jqq1Qo350.jpg" />  2:安裝httpd和php

HHTPD:cd /opttar zxvf  httpd-2.2.23.tar.gz   cd httpd-2.2.23 ./configure --prefix=/usr/local/services/apache2make make install PHP:cd ../tar  zxvf php-5.4.10.tar.gz  cd php-5.4.10 ./configure --prefix=/usr/local/services/php --with-apxs2=/usr/local/services/apache2/bin/apxsmake make install

3:安裝 nagios-plugins和nrpe

cd /opt建立nagios帳號groupadd  nagiosuseradd   nagios  -s /sbin/nologin -g nagioscat  /etc/passwd  | grep "nagios"nrpe的啟動指令碼:mv  nrpe    /etc/init.d/chmod 755 /etc/init.d/nrpe安裝nagios-pluginstar xf nagios-plugins-1.4.16.tar.gzcd ./nagios-plugins./configure --prefix=/usr/local/services/nagios --with-nagios-group=nagios --with-nagios-user=nagiosmake && make install安裝nrpecd  /opttar xf nrpe.tar.gzcd ./nrpe./configure --prefix=/usr/local/services/nagios make all make install && make install-plugin && make install-daemon && make install-daemon-config


4:安裝nagios

cd /opt/tar zxvf nagios-3.4.3.tar.gzcd nagios./configure --prefix=/usr/local/services/nagios

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/48/51/wKioL1QG0dzhcTu8AANEjuirN8A796.jpg" title="3configure.jpg" alt="wKioL1QG0dzhcTu8AANEjuirN8A796.jpg" />

make all

 650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/50/wKiom1QG0lbT2lm2AAOVv15gWH4401.jpg" title="4make all.jpg" alt="wKiom1QG0lbT2lm2AAOVv15gWH4401.jpg" />

make install

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/51/wKioL1QG0tbCBRj3AAKNejA56UA714.jpg" title="5make_install .jpg" alt="wKioL1QG0tbCBRj3AAKNejA56UA714.jpg" />

make install-init

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/50/wKiom1QG0yigThUaAAERcNl60_Y748.jpg" title="6.jpg" alt="wKiom1QG0yigThUaAAERcNl60_Y748.jpg" />

make install-commandmodemake install-config

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/50/wKiom1QG002hBUi0AAeiRm_WlsU844.jpg" title="7install-commandmode.jpg" alt="wKiom1QG002hBUi0AAeiRm_WlsU844.jpg" />

chkconfig --add nagioschkconfig --level 35 nagios onchkconfig --list nagios

5:設定登陸web控制台帳號密碼

 /usr/local/services/apache2/bin/htpasswd -c /usr/local/services/nagios/etc/htpasswd user

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/50/wKiom1QG1FDTOBVjAAD1lEL5Ru4891.jpg" title="8.jpg" alt="wKiom1QG1FDTOBVjAAD1lEL5Ru4891.jpg" />5:配置httpd.conf

修改1:Listen 80 (不是必須要修改)User nagiosGroup nagios修改2:ServerName  1.1.1.1:80 (連接埠不是必須要修改)修改3:<IfModule dir_module>    DirectoryIndex index.html index.php    AddType application/x-httpd-php .php</IfModule>在httpd.conf最後添加:ScriptAlias /nagios/cgi-bin "/usr/local/services/nagios/sbin" <Directory "/usr/local/services/nagios/sbin">      AuthType Basic      Options ExecCGI      AllowOverride None      Order allow,deny      Allow from all      AuthName "Nagios Access"      AuthUserFile /usr/local/services/nagios/etc/htpasswd                  Require valid-user </Directory> Alias /nagios "/usr/local/services/nagios/share" <Directory "/usr/local/services/nagios/share">      AuthType Basic      Options None      AllowOverride None      Order allow,deny      Allow from all      AuthName "nagios Access"      AuthUserFile /usr/local/services/nagios/etc/htpasswd      Require valid-user </Directory>啟動httpd/usr/local/services/apache2/bin/apachectl start

 6:訪問配置好的URL

  650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/48/52/wKioL1QG1jHiOnN1AAMQW1owhTM335.jpg" title="9.jpg" alt="wKioL1QG1jHiOnN1AAMQW1owhTM335.jpg" />


所有軟體都可以在我的百度雲端硬碟下載:

連結:http://pan.baidu.com/s/1ntogYIP 密碼:m5dq

本文出自 “在路上” 部落格,請務必保留此出處http://jweiang.blog.51cto.com/8059417/1548378

nagios筆記【搭建】

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.