#! /bin/bash # harmless (does not change anything, just checks) script # run anytime as many times as you want to check various system settings . /usr/src/m2/framework/bash_functions.sh k_config_details k_detect_os # ---- VARS ----- VERSION="1.3.8" SCRIPT_NAME="M4 GERD System Check" TEST=0 # 1 - do not execute changes DIR="/usr/src/m2" KF="/usr/src/k_framework" # ---- FUNCTIONS ----- # ---- MAIN ----- k_start report "Updating /usr/src/k_framework" 3 svn update /usr/src/k_framework > /dev/null 2>&1 if [ "$TEST" == "1" ]; then report "***** TEST MODE ON. Changes will not be applied *****" 8 fi if ! k_are_we_root; then report "Run script as root" 1 k_exit 1 fi svn /usr/src/m2 > /dev/null 2>&1 # checks if (( centos_version == 6 )); then echo && cd $KF/checks && ./centos_repos_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi echo && cd $KF/checks/ && ./connections_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./ssh_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./config_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./db_config_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./services_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./various_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./logrotate_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./scripts_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/helpers/zabbix && ./zabbix_agent_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/helpers/sendEmail && ./sendEmail_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./cron_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi # checks memcached on all servers. Allowed only on GUI server by CHECK_SERVER_TYPE option echo && cd $KF/helpers/memcached && ./memcached_check.sh CHECK_SERVER_TYPE res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $GUI_PRESENT == 1 ]]; then echo && cd $DIR/maintenance/checks && ./gui_ssh_connections_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./gui_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./apache_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/helpers/phpmyadmin/ && ./phpmyadmin_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi if [[ $PROXY_PRESENT == 1 ]]; then echo && cd $DIR/helpers/m2_pcap_tshark && ./m2_pcap_tshark_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi if [[ $DB_PRESENT == 1 ]]; then echo && cd $DIR/mysql/partitions && ./partitions_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./db_integrity_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./calls_table_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/helpers/mysql/ && ./mysql_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $MAIN_DB = "1" || $MAIN_DB = "-1" ]]; then echo && $DIR/scripts/go/go_modules_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi fi if [[ $RADIUS_PRESENT == 1 ]]; then echo && cd $DIR/freeradius && ./freeradius_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $DIR/maintenance/checks && ./fail2ban_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $REDIS_ENABLED_CORE == 1 || $REDIS_ENABLED == 1 ]]; then echo && cd $KF/helpers/redis/ && ./redis_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi fi # good to check on any server, because test also checks whole system configuration about ES echo && cd $KF/helpers/elasticsearch && ./es_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi echo && cd $KF/checks && ./packets_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $MEDIA_PRESENT == 1 || $B2BUA_PRESENT == 1 ]]; then report "M4 KSR detected. starting M4 KSR check" 3 cd /usr/src/m4 ./check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi echo && cd $DIR/maintenance/checks && ./security_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi if [[ $PCSD_ACTIVE == 1 ]]; then echo && cd $KF/helpers/corosync && ./corosync_check.sh res=$?;if [[ $res != 0 && $EXIT_CODE != 1 ]]; then EXIT_CODE=$res; fi fi echo k_check_status_update $EXIT_CODE k_exit $EXIT_CODE "Check is happy!" "Check is sad :("