Created
June 25, 2018 09:11
-
-
Save ep4sh/5a34cbbf8f2294766027bfa511623c3a to your computer and use it in GitHub Desktop.
Try to loop in icinga with posgtres clusters and databases
This file contains hidden or 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
apply Service "pg-NOW()-check" { | |
check_command = "pgsql" | |
// var db_dict = { "db1" = 5432, "db2" = 5433, "db3" = 5434, "db4" = 5435 } | |
for (db_key => db_value in db_dict) { | |
//need to out into host file | |
vars.pgsql_hostname = host.address | |
vars.pgsql_database = db_key | |
vars.pgsql_port = db_value | |
// monit user & password | |
vars.pgsql_username = "xxx" | |
vars.pgsql_password = "xxx" | |
vars.pgsql_query = "select now();" | |
vars.pgsql_warning = 2 | |
} | |
assign where host.vars.db_type == "postgres" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment