nagios 安裝備忘
前提, rhel6.2 環境
安裝 lamp 架構,支持 GD 庫
www.nagios.org 下載 nagios-3.5.0.tar.gz
配置前初始化用戶及建立目錄
useradd nagios
mkdir /tmp/nagios /tmp/nagios-temp /var/run/nagios
chown nagios:nagios /tmp/nagios /tmp/nagios-temp /var/run/nagios
注: 官方推薦用戶與執行命令組不一樣 ./configure --with-command-group=nagcmd
編譯參數
./configure --enable-nanosleep --enable-event-broker --enable-embedded-perl --enable-cygwin --enable-libtap --with-nagios-user=nagios --with-nagios-group=nagios --with-command-user=nagios --with-command-group=nagios --with-httpd-conf=/usr/local/apache2/conf/extra/
--with-checkresult-dir=/tmp/nagios --with-temp-dir=/tmp/nagios-temp --with-init-dir=/etc/rc.d/init.d --with-lockfile=/var/run/nagios --with-gd-lib=/usr/local/lib --with-perlcache --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios
編譯提示
General Options:
-------------------------
Nagios executable: nagios.exe
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Embedded Perl: yes, with caching
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: /var/run/nagios
Check result directory: /tmp/nagios
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /usr/local/apache2/conf/extra/
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: https://localhost/nagios/
CGI URL: https://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
安裝過程
make all
make install
( cd base ; cp nagios nagios.exe ; cp nagiostat nagiostat.exe )
( cd /usr/local/nagios/bin ; cp nagios.exe nagios ; cp nagiostat.exe nagiostat )
make install-init
make install-commandmode
make install-config
make install-webconf
make install-exfoliation
make install-classicui
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
檢測安裝是否成功,同樣可以用下麵方法檢測配置文件是否具有錯誤
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios start
創建 nagios 登陸用戶
htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
安裝參數幫助
make install
- This installs the main program, CGIs, and HTML files
make install-init
- This installs the init script in /etc/rc.d/init.d
make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file
make install-config
- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!
make install-webconf
- This installs the Apache config file for the Nagios
web interface
make install-exfoliation
- This installs the Exfoliation theme for the Nagios
web interface
make install-classicui
- This installs the classic theme for the Nagios
web interface
安裝過程需要注意的目錄
command dir
/usr/local/nagios/bin
html dir
/usr/local/nagios/share
daemon dir
/etc/rc.d/init.d/nagios
commandmode dir
/usr/local/nagios/var/rw
web config file
/usr/local/apache2/conf/extra//nagios.conf
exfoliation dir (theme)
/usr/local/nagios/share/stylesheets
/usr/local/nagios/share/images
sample config file
/usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/etc/cgi.cfg
/usr/local/nagios/etc/resource.cfg
/usr/local/nagios/etc/objects/templates.cfg
/usr/local/nagios/etc/objects/commands.cfg
/usr/local/nagios/etc/objects/contacts.cfg
/usr/local/nagios/etc/objects/timeperiods.cfg
/usr/local/nagios/etc/objects/localhost.cfg
/usr/local/nagios/etc/objects/windows.cfg
/usr/local/nagios/etc/objects/printer.cfg
/usr/local/nagios/etc/objects/switch.cfg
可參考 https://support.nagios.com/ 中 nagios core 的安裝文檔
也可以參考 https://nagios.sourceforge.net/docs/3_0/toc.html 中的配置文檔
最後更新:2017-04-03 20:51:31