Sensu 모니터링 설정

5577 단어 Sensu
아래 설정에 근거(※ 사전에 클라이언트에 Ruby 설치 필요)
http://sensuapp.org/docs/0.16/adding_a_check
  • Sensu 설치 단계
  • 서버 측
  • 클라이언트
  • 클라이언트 설정
    sensu-Plugin 설치
    # gem install sensu-plugin --no-rdoc --no-ri
    
    모니터링 스크립트 다운로드
    # wget -O /etc/sensu/plugins/check-procs.rb https://raw.github.com/sensu/sensu-community-plugins/master/plugins/processes/check-procs.rb
    # chmod 755 /etc/sensu/plugins/check-procs.rb
    
    subscriptions 구성
    ※ name/address를 적절히 수정
    # vi /etc/sensu/conf.d/client.json
    
    /etc/sensu/conf.d/client.json
    {
      "client": {
        "name": "Sensu-Client",
        "address": "192.168.xxx.xxx",
    -    "subscriptions": [ "all" ]
    +    "subscriptions": [ "webservers" ]
      }
    }
    
    서버 측 설정
    정의 설정 모니터링
    # vi /etc/sensu/conf.d/check_cron.json
    
    /etc/sensu/conf.d/check_cron.json
    {
      "checks": {
        "cron_check": {
          "handlers": ["default"],
          "command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
          "interval": 60,
          "subscribers": [ "webservers" ]
        }
      }
    }
    
    Sensu 재부팅
    클라이언트
    # service sensu-client restart
    
    서버 측
    # service sensu-server restart
    # service sensu-api restart
    
    로그 확인
    클라이언트
    # grep cron_check /var/log/sensu/sensu-client.log
    {"timestamp":"2015-01-19T21:51:48.042368+0900","level":"info","message":"received check request","check":{"name":"cron_check","issued":1421671843,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}
    {"timestamp":"2015-01-19T21:51:48.129277+0900","level":"info","message":"publishing check result","payload":{"client":"Sensu-Client","check":{"name":"cron_check","issued":1421671843,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","executed":1421671908,"duration":0.086,"output":"CheckProcs OK: Found 1 matching processes; cmd /crond/\n","status":0}}}
    
    서버 측
    # grep cron_check /var/log/sensu/sensu-server.log
    {"timestamp":"2015-01-19T21:51:43.444922+0900","level":"info","message":"publishing check request","payload":{"name":"cron_check","issued":1421671903,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "},"subscribers":["webservers"]}
    
    고장 검측 확인
    크롬을 멈춰봐
    # service crond stop
    
    Dashboard 확인
    http://<Server IP>:3000/#/events

    클라이언트 로그 확인
    # grep cron_check /var/log/sensu/sensu-client.log | tail -2
    {"timestamp":"2015-01-19T21:58:03.577208+0900","level":"info","message":"received check request","check":{"name":"cron_check","issued":1421672203,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 "}}
    {"timestamp":"2015-01-19T21:58:03.663127+0900","level":"info","message":"publishing check result","payload":{"client":"Sensu-Client","check":{"name":"cron_check","issued":1421672203,"command":"/etc/sensu/plugins/check-procs.rb -p crond -C 1 ","executed":1421672283,"duration":0.086,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /crond/\n","status":2}}}
    

    좋은 웹페이지 즐겨찾기