วันอาทิตย์ที่ 31 พฤษภาคม พ.ศ. 2558

คลิปที่-0033-การตั้งค่า icinga2 โดยใช้งาน nrpe ตรวจสอบ Service

icinga2 สามารถตรวจสอบ Service ได้ทั้งแบบมี Agent และ ไม่มี Agent ซึ่งหากมีการติดตั้ง agent แล้วจะสามารถตรวจสอบเครื่องเป้าหมายได้ละเอียดมากยิ่งขึ้น เช่นการตรวจสอบ CPU,Memory หรือแม้กระทั่งพื้นที่ฮาร์ดดิสก์

คำสั่งที่ใช้ในคลิปนี้
apt-get install icinga-web icinga-web-config-icinga2-ido-mysql
apt-get --no-install-recommends install nagios-nrpe-plugin

ทุกครั้งที่แก้ไขไฟล์คอนฟิก ต้องสั่งรีสตาร์ท Service Icinga2 ทุกครั้ง
service icinga2 restart

สร้างไฟล์คอนฟิกของเครื่องเป้าหมาย
object Host "My-Router" {
  address = "192.168.1.1"
  check_command = "ping4"
}

สร้างไฟล์คอนฟิกสำหรับเครื่องที่เราไม่สามารถควบคุมได้ เช่นเว็บของ Google โดยทำการตรวจสอบ 2 บริการคือ ping และ http
object Host "Google" {
  address = "74.125.130.104"
  check_command = "ping4"
}

object Service "http" {
  host_name = "Google"
  check_command = "http"
}

เพิ่มไฟล์คอนฟิกของไฟล์ commands.conf เพิ่มข้อมูลชุดนี้ไว้ท้ายสุด
object CheckCommand "check_nrpe" {
  import "plugin-check-command"

  command = [
    PluginDir + "/check_nrpe",
    "-H", "$address$",
    "-c", "$remote_nrpe_command$",
  ]
}

สร้างไฟล์คอนฟิกสำหรับเชื่อมต่อกับเครื่องที่ติดตั้ง
// defines the Host as "Win7" as residing at ip address "192.168.1.3"
object Host "Win7" {
  import "generic-host"

  address = "192.168.1.3"
  check_command = "hostalive"

  vars.lan = "example.com"
}

// This services uses "check_nrpe" to connect to port 5666 of the targeted "Win7" hosts and has it execute the "alias_cpu" alias
object Service "load" {
  import "generic-service"

  host_name = "Win7"
  check_command = "check_nrpe"
  vars.remote_nrpe_command = "alias_cpu"
}

// This services uses "check_nrpe" to connect to port 5666 of the targeted "Win7" hosts and has it execute the "alias_disk" alias
object Service "disk" {
  import "generic-service"

  host_name = "Win7"
  check_command = "check_nrpe"
  vars.remote_nrpe_command = "alias_disk"
}

// This services uses "check_nrpe" to connect to port 5666 of the targeted "Win7" hosts and has it execute the "alias_mem" alias
object Service "memory" {
  import "generic-service"

  host_name = "Win7"
  check_command = "check_nrpe"
  vars.remote_nrpe_command = "alias_mem"
}

// This services uses "check_nrpe" to connect to port 5666 of the targeted "Win7" hosts and has it execute the "alias_updates" alias
object Service "udpates" {
  import "generic-service"

  host_name = "Win7"
  check_command = "check_nrpe"
  vars.remote_nrpe_command = "alias_updates"
}
#####################################
ดูคลิปอื่นๆ ได้ที่ youtube : How to IT

ไม่มีความคิดเห็น:

แสดงความคิดเห็น