icingaはNSCAでリモートLinuxサーバを監視する

7547 ワード

前の2編に続き、.111上のicingaのサーバが構築され、リモート.131 LinuxサーバのHTTPサービスが監視されています.
HTTPサービスはpublicサービスに属するため、リモートマシンにagentをインストールする必要はありませんが、ディスク、CPUなどのローカルリソースを監視する必要がある場合は、ソフトウェアをインストールする必要があります.
icingaは2つのモードを提供し、1つはactive checkと呼ばれ、server.111ポーリング.131であり、この効率は行わず、推奨されない.もう1つのモードはpassive checkで、リモートagentのメッセージ送信を待つことです.
NSCAプラグインとicingaを併用するとこの効果が得られます.これはお勧めですが、残念ながら、このプロジェクトは去年から中止になりました.続けたいなら、自分で来なければなりません.
まず使い方を見てみましょう.このドキュメントは、インストールと使用に役立ちます.http://docs.icinga.org/latest/en/nsca.html
要点だけを言います.
1.実行時
./nsca -c ../sample-config/nsca.cfg

権限が不足している場合は、単純にchmod-R 777でそのディレクトリ権限を直接変更します.
2.10.3.6でxinetd方式を選択し、Ubuntuの下でまずインストールする.
apt-et install xinetd

次に/etc/hostsを編集します.allowファイル、行を追加:
ALL: 10.112.18.131

3.一部のファイルをコピーした131マシン上で、incingaユーザーを作成する必要はなく、rootで直接テストできる
4...11 icinga server上linux.cfgファイルの構成は以下の通りです.
define host{
        use             linux-server            ; Inherit default values from a template
        host_name       StaticFileServer              ; The name we're giving to this host                                                                                       
        alias           static filer server for 3D and jenksins server for CloudEngine        ; A longer name associated with the host                                           
        address         10.112.18.131            ; IP address of the host                                                                                                        
        contact_groups  admins                ; Host groups this host is associated with                                                                                         
        }                                                                                                                                                                        
                                                                                                                                                                                 
# check that web services are running                                                                                                                                            
define service{                                                                                                                                                                  
        host_name                  StaticFileServer                                                                                                                              
        service_description             HTTP                                                                                                                                     
        check_command                   check_http                                                                                                                               
        use                             generic-service                                                                                                                          
        action_url                      http://10.112.18.131/ArcGIS/rest/services/SanFrancisco/3DFeatureServer                                                                   
        notification_interval           0 ; set > 0 if you want to be renotified                                                                                                 
}                                                                                                                                                                                
                                                                                                                                                                                 
define service{                                                                                                                                                                  
    use                     generic-service   ; template to inherit from                                                                                                         
    name                    passive-service   ; name of this template                                                                                                            
    active_checks_enabled   0                 ; no active checks                                                                                                                 
    passive_checks_enabled  1                 ; allow passive checks                                                                                                             
    check_command           check_dummy!0     ; use "check_dummy", RC=0 (OK)                                                                                                     
    check_period            24x7              ; check active all the time                                                                                                        
    check_freshness         0                 ; do not check if check result is stale                                                                                            
    register                0                 ; this is a template, not a real service                                                                                           
    }                                                                                                                                                                            
                                                                                                                                                                                 
define service{                                                                                                                                                                  
    use                     passive-service   ; template to inherit from                                                                                                         
    host_name               StaticFileServer        ; host where send_nsca is located                                                                                            
    service_description     Diskspace         ; service to be checked                                                                                                            
    }     

5.ログファイルの場所:/usr/local/icinga/var/icinga.log
6. commands.cfgではcheck_が定義されていますdummyコマンド、変更不要
7..131でコマンドテスト送信データを実行する:
echo -e "StaticFileServer\tDiskspace\t0\t/var=78%
" | /usr/local/icinga/bin/send_nsca -H 10.112.18.111 -c /usr/local/icinga/etc/send_nsca.cfg

注意StaticFileServerの大文字と小文字は間違ってはいけません./var=78%は送信された情報です.
-Hの後ろにはicinga serverのIPアドレスがあります
8.最後にログを見てみましょう.
[1368620324] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;StaticFileServer;Diskspace;0;/var=78%
[1368620332] PASSIVE SERVICE CHECK: StaticFileServer;Diskspace;0;/var=78%

9.Webページにも1行のレコードが表示されます.
でも文章を書くと見えないので、icingaには詳しくないでしょう.後で見つけてからスクリーンショットします.
まとめ:NSCAは監視端末がサーバにメッセージを送信する通信問題を解決し、監視スクリプトは自分で作成し、データを収集する.そのため、このアーキテクチャは柔軟で、勝手に発揮することができます.しかし、やることは少なくありません.後で全体的な解決策を試します.Check_MKは、この上で二次開発できれば、機能は非常に強力です.