免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

nagios監(jiān)控系統(tǒng)的快速部署

最近有需求又搞了下nagios記錄下備忘,采用快速安裝lamp方式

創(chuàng)新互聯(lián)公司專注于靖遠網(wǎng)站建設(shè)服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供靖遠營銷型網(wǎng)站建設(shè),靖遠網(wǎng)站制作、靖遠網(wǎng)頁設(shè)計、靖遠網(wǎng)站官網(wǎng)定制、微信小程序定制開發(fā)服務,打造靖遠網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供靖遠網(wǎng)站排名全網(wǎng)營銷落地服務。

1、快速安裝lamp

yum groupinstall "Web Server"

yum groupinstall "MySQL Database"
yum install php-mysql
2、安裝nagios
tar -xjvf nagios-cn-3.2.3.tar.bz2
cd nagios-cn-3.2.3
./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/lib --with-gd-inc=/usr/include --with-nagios-user=nagios --with-nagios-group=nagios
make all && make install
make install-init && make install-commandmode
make install-config
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
3、修改/etc/httpd/conf/httpd.conf
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
<Directory "/usr/local/nagios/sbin">
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios /usr/local/nagios/share
<Directory "/usr/local/nagios/share">
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
 重啟httpd: service httpd restart
4、插件及客戶端安裝
#!/bin/sh
set -x
#if [ -d /usr/local/nagios ]; then
#        rm -rf /usr/local/nagios*
#fi
if [ -d /usr/local/nrpe ]; then
        rm -rf /usr/local/nrpe*
fi
useradd   nagios
yum -y install xinetd
wget -c http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.14/nagios-plugins-1.4.14.tar.gz/download
tar zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure --prefix=/usr/local/nagios --enable-redhat-pthread-workaround
make && make install
chown -R nagios.nagios /usr/local/nagios
cd ../
wget -c http://cdnetworks-kr-1.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --prefix=/usr/local/nagios --enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
cd /etc/xinetd.d/
sed  -i 's/127.0.0.1/127.0.0.1 192.168.120.7/g' nrpe
echo "nrpe            5666/tcp                        # nrpe" >> /etc/services
service xinetd restart
6、添加配置文件在nagios.cfg中
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
注釋#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
7、定義hosts.cfg文件
# Define a host for the local machine
define host{
        use                     standard-server
        host_name               localhost-220
        alias                         localhost
        address                   127.0.0.1
define host{
        use                     standard-server
        host_name          DB
        alias                   192.168.120.3
        address                 192.168.120.3
        }
 
8、定義模版文件templates.cfg
define service{
        name                       service-all
        use                        generic-service 
        contact_groups             admingroup
        register                          0 
        }
define service{
        name                                 generic-service              
        active_checks_enabled                    1                     
        passive_checks_enabled                   1                            
        parallelize_check                        1                          
        obsess_over_service                      1                            
        check_freshness                          0                    
        notifications_enabled                    1                      
        event_handler_enabled                    1                    
        flap_detection_enabled                   1                     
        failure_prediction_enabled               1                    
        process_perf_data                        1                    
        retain_status_information                1                   
        retain_nonstatus_information             1                      
        is_volatile                              0                     
        check_period                            24x7                
        max_check_attempts                       3                      
        normal_check_interval                    3                     
        retry_check_interval                     1                     
        contact_groups                        admingroup                   
        notification_options                   w,c,r                 
        notification_interval                    0                     
        notification_period                     24x7                 
        register                                 0                  
        }

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1               ; Host notifications are enabled
        event_handler_enabled           1               ; Host event handler is enabled
        flap_detection_enabled          1               ; Flap detection is enabled
        failure_prediction_enabled      1               ; Failure prediction is enabled
        process_perf_data               1               ; Process performance data
        retain_status_information       1               ; Retain status information across program restarts
        retain_nonstatus_information    1               ; Retain non-status information across program restarts
        notification_period             24x7            ; Send host notifications at any time
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }

define host{
        name                            standard-server
        use                             generic-host
        check_period                    24x7
        check_interval                  3              
        retry_interval                  1
        max_check_attempts              5              
        check_command                   check-host-alive
        notification_period             24x7                                                       
        notification_interval           0              
        notification_options            d,u,r          
        contact_groups                  admingroup     
        }
9、定義時間文件
# 24x7 monitor
define timeperiod{
        timeperiod_name 24x7
        alias           24 Hours A Day, 7 Days A Week
        sunday          00:00-24:00
        monday          00:00-24:00
        tuesday         00:00-24:00
        wednesday       00:00-24:00
        thursday        00:00-24:00
        friday          00:00-24:00
        saturday        00:00-24:00
        }
# workhours monitor
define timeperiod{
        timeperiod_name workhours
        alias           Normal Work Hours
        monday          09:00-17:00
        tuesday         09:00-17:00
        wednesday       09:00-17:00
        thursday        09:00-17:00
        friday          09:00-17:00
        }
# custom monitor time
define timeperiod{
        timeperiod_name smsworkhours
        alias           no sleep time
        sunday          08:30-23:00
        monday          07:00-23:00
        tuesday         07:00-23:00
        wednesday       07:00-23:00
        thursday        07:00-23:00
        friday          07:00-23:00
        saturday        08:30-23:00
        }
10、定義服務配置文件
define service {
        use                        service-all
        host_name                  localhost-220
        service_description        check-http
        check_command              check_http
        }
define service {
        use                        service-all
        host_name                  localhost-220
        service_description        check-disk
        check_command              check_nrpe!check_disk
        }
define service {
        use                        service-all
        host_name                  localhost-220
        service_description        check-alive
        check_command              check-host-alive
        }
define service {
        use                        service-all
        host_name                  localhost-220
        service_description        check-load
        check_command              check_nrpe!check_load
11、錯誤處理總結(jié)
①#如果提示“Whoops!   Error: Could not read object configuration data! ”,這是因為沒有啟動nagios后臺進程,執(zhí)行以下命令
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg 或者service nagios restart
②It appears as though you do not have permission to view information for any of the services you requested…
解決:打開cgi.cfg配置文件,里面有個參數(shù):
use_authentication=1
為了保障系統(tǒng)的安全性,nagios設(shè)置了這個參數(shù),默認為1,改為0即可

 

分享題目:nagios監(jiān)控系統(tǒng)的快速部署
文章起源:http://m.newbst.com/article12/iidggc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計微信小程序關(guān)鍵詞優(yōu)化App開發(fā)網(wǎng)站策劃網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名