Nagios+Nconf部署 Nagios croe 源碼安裝 安裝基本環境,軟體包:For RHEL/CentOS users: yum install -y wget httpd php gcc glibc glibc-common gdgd-devel make net-snmp openssl-devel (避免 check_http.c:312:error:’ssl_version’undeclard 錯誤) For Ubuntu users: sudo apt-get install build-essential apache2 php5-gdlibgd2-xpm libgd2-xpm-dev libapache2-mod-php5 libcurl4-openssl-dev(避免 check_http.c:312:error:’ssl_version’undeclard 錯誤) 官網下載穩定版TAR包 Adding the NagiosUser and Group Next add theappropriate user and group for the Nagios process to run: useradd nagios groupadd nagcmd usermod -a -Gnagcmd nagios For RHEL/CentOSusers: ./configure--with-command-group=nagcmd For Ubuntu users: ./configure--with-nagios-group=nagios --with-command-group=nagcmd All systems: make all make install make install-init makeinstall-config makeinstall-commandmode makeinstall-webconf cp -Rcontrib/eventhandlers/ /usr/local/nagios/libexec/ chown -Rnagios:nagios /usr/local/nagios/libexec/eventhandlers /usr/local/nagios/bin/nagios-v /usr/local/nagios/etc/nagios.cfg /etc/init.d/nagiosstart For RHEL/CentOSusers: /etc/init.d/httpdstart Create a DefaultUser for Web Access. Add a default userfor Web Interface Access: htpasswd –c/usr/local/nagios/etc/htpasswd.users nagiosadmin Nagios PluginInstallation cd/tmp/nagios-plugins-1.4.15 ./configure--with-nagios-user=nagios --with-nagios-group=nagios make make install 安裝 nconf web管理配置nagios安裝mysql 資料庫Apt-get installmysql-server-5.5 php5-mysq; 建立資料庫 Create databasenconf 建立使用者並授權設定密碼 GRANTSELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON nconf.* to ‘nconf’@’localhost’identified by ‘nconfadmin’; 匯入nconf 內建資料庫表 Mysql –u root –pnconf < INSTALL/create_datebase.sql 把解壓的nconf 放在 /var/www/ 目錄下 (apache預設網站檔案目錄,可設定其他) http://192.168.1.20/nconf 開始設定 nconf參數 完畢。 PS:這裡可以寫個shell簡單指令碼,來完成nconf設定檔替換的工作,內容如下: #!/bin/bash export PATH cp -p/var/www/nconf/output/NagiosConfig.tgz /usr/local/nagios/etc/ rm -r/usr/local/nagios/etc/Default_collector /usr/local/nagios/etc/global cd/usr/local/nagios/etc/ tar -xvf/usr/local/nagios/etc/NagiosConfig.tgz /etc/init.d/nagiosrestart 根據自己的實際目錄更改此配置。