check_local_elasticsearch_service.sh: changedefault values for timeout variables;

This commit is contained in:
Christoph 2024-04-26 10:44:57 +02:00
parent 6c43433c50
commit 4b77adbd93
2 changed files with 214 additions and 3 deletions

View File

@ -188,8 +188,8 @@ reboot_system() {
# Some default values
#
DEFAULT_NUMBER_LINES=20
DEFAULT_TIME_OUT=20
DEFAULT_CONNECT_TIMEOUT=5
DEFAULT_TIME_OUT=5
DEFAULT_CONNECT_TIMEOUT=4
DEFAULT_LOCAL_ES_SERVICE_TO_CHECK="http://localhost:9200/_cluster/health"
#DEFAULT_CONFLICTING_SCRIPTS="/root/bin/monitoring/check_webservice_load.sh"
@ -462,7 +462,7 @@ if [[ ! -f "$RESTART_CHECK_FILE" ]]; then
error "The local Elasticsearch Service seems to be down."
if $LOGGING ; then
echo -e "\n \033[1mFirst we try to restore the system. If this is not successful,\n the system will be restarted in about 5 minutes.\033[m"
echo -e "\n \033[1mFirst we try to restart the service. If this is not successful,\n the system will be restarted in about 5 minutes.\033[m"
else
echo ""
echo "First we try to restore the system. If this is not successful,"

View File

@ -0,0 +1,211 @@
#---------------------------------------
#-----------------------------
# Settings
#-----------------------------
#---------------------------------------
# ---
# - LOGGING
# -
# - This Parameter is now obsolete. If script is running in a terminal, then output ist verbose,
# - the output will be verbos. If running as cronjob, output will only be written, if warnings or
# - errors occurs.
# ---
# - What to check
# -
check_load=true
check_mysql=false
# - PostgreSQL
# -
# - NOT useful, if more than one PostgreSQL instances are running!
# -
check_postgresql=false
check_apache=true
check_nginx=false
check_php_fpm=false
check_redis=true
check_website=false
# - If service is not listen on 127.0.0.1/loclhost, curl check must
# - be ommited
# -
# - Defaults to: ommit_curl_check_nginx=false
# -
#ommit_curl_check_nginx=false
# - Is this a vserver guest machine?
# -
# - Not VSerber guest host does not support systemd!
# -
# - defaults to: vserver_guest=false
# -
#vserver_guest=false
# - Additional Settings for check_mysql
# -
# - MySQL / MariaDB credentials
# -
# - Giving password on command line is insecure an sind mysql 5.5
# - you will get a warning doing so.
# -
# - Reading username/password fro file ist also possible, using MySQL/MariaDB
# - commandline parameter '--defaults-file'.
# -
# - Since Mysql Version 5.6, you can read username/password from
# - encrypted file.
# -
# - Create (encrypted) option file:
# - $ mysql_config_editor set --login-path=local --socket=/tmp/mysql.sock --user=root --password
# - $ Password:
# -
# - Use of option file:
# - $ mysql --login-path=local ...
# -
# - Example
# - mysql_credential_args="--login-path=local"
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
# -
mysql_credential_args=""
# - Additional Settings for check_php_fpm
# -
# - On Linux Vserver System set
# - curl_check_host=localhost
# -
# - On LX-Container set
# - curl_check_host=127.0.0.1
# -
curl_check_host=127.0.0.1
# - Which PHP versions should be supported by this script. If more than one,
# - give a blank separated list
# -
# - Example:
# - php_versions="5.4 5.6 7.0 7.1"
# -
php_versions=""
# - If PHP-FPM's ping.path setting does not match ping-$php_major_version,
# - set the value given in your ping.path setting here. Give ping_path also
# - the concerning php_version in form
# - <php-version>:<ping-path>
# -
# - Multiple settings are possible, give a blank separated list.
# -
# - Example:
# -
# - ping_path="5.4:ping-site36_net 5.6:ping-oopen_de"
# -
ping_path=""
# - Additional Settings for check_website - checking (expected) website response
# -
# - example:
# - is_working_url="https://www.outoflineshop.de/"
# - check_string='ool-account-links'
# - include_cleanup_function=true
# - extra_alert_address="ilker@so36.net"
# - cleanup_function='
# - rm -rf /var/www/www.outoflineshop.de/htdocs/var/cache/*
# - rm -rf /var/www/www.outoflineshop.de/htdocs/var/session/*
# - /usr/local/bin/redis-cli flushall > /dev/null 2>&1
# - if [[ "$?" = "0" ]]; then
# - ok "I have cleaned up directory \"/var/www/www.outoflineshop.de/htdocs/var/cache/\""
# - else
# - error "Cleaning up directory \"/var/www/www.outoflineshop.de/htdocs/var/cache/\" failed!"
# - fi
# - /etc/init.d/redis_6379 restart
# - if [[ "$?" = "0" ]]; then
# - ok "I restarted the redis service"
# - echo -e "\t[ Ok ]: I restarted the redis service" >> $LOCK_DIR/extra_msg.txt
# - else
# - error "Restarting the redis server failed!"
# - echo -e "\t[ Error ]: Restarting the redis server failed!" >> $LOCK_DIR/extra_msg.txt
# - fi
# - '
# -
is_working_url='https://www.outoflineshop.de/'
check_string='ool-account-links'
include_cleanup_function=true
# - An extra e-mail address, which will be informed, if the given check URL
# - does not response as expected (check_string) AFTER script checking, restarting
# - servervices (webserver, php-fpm) and cleaning up (cleanup_function) was done.
# -
extra_alert_address='ilker@so36.net'
# - php_version_of_working_url
# -
# - If given website (is_working_url) does not response as expected, this PHP FPM
# - engines will be restarted.
# -
# - Type "None" if site does not support php
# -
# - If php_version_of_working_url is not set, PHP FPM processes of ALL versions (php_versions)
# - will be restarted
# -
php_version_of_working_url='None'
# - Notice:
# - If single qoutes "'" not needed inside cleanup function, then use single quotes
# - to enclose variable "cleanup_function". Then you don't have do masquerade any
# - sign inside.
# -
# - Otherwise use double quotes and masq any sign to prevent bash from interpreting.
# -
cleanup_function='
rm -r /var/www/www.outoflineshop.de/htdocs/var/cache/* > /dev/null 2>&1
if [[ "$?" = "0" ]]; then
ok "I have cleaned up directory \"/var/www/www.outoflineshop.de/htdocs/var/cache/\""
echo -e "\n\t[ Ok ]: Cache file directory successfully cleaned up." >> $LOCK_DIR/extra_msg.txt
else
error "Cleaning up directory \"/var/www/www.outoflineshop.de/htdocs/var/cache/\" failed!"
echo -e "\n\t[ Error ]: Cleaning up cache file directory failed !!!" >> $LOCK_DIR/extra_msg.txt
fi
rm -r /var/www/www.outoflineshop.de/htdocs/var/session/* > /dev/null 2>&1
if [[ "$?" = "0" ]]; then
ok "I have cleaned up directory \"/var/www/www.outoflineshop.de/htdocs/var/session/\""
echo -e "\t[ Ok ]: Session file directory successfully cleaned up." >> $LOCK_DIR/extra_msg.txt
else
error "Cleaning up directory \"/var/www/www.outoflineshop.de/htdocs/var/session/\" failed!"
echo -e "\t[ Error ]: Cleaning up session file directory failed !!!" >> $LOCK_DIR/extra_msg.txt
fi
/usr/bin/redis-cli flushall > /dev/null 2>&1
if [[ "$?" = "0" ]]; then
ok "I flushed the redis server"
echo -e "\t[ Ok ]: I flushed the redis server" >> $LOCK_DIR/extra_msg.txt
else
error "Flushing the redis server failed!"
echo -e "\t[ Error ]: Flushing the redis server failed!" >> $LOCK_DIR/extra_msg.txt
fi
systemctl restart redis-server > /dev/null 2>&1
if [[ "$?" = "0" ]]; then
ok "I restarted the redis service"
echo -e "\t[ Ok ]: I restarted the redis service" >> $LOCK_DIR/extra_msg.txt
else
error "Restarting the redis server failed!"
echo -e "\t[ Error ]: Restarting the redis server failed!" >> $LOCK_DIR/extra_msg.txt
fi
'
# - E-Mail settings for sending script messages
# -
from_address="root@`hostname -f`"
content_type='Content-Type: text/plain;\n charset="utf-8"'
to_addresses="root"