diff --git a/nagios/README.md b/nagios/README.md index 1b53462..f14c557 100644 --- a/nagios/README.md +++ b/nagios/README.md @@ -162,10 +162,10 @@ This script checks the database replication * How to run this script: * Params: - * 1 - Login used for connection to the database - * 2 - Password used for connection to the database (the password has to be in quotes) - * 3 - List of addresses separated by space (the list has to be in quotes) + * 1 - Path to the configuration + * Requirements: + * Configuration file - Example configuration file: `mariadb_replication_check_config.sh` * Example:
-        ./mariadb_replication_check.sh "USER" "PASSWORD" "Address1 Address2 Address3"
+        ./mariadb_replication_check.sh "mariadb_check_config.sh"
         
diff --git a/nagios/mariadb_replication_check.sh b/nagios/mariadb_replication_check.sh index 2c91959..4a4ada5 100755 --- a/nagios/mariadb_replication_check.sh +++ b/nagios/mariadb_replication_check.sh @@ -1,9 +1,21 @@ #!/bin/bash -USER=$1 -PASSWD=$2 -# List of addresses separated by space -machines=$3 +FILENAME=$1 + +if [ "$#" -ne 1 ]; then + echo "You must enter exactly 1 command line arguments!" + echo "The first param must be the file with the configuration!" + exit 127 +fi + +if [[ ! -f ${FILENAME} ]]; then + echo "File ${FILENAME} doesn't exist." + echo "The first param must be the file with the configuration!" + exit 127 +fi + +source "${FILENAME}" + count=0 for i in ${machines}; do diff --git a/nagios/mariadb_replication_check_config.sh b/nagios/mariadb_replication_check_config.sh new file mode 100644 index 0000000..dc068c2 --- /dev/null +++ b/nagios/mariadb_replication_check_config.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# User +USER="" + +# Password +PASSWD="" + +# List of addresses separated by space +machines="" \ No newline at end of file diff --git a/nagios/proxy_idp_auth_test_oidc.sh b/nagios/proxy_idp_auth_test_oidc.sh index 171b51d..928b951 100755 --- a/nagios/proxy_idp_auth_test_oidc.sh +++ b/nagios/proxy_idp_auth_test_oidc.sh @@ -116,11 +116,13 @@ if [ ${CESNET_RC} -eq 0 ]; then STATUS=0 STATUS_TXT="Successful login!" fi - RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" else - RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" + STATUS=2 + STATUS_TXT="ERROR!" fi +RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" + echo ${RESULT} echo ${RESULT} > ${DIR}/proxy_idp_auth_test_oidc.cache exit 0 diff --git a/nagios/proxy_idp_auth_test_saml.sh b/nagios/proxy_idp_auth_test_saml.sh index 7d31d68..662d5c5 100755 --- a/nagios/proxy_idp_auth_test_saml.sh +++ b/nagios/proxy_idp_auth_test_saml.sh @@ -116,11 +116,13 @@ if [ ${CESNET_RC} -eq 0 ]; then STATUS=0 STATUS_TXT="Successful login!" fi - RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" else - RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" + STATUS=2 + STATUS_TXT="ERROR!" fi +RESULT="${STATUS} ${BASENAME}-${INSTANCE_NAME} aai_login_time=${AAI_LOGIN_TIME}|muni_login_time=${MUNI_LOGIN_TIME}|cesnet_login_time=${CESNET_LOGIN_TIME} ${STATUS_TXT} [AAI STATUS - ${AAI_RESULT}(${AAI_LOGIN_TIME}s);MUNI STATUS - ${MUNI_RESULT}(${MUNI_LOGIN_TIME}s); CESNET STATUS - ${CESNET_RESULT}(${CESNET_LOGIN_TIME}s)]" + echo ${RESULT} echo ${RESULT} > ${DIR}/proxy_idp_auth_test_saml.cache exit 0 diff --git a/nagios/proxy_idp_auth_test_script/oidc_auth_test_aai.sh b/nagios/proxy_idp_auth_test_script/oidc_auth_test_aai.sh index 901e7c7..926795c 100755 --- a/nagios/proxy_idp_auth_test_script/oidc_auth_test_aai.sh +++ b/nagios/proxy_idp_auth_test_script/oidc_auth_test_aai.sh @@ -20,7 +20,6 @@ BASENAME=$(basename $0) ## Get host IP IP=($(hostname -I)) -IP="78.128.216.77" TEST_SITE=$1 diff --git a/nagios/proxy_idp_auth_test_script/saml_auth_test_aai.sh b/nagios/proxy_idp_auth_test_script/saml_auth_test_aai.sh index b1f9cc9..a05512d 100755 --- a/nagios/proxy_idp_auth_test_script/saml_auth_test_aai.sh +++ b/nagios/proxy_idp_auth_test_script/saml_auth_test_aai.sh @@ -20,7 +20,6 @@ BASENAME=$(basename $0) ## Get host IP IP=($(hostname -I)) -IP="78.128.216.77" TEST_SITE=$1 LOGIN_SITE=$2