nagios4.3.2部署安裝

系統(tǒng)版本

[root@localhost ~]# cat /etc/issue
CentOS release 6.9 (Final)

在此演示安裝版本為nagios-4.3.2,nagios-plugins-2.2.1,nrpe-3.2.0(未安裝)

一、nagios-4.3.2 安裝

1.安裝前的依賴檢查

[root@localhost ~]# yum install httpd php gcc glibc glibc-common gd gd-devel
[root@localhost ~]# useradd -m nagios 
[root@localhost ~]# groupadd nagcmd 
[root@localhost ~]# usermod -a -G nagcmd nagios 
[root@localhost ~]# usermod -a -G nagcmd apache

2.解壓

[root@localhost ~]# cd usr/local/src/
[root@localhost src]# tar xvf nagios-4.3.2.tar.gz
[root@localhost src]# cd nagios-4.3.2

3.安裝

[root@localhost nagios-4.3.2]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --with-nagios-user=nagios --with-nagios-group=Nagios

[root@localhost nagios-4.3.2]# make all 
[root@localhost nagios-4.3.2]# make install 
[root@localhost nagios-4.3.2]# make install-init (生成init啟動腳本) 
[root@localhost nagios-4.3.2]# make install-config (生成一些模板配置文件) 
[root@localhost nagios-4.3.2]# make install-commandmode (設(shè)置相應(yīng)的權(quán)限) 
[root@localhost nagios-4.3.2]# make install-webconf (生成Apache配置文件nagios.conf)

4.為Nagios設(shè)置Web驗證的密碼。(注意第一次添加用戶用-c選項,以后再添加千萬別在用這個選項了,會覆蓋以前的所有用戶的。)

[root@localhost nagios-4.3.2]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: 
Re-type new password: 
Adding password for user nagiosadmin

5.設(shè)置nagios的開機(jī)啟動

[root@localhost nagios-4.3.2]# chkconfig --add nagios 
[root@localhost nagios-4.3.2]# chkconfig nagios on
[root@localhost nagios-4.3.2]# chkconfig httpd on

6.關(guān)閉SELinux

[root@localhost nagios-4.3.2]# vi /etc/sysconfig/selinux 

SELINUX=disabled 

二、安裝Nagios的插件nagios-plugin

[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# tar xvf nagios-plugins-2.2.1.tar.gz
[root@localhost src]# cd nagios-plugins-2.2.1
[root@localhost nagios-plugins-2.2.1]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=Nagios
[root@localhost nagios-plugins-2.2.1]# make && make install

三、驗證Nagios的樣例配置文件

[root@localhost nagios-plugins-2.2.1]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.3.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-05-09
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
如果沒有報錯,可以啟動Nagios服務(wù)
service nagios start
使用http://localhost/nagios/來訪問

ps:如果遇到問題?。。?!

如果遇到關(guān)于cgi什么權(quán)限問題!察看下/usr/local/nagios的屬主組權(quán)限,
包括里面的內(nèi)容,
尤其是/usr/local/nagios/etc/htpasswd.users這個文件的權(quán)限!都應(yīng)該是nagios:nagios
另外嘗試編輯
vi /usr/local/nagios/etc/cgi.cfg
use_authentication=1
修改為
use_authentication=0
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容