Last active
September 25, 2015 05:40
-
-
Save d4rkstar/84714d3848862ca37abf to your computer and use it in GitHub Desktop.
icinga2 corosync check command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INSTRUCTIONS | |
# this script have to run on the server where you have corosync installed. | |
# | |
# 1) download the plugin from https://exchange.nagios.org/directory/Plugins/Clustering-and-High-2DAvailability/Check-CRM/details | |
# 2) put the plugin inside your PluginDir (on ubuntu 14.04 lts is /usr/lib/nagios/plugins/) | |
# 3) on ubuntu 14.04. you'll require apt-get install libnagios-plugin-perl | |
# 4) add these lines to sudoers (visudo): | |
# a) nagios ALL=(ALL) NOPASSWD: /usr/sbin/crm_mon -1 -r -f | |
# b) nagios ALL=(ALL) NOPASSWD: /usr/sbin/crm configure show | |
object CheckCommand "corosync" { | |
import "plugin-check-command" | |
command = [ | |
PluginDir + "/check_crm" | |
] | |
arguments = { | |
"-w" = { | |
set_if = "$crm_warning$" | |
description = "If failed Nodes, stopped Resources detected or Standby Nodes sends Warning instead of Critical (default) as long as there are no other errors and there is Quorum." | |
} | |
"-s" = { | |
value = "$crm_standbyignore$", | |
description = "Ignore any node(s) in standby, by default sends Critical" | |
} | |
"-c" = { | |
value = "$crm_constraints$" | |
description = "Also check configuration for location constraints (caused by migrations) and warn if there are any. " | |
} | |
"-f" = { | |
value = "$crm_failcount$", | |
set_if = {{ return macro("$crm_failcount$") != null }} | |
description = "Resource fail count to start warning on [default = 1]." | |
} | |
"-t" = { | |
value = "$crm_timeout$", | |
set_if = {{ return macro("$crm_timeout$") != null }} | |
description = "Seconds before plugin times out (default: 15)" | |
} | |
} | |
} | |
apply Service "corosync" { | |
import "generic-service" | |
check_command = "corosync" | |
vars.crm_standbyignore = true | |
#vars.crm_constraints = true | |
assign where host.name == NodeName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment