Add PostgreSQL check
This commit is contained in:
parent
9eb77fe941
commit
04fbc78f11
3 changed files with 64 additions and 4 deletions
52
global-templates/commands.conf
Normal file
52
global-templates/commands.conf
Normal file
|
@ -0,0 +1,52 @@
|
|||
// vim: set ft=icinga2 et sw=2 ts=2 si ai:
|
||||
|
||||
/*
|
||||
* Checks a local PostgreSQL database. You need to grant the given user
|
||||
* (normally nagios, which is what Icinga is running as) privileges to connect
|
||||
* the specified database (or 'template1') and optionally execute the specified
|
||||
* query.
|
||||
*/
|
||||
object CheckCommand "pgsql_socket" {
|
||||
command = [ PluginDir + "/check_pgsql" ]
|
||||
|
||||
arguments = {
|
||||
"-d" = {
|
||||
value = "$pgsql_database$"
|
||||
description = "Database to check (default: template1)"
|
||||
}
|
||||
"-l" = {
|
||||
value = "$pgsql_username$"
|
||||
description = "Login name of user"
|
||||
}
|
||||
"-o" = {
|
||||
value = "$pgsql_options$"
|
||||
description = "Connection parameters (keyword = value), see below"
|
||||
}
|
||||
"-w" = {
|
||||
value = "$pgsql_warning$"
|
||||
description = "Response time to result in warning status (seconds)"
|
||||
}
|
||||
"-c" = {
|
||||
value = "$pgsql_critical$"
|
||||
description = "Response time to result in critical status (seconds)"
|
||||
}
|
||||
"-t" = {
|
||||
value = "$pgsql_timeout$"
|
||||
description = "Seconds before connection times out (default: 10)"
|
||||
}
|
||||
"-q" = {
|
||||
value = "$pgsql_query$"
|
||||
description = "SQL query to run. Only first column in first row will be read"
|
||||
}
|
||||
"-W" = {
|
||||
value = "$pgsql_query_warning$"
|
||||
description = "SQL query value to result in warning status (double)"
|
||||
}
|
||||
"-C" = {
|
||||
value = "$pgsql_query_critical$"
|
||||
description = "SQL query value to result in critical status (double)"
|
||||
}
|
||||
}
|
||||
|
||||
vars.pgsql_username = "nagios"
|
||||
}
|
|
@ -18,8 +18,6 @@ apply Service "disk " for (disk => config in host.vars.disks) {
|
|||
check_command = "disk"
|
||||
|
||||
vars += config
|
||||
|
||||
assign where host.vars.disks
|
||||
}
|
||||
|
||||
apply Service for (http_vhost => config in host.vars.http_vhosts) {
|
||||
|
@ -46,6 +44,14 @@ apply Service "load" {
|
|||
assign where host.name == NodeName
|
||||
}
|
||||
|
||||
apply Service "pgsql " for (name => config in host.vars.pgsql_dbs) {
|
||||
import "generic-service"
|
||||
|
||||
check_command = "pgsql_socket"
|
||||
|
||||
vars += config
|
||||
}
|
||||
|
||||
apply Service "ping4" {
|
||||
import "generic-service"
|
||||
|
||||
|
@ -76,8 +82,6 @@ apply Service "proc-" for (proc => config in host.vars.procs) {
|
|||
check_command = "procs"
|
||||
|
||||
vars += config
|
||||
|
||||
assign where host.vars.disks
|
||||
}
|
||||
|
||||
apply Service "ssh" {
|
||||
|
|
|
@ -106,4 +106,8 @@ object Host "beholder" {
|
|||
procs_command = "postgres"
|
||||
procs_critical = "1:50"
|
||||
}
|
||||
|
||||
vars.pgsql_dbs["icingadb"] = {
|
||||
pgsql_query = "SELECT COUNT(*) FROM host"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue