X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_postgres_database_count;fp=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_postgres_database_count;h=0000000000000000000000000000000000000000;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hp=43bdd8cec22c7d67f759f99d28aea549d9c06a04;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/monitoring/plugins/check_postgres_database_count b/modules/private/monitoring/plugins/check_postgres_database_count deleted file mode 100755 index 43bdd8c..0000000 --- a/modules/private/monitoring/plugins/check_postgres_database_count +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -STATE_OK=0 -STATE_WARNING=1 -STATE_CRITICAL=2 -STATE_UNKNOWN=3 - -host=$1 -port=$2 -min=$3 - -count=$(psql -h $host -p $port -A -q -c '\t' -c 'select count(datname) from pg_catalog.pg_database' postgres 2>&1) -exit_code=$? - -if [[ $exit_code -ne 0 ]]; then - echo "UNKNOWN - Impossible to run psql command: $count" - exit $STATE_UNKNOWN -elif [[ -z "$count" ]]; then - echo "UNKNOWN - No database found" - exit $STATE_UNKNOWN -else - output="Database count is $count" - LC_ALL=C count=$(printf "%.*f" 0 $count) - - if [[ $count -gt $min ]]; then - echo "OK - $output | count=${count};$min;$min;0;" - exit $STATE_OK - else - echo "CRITICAL - $output | count=${count};$min;$min;0;" - exit $STATE_CRITICAL - fi -fi