diff --git a/.gitignore b/.gitignore index a3b58e5..12b01d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp /conf/*.conf +/conf/*.conf.* /BAK/* diff --git a/check_webservice_load.sh b/check_webservice_load.sh index 815734f..a6c7bdf 100755 --- a/check_webservice_load.sh +++ b/check_webservice_load.sh @@ -183,6 +183,8 @@ DEFAULT_TIMEOUT_CHECK_PHP=10 DEFAULT_mysql_credential_args="--login-path=local" DEFAULT_mariadb_credential_args="" +DEFAULT_postgresql_port=5432 + if [[ ! -f "$conf_file" ]]; then echo "" echo -e " [ Fatal ] Configuration file '$(basename ${conf_file})' not found!" @@ -202,6 +204,8 @@ fi [[ -n "$mysql_credential_args" ]] || mysql_credential_args="$DEFAULT_mysql_credential_args" [[ -n "$mariadb_credential_args" ]] || mariadb_credential_args="$DEFAULT_mariadb_credential_args" +[[ -n "$postgresql_port" ]] || postgresql_port="$DEFAULT_postgresql_port" + # - Stop here, if these give scripts are running # - @@ -2295,15 +2299,34 @@ if $check_postgresql ; then echo -e "\nChecking PostgreSQL database service on \"`hostname -f`\".." fi - CHILD_PID="$(ps aux | grep -E "\ postgres:\ " | grep -v grep | tail -n 1 | awk '{print$2}')" - PSQL_MAIN_PID="$(ps -o ppid= -p $CHILD_PID 2> /dev/null)" +# CHILD_PID="$(ps aux | grep -E "\ postgres:\ " | grep -v grep | tail -n 1 | awk '{print$2}')" +# PSQL_MAIN_PID="$(ps -o ppid= -p $CHILD_PID 2> /dev/null)" +# +# if [ "X${PSQL_MAIN_PID}X" = "XX" ];then +# +# echo -e "\nPostgreSQL database service is not running! - Try to restart service.." > $LOCK_DIR/extra_msg.txt +# echo -e "======================================================================" >> $LOCK_DIR/extra_msg.txt +# +# error "PostgeSQL database service is not running! - Try to restart service.." +# +# restart_postgresql +# +# else +# +# if $terminal ; then +# ok "PostgreSQL database server on \"`hostname -f`\" seems to be running.." +# fi +# +# fi - if [ "X${PSQL_MAIN_PID}X" = "XX" ];then + $(pg_isready -q -h localhost -p ${postgresql_port} -t 5 2> /dev/null) + + if [[ $? -gt 0 ]] ; then - echo -e "\nPostgreSQL database service is not running! - Try to restart service.." > $LOCK_DIR/extra_msg.txt - echo -e "======================================================================" >> $LOCK_DIR/extra_msg.txt + echo -e "\nPostgreSQL database service is not responding! - Try to restart service.." > $LOCK_DIR/extra_msg.txt + echo -e "=========================================================================" >> $LOCK_DIR/extra_msg.txt - error "PostgeSQL database service is not running! - Try to restart service.." + error "PostgeSQL database service is not responding! - Try to restart service.." restart_postgresql diff --git a/conf/check_webservice_load.conf.sample b/conf/check_webservice_load.conf.sample index 1df043c..9bda9ab 100644 --- a/conf/check_webservice_load.conf.sample +++ b/conf/check_webservice_load.conf.sample @@ -159,6 +159,14 @@ check_website=false #mariadb_credential_args="" +# - Port of PostgreSQL Service +# - +# - defaults to '5432' +# - postgresql_port=5432 +# - +#postgresql_port=5432 + + # - Additional Settings for check_php_fpm # - # - On Linux Vserver System set