共計(jì) 3685 個(gè)字符,預(yù)計(jì)需要花費(fèi) 10 分鐘才能閱讀完成。
這篇文章主要介紹了 FreeBSD 7.0 上 nagios 如何安裝,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓丸趣 TV 小編帶著大家一起了解一下。
FreeBSD 7.0 上的 nagios 安裝的具體過(guò)程如下:
OS:FreeBSD 7.0
到 http://www.nagios.org/download/ 下載所需的軟件包
1.nagios-3.1.2.tar.gz
2.nagios-plugins-1.4.13.tar.gz
系統(tǒng)需求:
1. Apache
2. GCC 編譯器
3. GD 庫(kù)與開(kāi)發(fā)庫(kù)
以上軟件安裝好后,開(kāi)始安裝 nagios。
1. 解壓縮
#tar zxvf nagios-2.5.tar.gz
2. 建立運(yùn)行 nagios 的用戶:
#pw adduser nagios
#passwd nagios
3. 創(chuàng)建一個(gè)用戶組名為 nagcmd 用于從 Web 接口執(zhí)行外部命令。將 nagios 用戶和 apache 用戶都加到這個(gè)組中。必須確定 web 服務(wù)器以哪個(gè)用戶運(yùn)行的,通常為:apache。我的服務(wù)器配置是 www。
#grep“^User”/usr/local/apache2/conf/httpd.conf
#pw groupadd nagcmd
#pw usermod www -G nagcmd
#pw usermod nagios -G nagcmd
運(yùn)行 Nagios 配置腳本并使用先前開(kāi)設(shè)的用戶及用戶組
# ./configure ndash;prefix=/usr/local/nagios ndash;with-gd-lib=/usr/local/lib ndash;with-gd-inc=/usr/local/include ndash;with-command-group=nagcmd
*** Configuration summary for nagios 3.1.2 06-23-2009 ***:
General Options:
mdash; mdash; mdash; mdash; mdash; mdash; mdash; mdash;-
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /usr/local/etc/rc.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /usr/bin/mail
Host OS: freebsd7.0
Web Interface Options:
mdash; mdash; mdash; mdash; mdash; mdash; mdash; mdash;
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /usr/sbin/traceroute
Review the options above for accuracy. If they look okay,
type lsquo;make all rsquo; to compile the main program and CGIs.
編譯 Nagios 程序包源碼
#make all
安裝二進(jìn)制運(yùn)行程序、初始化腳本、配置文件樣本并設(shè)置運(yùn)行目錄權(quán)限
#make install
運(yùn)行 make install-init 前請(qǐng)檢查 /usr/loca/etc/rc.d 的目錄權(quán)限。我的服務(wù)器是 root:wheel. 而 Makefile 中試 root:root.
修改 Makefile
INIT_DIR=/usr/local/etc/rc.d
INIT_OPTS=-o root -g root
改為:
INIT_DIR=/usr/local/etc/rc.d
INIT_OPTS=-o root -g wheel
然后運(yùn)行 make install-init。
#make install-init
#make install-commandmode
#make install-config
配置 WEB 接口
安裝 Nagios 的 WEB 配置文件到 Apache 的 conf 目錄下。Makefile 文件中 http 的路徑是 /etc/httpd/conf.d。修改為自己 apache 的 conf 路徑。
#make install-webconf
到此 nagios 核心程序安裝完成!
客戶化配置
樣例配置文件默認(rèn)安裝在這個(gè)目錄下 /usr/local/nagios/etc,這些樣例文件可以配置 Nagios 使之正常運(yùn)行,只需要做一個(gè)簡(jiǎn)單的修改 hellip;
用你擅長(zhǎng)的編輯器軟件來(lái)編輯這個(gè) /usr/local/nagios/etc/objects/contacts.cfg 配置文件,更改 email 地址 nagiosadmin 的聯(lián)系人定義信息中的 EMail 信息為你的 EMail 信息以接收?qǐng)?bào)警內(nèi)容。
#vi /usr/local/nagios/etc/objects/contacts.cfg
配置 WEB 接口
配置 apache 的 BASIC 認(rèn)證,創(chuàng)建一個(gè) nagiosadmin 的用戶用于 Nagios 的 WEB 接口登錄。記下你所設(shè)置的登錄口令,一會(huì)兒你會(huì)用到它。
#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
然后修改 apache 的配置文件
#vi /usr/local/apache/conf/httpd.conf
添加如下內(nèi)容:
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName“Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios /usr/local/nagios/share
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName“Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
修改完畢,保存文件,并重啟 apache:
#/usr/local/apahce/bin/apachectl restart
重啟 Apache 服務(wù)以使設(shè)置生效。
編譯并安裝 Nagios 插件
展開(kāi) Nagios 插件的源程序包
#tar xzf nagios-plugins-1.4.13.tar.gz
#cd nagios-plugins-1.4.11
#./configure ndash;with-nagios-user=nagios ndash;with-nagios-group=nagios ndash;prefix=/usr/local/nagios-plugins
#make
#make install
安裝完成以后在 /usr/local/nagios-plugins-plugins 會(huì)產(chǎn)生一個(gè) libexec 的目錄,將該目錄全部移動(dòng)到 /usr/local/nagios 目錄下即可。
#mv /usr/local/nagios-plugins-plugins/libexec/ /usr/local/nagios/
啟動(dòng) Nagios
驗(yàn)證 Nagios 的樣例配置文件
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
出現(xiàn):
Total Warnings: 0
Total Errors: 0
Things look okay ndash; No serious problems were detected during the pre-flight check
配置文件沒(méi)有問(wèn)題。
啟動(dòng) nagios
#/usr/lcoal/etc/rc.d/nagios start
登錄 WEB 接口
你現(xiàn)在可以從 WEB 方式來(lái)接入 Nagios 的 WEB 接口了,你需要在提示下輸入你的用戶名 (nagiosadmin) 和口令,你剛剛設(shè)置的,這里用系統(tǒng)默認(rèn)安裝的瀏覽器,用下面這個(gè)超鏈接
http://localhost/nagios/ 如圖:
感謝你能夠認(rèn)真閱讀完這篇文章,希望丸趣 TV 小編分享的“FreeBSD 7.0 上 nagios 如何安裝”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持丸趣 TV,關(guān)注丸趣 TV 行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!