Showing posts with label icinga2. Show all posts
Showing posts with label icinga2. Show all posts

Icinga2 HTTPS and ssl key expiration check

Create a host file in /etc/icinga2/conf.d/hosts eg website-ripe.conf

Create the host details
object Host "website-ripe" {
  import "generic-host"
  address = "ripe.net"
  address6 = "::1"
  vars.os = "Linux"
  vars.sla = "24x7"
}


How to monitor a website over SSL (service)
object Service "httpS" {
  host_name = "website-ripe"
  vars.http_vhost = "ripe.net"
  vars.http_address = "193.0.6.139"
  vars.http_ssl = "1"
  vars.http_sni = "1"
  vars.http_warn_time = "5"
  vars.http_critical_time = "10"
  check_command = "http"
}

Monitoring the SSL key expiration date, give warning 30 before and alert at 14 days before. (service)
object Service "website-ripe-key-expire"{
  host_name = "website-ripe"
  check_command = "check-ssl-exp"
  vars.days = 30,14
  vars.url = "ripe.net"
}
Because it's not a default check -the -C (certificate) parameter is not available in Icinga- we need to create a custom checkCommand
object CheckCommand "check-ssl-exp" {
import "plugin-check-command"
command = PluginDir + "/check_http -H $url$ -C$daysquot;
}



Error:
[2014-07-30 12:58:00 +0200] critical/config:
Config error: Invalid value for attribute: Object 'check_ssl' (Type: 'CheckCommand') at /etc/icinga2/conf.d/hosts/website-ripe.conf:28 -> Attribute 'methods'
[2014-07-30 12:58:00 +0200] critical/config: 1 errors, 0 warnings.

Solution:
add   import "plugin-check-command" ot the oject checkcommand section.

Icinga2 disable ping checks on specific hosts

Problem:

You have a server which does not answer ping etc.
Icinga2 marks the host as critical and you want to get rid of it.
Solution

By default, Icinga2 applies to every host the service ping4 or ping6 (depending on the address). This is done with an apply rule in
 /etc/icinga2/conf.d/services.conf:
apply Service "ping4" {
import "generic-service"
check_command = "ping4"
assign where host.address
}

To disable it for two specific host you only have to add an ignore rule (ping4):

ignore where match("x.x.x.x", host.address) || match("y.y.y.y", host.address)

example:-

ignore where match("1.2.3.4", host.address) || match("5.6.7.8", host.address)