Icinga2监控web、mysql状态


Icinga2监控web状态


# vi /etc/icinga2/conf.d/templates.conf


object CheckCommand "check-http" {

  import "plugin-check-command"

  command = [ PluginDir + "/check_http" ]

  arguments = {

  "-I" = "$address$"

  "-u" = "$url$"

  "-p" = "$port$"

    }

}


:wq


# vi /etc/icinga2/conf.d/services.conf


apply Service "check_hudson" {

  import "generic-service"

  check_command = "check-http"

  vars.url="http://$address$:8080/jenkins"      (此处也可写$hostname$)

  vars.port="8080"

  vars.perf = true

  assign where host.vars.os == "shhudson"

}


:wq


# service icinga2 restart


此时icinga2页面即会有web的监控






Icinga2监控mysql状态


# vi /etc/icinga2/conf.d/templates.conf


object CheckCommand "check-mysql" {

  import "plugin-check-command"

  command = [ PluginDir + "/check_mysql" ]

  arguments = {

  "-d" = "$db$"

  "-H" = "$address$"

  "-u" = "$user$"

  "-p" = "$pass$"

    }

}


:wq


# vi /etc/icinga2/conf.d/services.conf


apply Service "check_icinga2db" {

  import "generic-service"

  check_command = "check-mysql"

  vars.db="icinga"

  vars.user="iccheck"

  vars.pass="*****"

  vars.perf = true

  assign where  host.address == "10.0.0.5"

}


:wq


# service icinga2 restart


此时icinga2页面即会有mysql的监控




你可能感兴趣的:(http,check)