How to – Optimize your database using the MySQL tuning tool

MySQL tuning

How to – Optimize your database using the MySQL tuning tool

This article will go over how to optimize your database using the mysql-tuning tool included in your extras directory. The great thing about this tool is you can keep using it. You can use it after your initial install all the way through your finished using ViciDial.

MySQL tuning

Step 1 – Change your location to the extras directory

First we need to change our location to the extras directory for astguiclient with the commands below:

cd /usr/src/astguiclient/trunk/extras

Step 2 – Give mysql-tuning.sh executable permissions

The file we need to use is mysql-tuning.sh and by default it’s not executable, so we need to give it that permission. You can do this simply by typing:

chmod +x mysql-tuning.sh

Step 3 – Run the tuner

Now you can run the tuning program by typing:

./mysql-tuning.sh

MySQL tuning

If it tells you that you have an unsupported version of MySQL, copy and paste the code below into a file called MyTuner.sh:

#!/bin/sh

# vim: ts=8
#########################################################################
#                                                                       #
#       MySQL performance tuning primer script                          #
#       Writen by: Matthew Montgomery                                   #
#       Report bugs to: https://bugs.launchpad.net/mysql-tuning-primer  #
#       Inspired by: MySQLARd (http://gert.sos.be/demo/mysqlar/)        #
#       Version: 1.6-r1         Released: 2011-08-06                    #
#       Licenced under GPLv2                                            #
#                                                                       #
#########################################################################

#########################################################################
#                                                                       #
#       Usage: ./tuning-primer.sh [ mode ]                              #
#                                                                       #
#       Available Modes:                                                #
#               all :           perform all checks (default)            #
#               prompt :        prompt for login credintials and socket #
#                               and execution mode                      #
#               mem, memory :   run checks for tunable options which    #
#                               effect memory usage                     #
#               disk, file :    run checks for options which effect     #
#                               i/o performance or file handle limits   #
#               innodb :        run InnoDB checks /* to be improved */  #
#               misc :          run checks for that don't categorise    #
#                               well Slow Queries, Binary logs,         #
#                               Used Connections and Worker Threads     #
#########################################################################
#                                                                       #
# Set this socket variable ONLY if you have multiple instances running  #
# or we are unable to find your socket, and you don't want to to be     #
# prompted for input each time you run this script.                     #
#                                                                       #
#########################################################################
socket=

export black='\033[0m'
export boldblack='\033[1;0m'
export red='\033[31m'
export boldred='\033[1;31m'
export green='\033[32m'
export boldgreen='\033[1;32m'
export yellow='\033[33m'
export boldyellow='\033[1;33m'
export blue='\033[34m'
export boldblue='\033[1;34m'
export magenta='\033[35m'
export boldmagenta='\033[1;35m'
export cyan='\033[36m'
export boldcyan='\033[1;36m'
export white='\033[37m'
export boldwhite='\033[1;37m'


cecho ()

## -- Function to easliy print colored text -- ##

        # Color-echo.
        # Argument $1 = message
        # Argument $2 = color
{
local default_msg="No message passed."

message=${1:-$default_msg}      # Defaults to default message.

#change it for fun
#We use pure names
color=${2:-black}               # Defaults to black, if not specified.

case $color in
        black)
                 printf "$black" ;;
        boldblack)
                 printf "$boldblack" ;;
        red)
                 printf "$red" ;;
        boldred)
                 printf "$boldred" ;;
        green)
                 printf "$green" ;;
        boldgreen)
                 printf "$boldgreen" ;;
        yellow)
                 printf "$yellow" ;;
        boldyellow)
                 printf "$boldyellow" ;;
        blue)
                 printf "$blue" ;;
        boldblue)
                 printf "$boldblue" ;;
        magenta)
                 printf "$magenta" ;;
        boldmagenta)
                 printf "$boldmagenta" ;;
        cyan)
                 printf "$cyan" ;;
        boldcyan)
                 printf "$boldcyan" ;;
        white)
                 printf "$white" ;;
        boldwhite)
                 printf "$boldwhite" ;;
esac
  printf "%s\n"  "$message"
  tput sgr0                     # Reset to normal.
  printf "$black"

return
}


cechon ()

## -- Function to easliy print colored text -- ##

        # Color-echo.
        # Argument $1 = message
        # Argument $2 = color
{
local default_msg="No message passed."
                                # Doesn't really need to be a local variable.

message=${1:-$default_msg}      # Defaults to default message.

#change it for fun
#We use pure names
color=${2:-black}               # Defaults to black, if not specified.

case $color in
        black)
                printf "$black" ;;
        boldblack)
                printf "$boldblack" ;;
        red)
                printf "$red" ;;
        boldred)
                printf "$boldred" ;;
        green)
                printf "$green" ;;
        boldgreen)
                printf "$boldgreen" ;;
        yellow)
                printf "$yellow" ;;
        boldyellow)
                printf "$boldyellow" ;;
        blue)
                printf "$blue" ;;
        boldblue)
                printf "$boldblue" ;;
        magenta)
                printf "$magenta" ;;
        boldmagenta)
                printf "$boldmagenta" ;;
        cyan)
                printf "$cyan" ;;
        boldcyan)
                printf "$boldcyan" ;;
        white)
                printf "$white" ;;
        boldwhite)
                printf "$boldwhite" ;;
esac
  printf "%s"  "$message"
  tput sgr0                     # Reset to normal.
  printf "$black"

return
}


print_banner () {

## -- Banner -- ##

cecho " -- MYSQL PERFORMANCE TUNING PRIMER --" boldblue
cecho "      - By: Matthew Montgomery -" black

}

## -- Find the location of the mysql.sock file -- ##

check_for_socket () {
        if [ -z "$socket" ] ; then
                # Use ~/my.cnf version
                if [ -f ~/.my.cnf ] ; then
                        cnf_socket=$(grep ^socket ~/.my.cnf | awk -F \= '{ print $2 }' | head -1)
                fi
                if [ -S "$cnf_socket" ] ; then
                        socket=$cnf_socket
                elif [ -S /var/lib/mysql/mysql.sock ] ; then
                        socket=/var/lib/mysql/mysql.sock
                elif [ -S /var/run/mysqld/mysqld.sock ] ; then
                        socket=/var/run/mysqld/mysqld.sock
                elif [ -S /tmp/mysql.sock ] ; then
                        socket=/tmp/mysql.sock
                else
                        if [ -S "$ps_socket" ] ; then
                        socket=$ps_socket
                        fi
                fi
        fi
        if [ -S "$socket" ] ; then
                echo UP > /dev/null
        else
                cecho "No valid socket file \"$socket\" found!" boldred
                cecho "The mysqld process is not running or it is installed in a custom location." red
                cecho "If you are sure mysqld is running, execute script in \"prompt\" mode or set " red
                cecho "the socket= variable at the top of this script" red
                exit 1
        fi
}


check_for_plesk_passwords () {

## -- Check for the existance of plesk and login using it's credentials -- ##

        if [ -f /etc/psa/.psa.shadow ] ; then
                mysql="mysql -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)"
                mysqladmin="mysqladmin -S $socket -u admin -p$(cat /etc/psa/.psa.shadow)"
        else
                mysql="mysql"
                mysqladmin="mysqladmin"
                # mysql="mysql -S $socket"
                # mysqladmin="mysqladmin -S $socket"
        fi
}

check_mysql_login () {

## -- Test for running mysql -- ##

        is_up=$($mysqladmin ping 2>&1)
        if [ "$is_up" = "mysqld is alive" ] ; then
                echo UP > /dev/null
                # echo $is_up
        elif [ "$is_up" != "mysqld is alive" ] ; then
                printf "\n"
                cecho "Using login values from ~/.my.cnf"
                cecho "- INITIAL LOGIN ATTEMPT FAILED -" boldred
                if [ -z $prompted ] ; then
                find_webmin_passwords
                else
                        return 1
                fi

        else
                cecho "Unknow exit status" red
                exit -1
        fi
}

final_login_attempt () {
        is_up=$($mysqladmin ping 2>&1)
        if [ "$is_up" = "mysqld is alive" ] ; then
                echo UP > /dev/null
        elif [ "$is_up" != "mysqld is alive" ] ; then
                cecho "- FINAL LOGIN ATTEMPT FAILED -" boldred
                cecho "Unable to log into socket: $socket" boldred
                exit 1
        fi
}

second_login_failed () {

## -- create a ~/.my.cnf and exit when all else fails -- ##

        cecho "Could not auto detect login info!"
        cecho "Found potential sockets: $found_socks"
        cecho "Using: $socket" red
        read -p "Would you like to provide a different socket?: [y/N] " REPLY
                case $REPLY in
                        yes | y | Y | YES)
                        read -p "Socket: " socket
                        ;;
                esac
        read -p "Do you have your login handy ? [y/N] : " REPLY
        case $REPLY in
                yes | y | Y | YES)
                answer1='yes'
                read -p "User: " user
                read -rp "Password: " pass
                if [ -z $pass ] ; then
                export mysql="$mysql -S$socket -u$user"
                export mysqladmin="$mysqladmin -S$socket -u$user"
                else
                export mysql="$mysql -S$socket -u$user -p$pass"
                export mysqladmin="$mysqladmin -S$socket -u$user -p$pass"
                fi
                ;;
                *)
                cecho "Please create a valid login to MySQL"
                cecho "Or, set correct values for  'user=' and 'password=' in ~/.my.cnf"
                ;;
        esac
        cecho " "
        read -p "Would you like me to create a ~/.my.cnf file for you? [y/N] : " REPLY
        case $REPLY in
                yes | y | Y | YES)
                answer2='yes'
                if [ ! -f ~/.my.cnf ] ; then
                        umask 077
                        printf "[client]\nuser=$user\npassword=$pass\nsocket=$socket" > ~/.my.cnf
                        if [ "$answer1" != 'yes' ] ; then
                                exit 1
                        else
                                final_login_attempt
                                return 0
                        fi
                else
                        printf "\n"
                        cecho "~/.my.cnf already exists!" boldred
                        printf "\n"
                        read -p "Replace ? [y/N] : " REPLY
                        if [ "$REPLY" = 'y' ] || [ "$REPLY" = 'Y' ] ; then
                        printf "[client]\nuser=$user\npassword=$pass\socket=$socket" > ~/.my.cnf
                                if [ "$answer1" != 'yes' ] ; then
                                        exit 1
                                else
                                        final_login_attempt
                                        return 0
                                fi
                        else
                                cecho "Please set the 'user=' and 'password=' and 'socket=' values in ~/.my.cnf"
                                exit 1
                        fi
                fi
                ;;
                *)
                if [ "$answer1" != 'yes' ] ; then
                        exit 1
                else
                        final_login_attempt
                        return 0
                fi
                ;;
        esac
}

find_webmin_passwords () {

## -- populate the .my.cnf file using values harvested from Webmin -- ##

        cecho "Testing for stored webmin passwords:"
        if [ -f /etc/webmin/mysql/config ] ; then
                user=$(grep ^login= /etc/webmin/mysql/config | cut -d "=" -f 2)
                pass=$(grep ^pass= /etc/webmin/mysql/config | cut -d "=" -f 2)
                if [  $user ] && [ $pass ] && [ ! -f ~/.my.cnf  ] ; then
                        cecho "Setting login info as User: $user Password: $pass"
                        touch ~/.my.cnf
                        chmod 600 ~/.my.cnf
                        printf "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf
                        cecho "Retrying login"
                        is_up=$($mysqladmin ping 2>&1)
                        if [ "$is_up" = "mysqld is alive"  ] ; then
                                echo UP > /dev/null
                        else
                                second_login_failed
                        fi
                echo
                else
                        second_login_failed
                echo
                fi
        else
        cecho " None Found" boldred
                second_login_failed
        fi
}

#########################################################################
#                                                                       #
#  Function to pull MySQL status variable                               #
#                                                                       #
#  Call using :                                                         #
#       mysql_status \'Mysql_status_variable\' bash_dest_variable       #
#                                                                       #
#########################################################################

mysql_status () {
        local status=$($mysql -Bse "show /*!50000 global */ status like $1" | awk '{ print $2 }')
        export "$2"=$status
}

#########################################################################
#                                                                       #
#  Function to pull MySQL server runtime variable                       #
#                                                                       #
#  Call using :                                                         #
#       mysql_variable \'Mysql_server_variable\' bash_dest_variable     #
#       - OR -                                                          #
#       mysql_variableTSV \'Mysql_server_variable\' bash_dest_variable  #
#                                                                       #
#########################################################################

mysql_variable () {
        local variable=$($mysql -Bse "show /*!50000 global */ variables like $1" | awk '{ print $2 }')
        export "$2"=$variable
}
mysql_variableTSV () {
        local variable=$($mysql -Bse "show /*!50000 global */ variables like $1" | awk -F \t '{ print $2 }')
        export "$2"=$variable
}

float2int () {
        local variable=$(echo "$1 / 1" | bc -l)
        export "$2"=$variable
}

divide () {

# -- Divide two intigers -- #

        usage="$0 dividend divisor '$variable' scale"
        if [ $1 -ge 1 ] ; then
                dividend=$1
        else
                cecho "Invalid Dividend" red
                echo $usage
                exit 1
        fi
        if [ $2 -ge 1 ] ; then
                divisor=$2
        else
                cecho "Invalid Divisor" red
                echo $usage
                exit 1
        fi
        if [ ! -n $3 ] ; then
                cecho "Invalid variable name" red
                echo $usage
                exit 1
        fi
        if [ -z $4 ] ; then
                scale=2
        elif [ $4 -ge 0 ] ; then
                scale=$4
        else
                cecho "Invalid scale" red
                echo $usage
                exit 1
        fi
        export $3=$(echo "scale=$scale; $dividend / $divisor" | bc -l)
}

human_readable () {

#########################################################################
#                                                                       #
#  Convert a value in to human readable size and populate a variable    #
#  with the result.                                                     #
#                                                                       #
#  Call using:                                                          #
#       human_readable $value 'variable name' [ places of precision]    #
#                                                                       #
#########################################################################

        ## value=$1
        ## variable=$2
        scale=$3

        if [ $1 -ge 1073741824 ] ; then
                if [ -z $3 ] ; then
                        scale=2
                fi
                divide $1 1073741824 "$2" $scale
                unit="G"
        elif [ $1 -ge 1048576 ] ; then
                if [ -z $3 ] ; then
                        scale=0
                fi
                divide $1 1048576 "$2" $scale
                unit="M"
        elif [ $1 -ge 1024 ] ; then
                if [ -z $3 ] ; then
                        scale=0
                fi
                divide $1 1024 "$2" $scale
                unit="K"
        else
                export "$2"=$1
                unit="bytes"
        fi
        # let "$2"=$HR
}

human_readable_time () {

########################################################################
#                                                                      #
#       Function to produce human readable time                        #
#                                                                      #
########################################################################

        usage="$0 seconds 'variable'"
        if [ -z $1 ] || [ -z $2 ] ; then
                cecho $usage red
                exit 1
        fi
        days=$(echo "scale=0 ; $1 / 86400" | bc -l)
        remainder=$(echo "scale=0 ; $1 % 86400" | bc -l)
        hours=$(echo "scale=0 ; $remainder / 3600" | bc -l)
        remainder=$(echo "scale=0 ; $remainder % 3600" | bc -l)
        minutes=$(echo "scale=0 ; $remainder / 60" | bc -l)
        seconds=$(echo "scale=0 ; $remainder % 60" | bc -l)
        export $2="$days days $hours hrs $minutes min $seconds sec"
}

check_mysql_version () {

## -- Print Version Info -- ##

        mysql_variable \'version\' mysql_version
        mysql_variable \'version_compile_machine\' mysql_version_compile_machine

if [ "$mysql_version_num" -lt 050000 ]; then
        cecho "MySQL Version $mysql_version $mysql_version_compile_machine is EOL please upgrade to MySQL 4.1 or later" boldred
else
        cecho "MySQL Version $mysql_version $mysql_version_compile_machine"
fi


}

post_uptime_warning () {

#########################################################################
#                                                                       #
#  Present a reminder that mysql must run for a couple of days to       #
#  build up good numbers in server status variables before these tuning #
#  suggestions should be used.                                          #
#                                                                       #
#########################################################################

        mysql_status \'Uptime\' uptime
        mysql_status \'Threads_connected\' threads
        queries_per_sec=$(($questions/$uptime))
        human_readable_time $uptime uptimeHR

        cecho "Uptime = $uptimeHR"
        cecho "Avg. qps = $queries_per_sec"
        cecho "Total Questions = $questions"
        cecho "Threads Connected = $threads"
        echo

        if [ $uptime -gt 172800 ] ; then
                cecho "Server has been running for over 48hrs."
                cecho "It should be safe to follow these recommendations"
        else
                cechon "Warning: " boldred
                cecho "Server has not been running for at least 48hrs." boldred
                cecho "It may not be safe to use these recommendations" boldred

        fi
        echo ""
        cecho "To find out more information on how each of these" red
        cecho "runtime variables effects performance visit:" red
        if [ "$major_version" = '3.23' ] || [ "$major_version" = '4.0' ] || [ "$major_version" = '4.1' ] ; then
        cecho "http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html" boldblue
        elif [ "$major_version" = '5.0' ] || [ "$mysql_version_num" -gt '050100' ]; then
        cecho "http://dev.mysql.com/doc/refman/$major_version/en/server-system-variables.html" boldblue
        else
        cecho "UNSUPPORTED MYSQL VERSION" boldred
        exit 1
        fi
        cecho "Visit http://www.mysql.com/products/enterprise/advisors.html" boldblue
        cecho "for info about MySQL's Enterprise Monitoring and Advisory Service" boldblue
}

check_slow_queries () {

## -- Slow Queries -- ##

        cecho "SLOW QUERIES" boldblue

        mysql_status \'Slow_queries\' slow_queries
        mysql_variable \'long_query_time\' long_query_time
        mysql_variable \'log%queries\' log_slow_queries

        prefered_query_time=5
        if [ -e /etc/my.cnf ] ; then
                if [ -z $log_slow_queries ] ; then
                        log_slow_queries=$(grep log-slow-queries /etc/my.cnf)
                fi
        fi

        if [ "$log_slow_queries" = 'ON' ] ; then
                cecho "The slow query log is enabled."
        elif [ "$log_slow_queries" = 'OFF' ] ; then
                cechon "The slow query log is "
                cechon "NOT" boldred
                cecho " enabled."
        elif [ -z $log_slow_queries ] ; then
                cechon "The slow query log is "
                cechon "NOT" boldred
                cecho " enabled."
        else
                cecho "Error: $log_slow_queries" boldred
        fi
        cecho "Current long_query_time = $long_query_time sec."
        cechon "You have "
        cechon "$slow_queries" boldred
        cechon " out of "
        cechon "$questions" boldred
        cecho " that take longer than $long_query_time sec. to complete"

        float2int long_query_time long_query_timeInt

        if [ $long_query_timeInt -gt $prefered_query_time ] ; then
                cecho "Your long_query_time may be too high, I typically set this under $prefered_query_time sec." red
        else
                cecho "Your long_query_time seems to be fine" green
        fi

}

check_binary_log () {

## -- Binary Log -- ##

        cecho "BINARY UPDATE LOG" boldblue

        mysql_variable \'log_bin\' log_bin
        mysql_variable \'max_binlog_size\' max_binlog_size
        mysql_variable \'expire_logs_days\' expire_logs_days
        mysql_variable \'sync_binlog\' sync_binlog
        #  mysql_variable \'max_binlog_cache_size\' max_binlog_cache_size

        if [ "$log_bin" = 'ON' ] ; then
                cecho "The binary update log is enabled"
                if [ -z "$max_binlog_size" ] ; then
                        cecho "The max_binlog_size is not set. The binary log will rotate when it reaches 1GB." red
                fi
                if [ "$expire_logs_days" -eq 0 ] ; then
                        cecho "The expire_logs_days is not set." boldred
                        cechon "The mysqld will retain the entire binary log until " red
                        cecho "RESET MASTER or PURGE MASTER LOGS commands are run manually" red
                        cecho "Setting expire_logs_days will allow you to remove old binary logs automatically"  yellow
                        cecho "See http://dev.mysql.com/doc/refman/$major_version/en/purge-master-logs.html" yellow
                fi
                if [ "$sync_binlog" = 0 ] ; then
                        cecho "Binlog sync is not enabled, you could loose binlog records during a server crash" red
                fi
        else
                cechon "The binary update log is "
                cechon "NOT " boldred
                cecho "enabled."
                cecho "You will not be able to do point in time recovery" red
                cecho "See http://dev.mysql.com/doc/refman/$major_version/en/point-in-time-recovery.html" yellow
        fi
}

check_used_connections () {

## -- Used Connections -- ##

        mysql_variable \'max_connections\' max_connections
        mysql_status \'Max_used_connections\' max_used_connections
        mysql_status \'Threads_connected\' threads_connected

        connections_ratio=$(($max_used_connections*100/$max_connections))

        cecho "MAX CONNECTIONS" boldblue
        cecho "Current max_connections = $max_connections"
        cecho "Current threads_connected = $threads_connected"
        cecho "Historic max_used_connections = $max_used_connections"
        cechon "The number of used connections is "
        if [ $connections_ratio -ge 85 ] ; then
                txt_color=red
                error=1
        elif [ $connections_ratio -le 10 ] ; then
                txt_color=red
                error=2
        else
                txt_color=green
                error=0
        fi
        # cechon "$max_used_connections " $txt_color
        # cechon "which is "
        cechon "$connections_ratio% " $txt_color
        cecho "of the configured maximum."

        if [ $error -eq 1 ] ; then
                cecho "You should raise max_connections" $txt_color
        elif [ $error -eq 2 ] ; then
                cecho "You are using less than 10% of your configured max_connections." $txt_color
                cecho "Lowering max_connections could help to avoid an over-allocation of memory" $txt_color
                cecho "See \"MEMORY USAGE\" section to make sure you are not over-allocating" $txt_color
        else
                cecho "Your max_connections variable seems to be fine." $txt_color
        fi
        unset txt_color
}

check_threads() {

## -- Worker Threads -- ##

        cecho "WORKER THREADS" boldblue

        mysql_status \'Threads_created\' threads_created1
        sleep 1
        mysql_status \'Threads_created\' threads_created2

        mysql_status \'Threads_cached\' threads_cached
        mysql_status \'Uptime\' uptime
        mysql_variable \'thread_cache_size\' thread_cache_size

        historic_threads_per_sec=$(($threads_created1/$uptime))
        current_threads_per_sec=$(($threads_created2-$threads_created1))

        cecho "Current thread_cache_size = $thread_cache_size"
        cecho "Current threads_cached = $threads_cached"
        cecho "Current threads_per_sec = $current_threads_per_sec"
        cecho "Historic threads_per_sec = $historic_threads_per_sec"

        if [ $historic_threads_per_sec -ge 2 ] && [ $threads_cached -le 1 ] ; then
                cecho "Threads created per/sec are overrunning threads cached" red
                cecho "You should raise thread_cache_size" red
        elif [ $current_threads_per_sec -ge 2 ] ; then
                cecho "Threads created per/sec are overrunning threads cached" red
                cecho "You should raise thread_cache_size" red
        else
                cecho "Your thread_cache_size is fine" green
        fi
}

check_key_buffer_size () {

## -- Key buffer Size -- ##

        cecho "KEY BUFFER" boldblue

        mysql_status \'Key_read_requests\' key_read_requests
        mysql_status \'Key_reads\' key_reads
        mysql_status \'Key_blocks_used\' key_blocks_used
        mysql_status \'Key_blocks_unused\' key_blocks_unused
        mysql_variable \'key_cache_block_size\' key_cache_block_size
        mysql_variable \'key_buffer_size\' key_buffer_size
        mysql_variable \'datadir\' datadir
        mysql_variable \'version_compile_machine\' mysql_version_compile_machine
        myisam_indexes=$($mysql -Bse "/*!50000 SELECT IFNULL(SUM(INDEX_LENGTH),0) from information_schema.TABLES where ENGINE='MyISAM' */")

        if [ -z $myisam_indexes ] ; then
                myisam_indexes=$(find $datadir -name '*.MYI' -exec du $duflags '{}' \; 2>&1 | awk '{ s += $1 } END { printf("%.0f\n", s )}')
        fi

        if [ $key_reads -eq 0 ] ; then
                cecho "No key reads?!" boldred
                cecho "Seriously look into using some indexes" red
                key_cache_miss_rate=0
                key_buffer_free=$(echo "$key_blocks_unused * $key_cache_block_size / $key_buffer_size * 100" | bc -l )
                key_buffer_freeRND=$(echo "scale=0; $key_buffer_free / 1" | bc -l)
        else
                key_cache_miss_rate=$(($key_read_requests/$key_reads))
                if [ ! -z $key_blocks_unused ] ; then
                        key_buffer_free=$(echo "$key_blocks_unused * $key_cache_block_size / $key_buffer_size * 100" | bc -l )
                        key_buffer_freeRND=$(echo "scale=0; $key_buffer_free / 1" | bc -l)
                else
                        key_buffer_free='Unknown'
                        key_buffer_freeRND=75
                fi
        fi

        human_readable $myisam_indexes myisam_indexesHR
        cecho "Current MyISAM index space = $myisam_indexesHR $unit"

        human_readable  $key_buffer_size key_buffer_sizeHR
        cecho "Current key_buffer_size = $key_buffer_sizeHR $unit"
        cecho "Key cache miss rate is 1 : $key_cache_miss_rate"
        cecho "Key buffer free ratio = $key_buffer_freeRND %"

        if [ "$major_version" = '5.1' ] && [ $mysql_version_num -lt 050123 ] ; then
                if [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then
                        cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.1.23 " boldred
                        cecho "See Bug#5731, Bug#29419, Bug#29446" boldred
                fi
        fi
        if [ "$major_version" = '5.0' ] && [ $mysql_version_num -lt 050052 ] ; then
                if [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then
                        cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.0.52 " boldred
                        cecho "See Bug#5731, Bug#29419, Bug#29446" boldred
                fi
        fi
        if [ "$major_version" = '4.1' -o "$major_version" = '4.0' ] && [ $key_buffer_size -ge 4294967296 ] && ( echo "x86_64 ppc64 ia64 sparc64 i686" | grep -q $mysql_version_compile_machine ) ; then
                cecho "Using key_buffer_size > 4GB will cause instability in versions prior to 5.0.52 " boldred
                cecho "Reduce key_buffer_size to a safe value" boldred
                cecho "See Bug#5731, Bug#29419, Bug#29446" boldred
        fi

        if [ $key_cache_miss_rate -le 100 ] && [ $key_cache_miss_rate -gt 0 ] && [ $key_buffer_freeRND -le 20 ]; then
                cecho "You could increase key_buffer_size" boldred
                cecho "It is safe to raise this up to 1/4 of total system memory;"
                cecho "assuming this is a dedicated database server."
        elif [ $key_buffer_freeRND -le 20 ] && [ $key_buffer_size -le $myisam_indexes ] ; then
                cecho "You could increase key_buffer_size" boldred
                cecho "It is safe to raise this up to 1/4 of total system memory;"
                cecho "assuming this is a dedicated database server."
        elif [ $key_cache_miss_rate -ge 10000 ] || [ $key_buffer_freeRND -le 50  ] ; then
                cecho "Your key_buffer_size seems to be too high." red
                cecho "Perhaps you can use these resources elsewhere" red
        else
                cecho "Your key_buffer_size seems to be fine" green
        fi
}

check_query_cache () {

## -- Query Cache -- ##

        cecho "QUERY CACHE" boldblue

        mysql_variable \'version\' mysql_version
        mysql_variable \'query_cache_size\' query_cache_size
        mysql_variable \'query_cache_limit\' query_cache_limit
        mysql_variable \'query_cache_min_res_unit\' query_cache_min_res_unit
        mysql_status \'Qcache_free_memory\' qcache_free_memory
        mysql_status \'Qcache_total_blocks\' qcache_total_blocks
        mysql_status \'Qcache_free_blocks\' qcache_free_blocks
        mysql_status \'Qcache_lowmem_prunes\' qcache_lowmem_prunes

        if [ -z $query_cache_size ] ; then
                cecho "You are using MySQL $mysql_version, no query cache is supported." red
                cecho "I recommend an upgrade to MySQL 4.1 or better" red
        elif [ $query_cache_size -eq 0 ] ; then
                cecho "Query cache is supported but not enabled" red
                cecho "Perhaps you should set the query_cache_size" red
        else
                qcache_used_memory=$(($query_cache_size-$qcache_free_memory))
                qcache_mem_fill_ratio=$(echo "scale=2; $qcache_used_memory * 100 / $query_cache_size" | bc -l)
                qcache_mem_fill_ratioHR=$(echo "scale=0; $qcache_mem_fill_ratio / 1" | bc -l)

                cecho "Query cache is enabled" green
                human_readable $query_cache_size query_cache_sizeHR
                cecho "Current query_cache_size = $query_cache_sizeHR $unit"
                human_readable $qcache_used_memory qcache_used_memoryHR
                cecho "Current query_cache_used = $qcache_used_memoryHR $unit"
                human_readable $query_cache_limit query_cache_limitHR
                cecho "Current query_cache_limit = $query_cache_limitHR $unit"
                cecho "Current Query cache Memory fill ratio = $qcache_mem_fill_ratio %"
                if [ -z $query_cache_min_res_unit ] ; then
                        cecho "No query_cache_min_res_unit is defined.  Using MySQL < 4.1 cache fragmentation can be inpredictable" %yellow
                else
                        human_readable $query_cache_min_res_unit query_cache_min_res_unitHR
                        cecho "Current query_cache_min_res_unit = $query_cache_min_res_unitHR $unit"
                fi
                if [ $qcache_free_blocks -gt 2 ] && [ $qcache_total_blocks -gt 0 ] ; then
                        qcache_percent_fragmented=$(echo "scale=2; $qcache_free_blocks * 100 / $qcache_total_blocks" | bc -l)
                        qcache_percent_fragmentedHR=$(echo "scale=0; $qcache_percent_fragmented / 1" | bc -l)
                        if [ $qcache_percent_fragmentedHR -gt 20 ] ; then
                                cecho "Query Cache is $qcache_percent_fragmentedHR % fragmented" red
                                cecho "Run \"FLUSH QUERY CACHE\" periodically to defragment the query cache memory" red
                                cecho "If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation." red
                        fi
                fi

                if [ $qcache_mem_fill_ratioHR -le 25 ] ; then
                        cecho "Your query_cache_size seems to be too high." red
                        cecho "Perhaps you can use these resources elsewhere" red
                fi
                if [ $qcache_lowmem_prunes -ge 50 ] && [ $qcache_mem_fill_ratioHR -ge 80 ]; then
                        cechon "However, "
                        cechon "$qcache_lowmem_prunes " boldred
                        cecho "queries have been removed from the query cache due to lack of memory"
                        cecho "Perhaps you should raise query_cache_size" boldred
                fi
                cecho "MySQL won't cache query results that are larger than query_cache_limit in size" yellow
        fi

}

check_sort_operations () {

## -- Sort Operations -- ##

        cecho "SORT OPERATIONS" boldblue

        mysql_status \'Sort_merge_passes\' sort_merge_passes
        mysql_status \'Sort_scan\' sort_scan
        mysql_status \'Sort_range\' sort_range
        mysql_variable \'sort_buffer%\' sort_buffer_size
        mysql_variable \'read_rnd_buffer_size\' read_rnd_buffer_size

        total_sorts=$(($sort_scan+$sort_range))
        if [ -z $read_rnd_buffer_size ] ; then
                mysql_variable \'record_buffer\' read_rnd_buffer_size
        fi

        ## Correct for rounding error in mysqld where 512K != 524288 ##
        sort_buffer_size=$(($sort_buffer_size+8))
        read_rnd_buffer_size=$(($read_rnd_buffer_size+8))

        human_readable $sort_buffer_size sort_buffer_sizeHR
        cecho "Current sort_buffer_size = $sort_buffer_sizeHR $unit"

        human_readable $read_rnd_buffer_size read_rnd_buffer_sizeHR
        cechon "Current "
        if [ "$major_version" = '3.23' ] ; then
                cechon "record_rnd_buffer "
        else
                cechon "read_rnd_buffer_size "
        fi
        cecho "= $read_rnd_buffer_sizeHR $unit"

        if [ $total_sorts -eq 0 ] ; then
                cecho "No sort operations have been performed"
                passes_per_sort=0
        fi
        if [ $sort_merge_passes -ne 0 ] ; then
                passes_per_sort=$(($sort_merge_passes/$total_sorts))
        else
                passes_per_sort=0
        fi

        if [ $passes_per_sort -ge 2 ] ; then
                cechon "On average "
                cechon "$passes_per_sort " boldred
                cecho "sort merge passes are made per sort operation"
                cecho "You should raise your sort_buffer_size"
                cechon "You should also raise your "
                if [ "$major_version" = '3.23' ] ; then
                        cecho "record_rnd_buffer_size"
                else
                        cecho "read_rnd_buffer_size"
                fi
        else
                cecho "Sort buffer seems to be fine" green
        fi
}

check_join_operations () {

## -- Joins -- ##

        cecho "JOINS" boldblue

        mysql_status \'Select_full_join\' select_full_join
        mysql_status \'Select_range_check\' select_range_check
        mysql_variable \'join_buffer%\' join_buffer_size

        ## Some 4K is dropped from join_buffer_size adding it back to make sane ##
        ## handling of human-readable conversion ##

        join_buffer_size=$(($join_buffer_size+4096))

        human_readable $join_buffer_size join_buffer_sizeHR 2

        cecho "Current join_buffer_size = $join_buffer_sizeHR $unit"
        cecho "You have had $select_full_join queries where a join could not use an index properly"

        if [ $select_range_check -eq 0 ] && [ $select_full_join -eq 0 ] ; then
                cecho "Your joins seem to be using indexes properly" green
        fi
        if [ $select_full_join -gt 0 ] ; then
                print_error='true'
                raise_buffer='true'
        fi
        if [ $select_range_check -gt 0 ] ; then
                cecho "You have had $select_range_check joins without keys that check for key usage after each row" red
                print_error='true'
                raise_buffer='true'
        fi

        ## For Debuging ##
        # print_error='true'
        if [ $join_buffer_size -ge 4194304 ] ; then
                cecho "join_buffer_size >= 4 M" boldred
                cecho "This is not advised" boldred
                raise_buffer=
        fi

        if [ $print_error ] ; then
                if [ "$major_version" = '3.23' ] || [ "$major_version" = '4.0' ] ; then
                        cecho "You should enable \"log-long-format\" "
                elif [ "$mysql_version_num" -gt 040100 ]; then
                        cecho "You should enable \"log-queries-not-using-indexes\""
                fi
                cecho "Then look for non indexed joins in the slow query log."
                if [ $raise_buffer ] ; then
                cecho "If you are unable to optimize your queries you may want to increase your"
                cecho "join_buffer_size to accommodate larger joins in one pass."
                printf "\n"
                cecho "Note! This script will still suggest raising the join_buffer_size when" boldred
                cecho "ANY joins not using indexes are found." boldred
                fi
        fi

        # XXX Add better tests for join_buffer_size pending mysql bug #15088  XXX #
}

check_tmp_tables () {

## -- Temp Tables -- ##

        cecho "TEMP TABLES" boldblue

        mysql_status \'Created_tmp_tables\' created_tmp_tables
        mysql_status \'Created_tmp_disk_tables\' created_tmp_disk_tables
        mysql_variable \'tmp_table_size\' tmp_table_size
        mysql_variable \'max_heap_table_size\' max_heap_table_size


        if [ $created_tmp_tables -eq 0 ] ; then
                tmp_disk_tables=0
        else
                tmp_disk_tables=$((created_tmp_disk_tables*100/(created_tmp_tables+created_tmp_disk_tables)))
        fi
        human_readable $max_heap_table_size max_heap_table_sizeHR
        cecho "Current max_heap_table_size = $max_heap_table_sizeHR $unit"

        human_readable $tmp_table_size tmp_table_sizeHR
        cecho "Current tmp_table_size = $tmp_table_sizeHR $unit"

        cecho "Of $created_tmp_tables temp tables, $tmp_disk_tables% were created on disk"
        if [ $tmp_table_size -gt $max_heap_table_size ] ; then
                cecho "Effective in-memory tmp_table_size is limited to max_heap_table_size." yellow
        fi
        if [ $tmp_disk_tables -ge 25 ] ; then
                cecho "Perhaps you should increase your tmp_table_size and/or max_heap_table_size" boldred
                cecho "to reduce the number of disk-based temporary tables" boldred
                cecho "Note! BLOB and TEXT columns are not allow in memory tables." yellow
                cecho "If you are using these columns raising these values might not impact your " yellow
                cecho  "ratio of on disk temp tables." yellow
        else
                cecho "Created disk tmp tables ratio seems fine" green
        fi
}

check_open_files () {

## -- Open Files Limit -- ##
        cecho "OPEN FILES LIMIT" boldblue

        mysql_variable \'open_files_limit\' open_files_limit
        mysql_status   \'Open_files\' open_files

        if [ -z $open_files_limit ] || [ $open_files_limit -eq 0 ] ; then
                open_files_limit=$(ulimit -n)
                cant_override=1
        else
                cant_override=0
        fi
        cecho "Current open_files_limit = $open_files_limit files"

        open_files_ratio=$(($open_files*100/$open_files_limit))

        cecho "The open_files_limit should typically be set to at least 2x-3x" yellow
        cecho "that of table_cache if you have heavy MyISAM usage." yellow
        if [ $open_files_ratio -ge 75 ] ; then
                cecho "You currently have open more than 75% of your open_files_limit" boldred
                if [ $cant_override -eq 1 ] ; then
                        cecho "You should set a higer value for ulimit -u in the mysql startup script then restart mysqld" boldred
                        cecho "MySQL 3.23 users : This is just a guess based upon the current shell's ulimit -u value" yellow
                elif [ $cant_override -eq 0 ] ; then
                        cecho "You should set a higher value for open_files_limit in my.cnf" boldred
                else
                        cecho "ERROR can't determine if mysqld override of ulimit is allowed" boldred
                        exit 1
                fi
        else
                cecho "Your open_files_limit value seems to be fine" green
        fi



}

check_table_cache () {

## -- Table Cache -- ##

        cecho "TABLE CACHE" boldblue

        mysql_variable \'datadir\' datadir
        mysql_variable \'table_cache\' table_cache

        ## /* MySQL +5.1 version of table_cache */ ##
        mysql_variable \'table_open_cache\' table_open_cache
        mysql_variable \'table_definition_cache\' table_definition_cache

        mysql_status \'Open_tables\' open_tables
        mysql_status \'Opened_tables\' opened_tables
        mysql_status \'Open_table_definitions\' open_table_definitions

        table_count=$($mysql -Bse "/*!50000 SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' */")

        if [ -z "$table_count" ] ; then
                if [ "$UID" != "$socket_owner" ] && [ "$UID" != "0" ] ; then
                        cecho "You are not '$socket_owner' or 'root'" red
                        cecho "I am unable to determine the table_count!" red
                else
                        table_count=$(find $datadir 2>&1 | grep -c .frm$)
                fi
        fi
        if [ $table_open_cache ] ; then
                table_cache=$table_open_cache
        fi

        if [ $opened_tables -ne 0 ] && [ $table_cache -ne 0 ] ; then
                table_cache_hit_rate=$(($open_tables*100/$opened_tables))
                table_cache_fill=$(($open_tables*100/$table_cache))
        elif [ $opened_tables -eq 0 ] && [ $table_cache -ne 0 ] ; then
                table_cache_hit_rate=100
                table_cache_fill=$(($open_tables*100/$table_cache))
        else
                cecho "ERROR no table_cache ?!" boldred
                exit 1
        fi
        if [ $table_cache ] && [ ! $table_open_cache ] ; then
                cecho "Current table_cache value = $table_cache tables"
        fi
        if [ $table_open_cache ] ; then
                cecho "Current table_open_cache = $table_open_cache tables"
                cecho "Current table_definition_cache = $table_definition_cache tables"
        fi
        if [ $table_count ] ; then
        cecho "You have a total of $table_count tables"
        fi

        if  [ $table_cache_fill -lt 95 ] ; then
                cechon "You have "
                cechon "$open_tables " green
                cecho "open tables."
                cecho "The table_cache value seems to be fine" green
        elif [ $table_cache_hit_rate -le 85 -o  $table_cache_fill -ge 95 ]; then
                cechon "You have "
                cechon "$open_tables " boldred
                cecho "open tables."
                cechon "Current table_cache hit rate is "
                cecho "$table_cache_hit_rate%" boldred
                cechon ", while "
                cechon "$table_cache_fill% " boldred
                cecho "of your table cache is in use"
                cecho "You should probably increase your table_cache" red
        else
                cechon "Current table_cache hit rate is "
                cechon "$table_cache_hit_rate%" green
                cechon ", while "
                cechon "$table_cache_fill% " green
                cecho "of your table cache is in use"
                cecho "The table cache value seems to be fine" green
        fi
        if [ $table_definition_cache ] && [ $table_definition_cache -le $table_count ] && [ $table_count -ge 100 ] ; then
                cecho "You should probably increase your table_definition_cache value." red
        fi
}

check_table_locking () {

## -- Table Locking -- ##

        cecho "TABLE LOCKING" boldblue

        mysql_status \'Table_locks_waited\' table_locks_waited
        mysql_status \'Table_locks_immediate\' table_locks_immediate
        mysql_variable \'concurrent_insert\' concurrent_insert
        mysql_variable \'low_priority_updates\' low_priority_updates
        if [ "$concurrent_insert" = 'ON' ]; then
                concurrent_insert=1
        elif [ "$concurrent_insert" = 'OFF' ]; then
                concurrent_insert=0
        fi

        cechon "Current Lock Wait ratio = "
        if [ $table_locks_waited -gt 0 ]; then
                immediate_locks_miss_rate=$(($table_locks_immediate/$table_locks_waited))
                cecho "1 : $immediate_locks_miss_rate" red
        else
                immediate_locks_miss_rate=99999 # perfect
                cecho "0 : $questions"
        fi
        if [ $immediate_locks_miss_rate -lt 5000 ] ; then
                cecho "You may benefit from selective use of InnoDB."
                if [ "$low_priority_updates" = 'OFF' ] ; then
                cecho "If you have long running SELECT's against MyISAM tables and perform"
                cecho "frequent updates consider setting 'low_priority_updates=1'"
                fi
                if [ "$mysql_version_num" -gt 050000 ] && [ "$mysql_version_num" -lt 050500 ]; then
                        if [ $concurrent_insert -le 1 ] ; then
                        cecho "If you have a high concurrency of inserts on Dynamic row-length tables"
                        cecho "consider setting 'concurrent_insert=2'."
                        fi
                elif [ "$mysql_version_num" -gt 050500 ] ; then
                        if [ "$concurrent_insert" = 'AUTO' ] || [ "$concurrent_insert" = 'NEVER' ] ; then
                        cecho "If you have a high concurrency of inserts on Dynamic row-length tables"
                        cecho "consider setting 'concurrent_insert=ALWAYS'."
                        fi
                fi
        else
                cecho "Your table locking seems to be fine" green
        fi
}

check_table_scans () {

## -- Table Scans -- ##

        cecho "TABLE SCANS" boldblue

        mysql_status \'Com_select\' com_select
        mysql_status \'Handler_read_rnd_next\' read_rnd_next
        mysql_variable \'read_buffer_size\' read_buffer_size

        if [ -z $read_buffer_size ] ; then
                mysql_variable \'record_buffer\' read_buffer_size
        fi

        human_readable $read_buffer_size read_buffer_sizeHR
        cecho "Current read_buffer_size = $read_buffer_sizeHR $unit"

        if [ $com_select -gt 0 ] ; then
                full_table_scans=$(($read_rnd_next/$com_select))
                cecho "Current table scan ratio = $full_table_scans : 1"
                if [ $full_table_scans -ge 4000 ] && [ $read_buffer_size -le 2097152 ] ; then
                        cecho "You have a high ratio of sequential access requests to SELECTs" red
                        cechon "You may benefit from raising " red
                        if [ "$major_version" = '3.23' ] ; then
                                cechon "record_buffer " red
                        else
                                cechon "read_buffer_size " red
                        fi
                        cecho "and/or improving your use of indexes." red
                elif [ $read_buffer_size -gt 8388608 ] ; then
                        cechon "read_buffer_size is over 8 MB " red
                        cecho "there is probably no need for such a large read_buffer" red

                else
                        cecho "read_buffer_size seems to be fine" green
                fi
        else
                cecho "read_buffer_size seems to be fine" green
        fi
}


check_innodb_status () {

## -- InnoDB -- ##

        ## See http://bugs.mysql.com/59393

        if [ "$mysql_version_num" -lt 050603 ] ; then
        mysql_variable \'have_innodb\' have_innodb
        fi
        if [ "$mysql_version_num" -lt 050500 ] && [ "$have_innodb" = "YES" ] ; then
        innodb_enabled=1
        fi
        if [ "$mysql_version_num" -ge 050500 ] && [ "$mysql_version_num" -lt 050512 ] ; then
        mysql_variable \'ignore_builtin_innodb\' ignore_builtin_innodb
                if [ "$ignore_builtin_innodb" = "ON" ] || [ $have_innodb = "NO" ] ; then
                innodb_enabled=0
                else
                innodb_enabled=1
                fi
        elif [ "$major_version"  = '5.5' ] && [ "$mysql_version_num" -ge 050512 ] ; then
        mysql_variable \'ignore_builtin_innodb\' ignore_builtin_innodb
                if [ "$ignore_builtin_innodb" = "ON" ] ; then
                innodb_enabled=0
                else
                innodb_enabled=1
                fi
        elif [ "$mysql_version_num" -ge 050600 ] && [ "$mysql_version_num" -lt 050603 ] ; then
        mysql_variable \'ignore_builtin_innodb\' ignore_builtin_innodb
                if [ "$ignore_builtin_innodb" = "ON" ] || [ $have_innodb = "NO" ] ; then
                innodb_enabled=0
                else
                innodb_enabled=1
                fi
        elif [ "$major_version" = '5.6' ] && [ "$mysql_version_num" -ge 050603 ] ; then
        mysql_variable \'ignore_builtin_innodb\' ignore_builtin_innodb
                if [ "$ignore_builtin_innodb" = "ON" ] ; then
                innodb_enabled=0
                else
                innodb_enabled=1
                fi
        fi
        if [ "$innodb_enabled" = 1 ] ; then
                mysql_variable \'innodb_buffer_pool_size\' innodb_buffer_pool_size
                mysql_variable \'innodb_additional_mem_pool_size\' innodb_additional_mem_pool_size
                mysql_variable \'innodb_fast_shutdown\' innodb_fast_shutdown
                mysql_variable \'innodb_flush_log_at_trx_commit\' innodb_flush_log_at_trx_commit
                mysql_variable \'innodb_locks_unsafe_for_binlog\' innodb_locks_unsafe_for_binlog
                mysql_variable \'innodb_log_buffer_size\' innodb_log_buffer_size
                mysql_variable \'innodb_log_file_size\' innodb_log_file_size
                mysql_variable \'innodb_log_files_in_group\' innodb_log_files_in_group
                mysql_variable \'innodb_safe_binlog\' innodb_safe_binlog
                mysql_variable \'innodb_thread_concurrency\' innodb_thread_concurrency

                cecho "INNODB STATUS" boldblue
                innodb_indexes=$($mysql -Bse "/*!50000 SELECT IFNULL(SUM(INDEX_LENGTH),0) from information_schema.TABLES where ENGINE='InnoDB' */")
                innodb_data=$($mysql -Bse "/*!50000 SELECT IFNULL(SUM(DATA_LENGTH),0) from information_schema.TABLES where ENGINE='InnoDB' */")

                if [ ! -z "$innodb_indexes" ] ; then

                mysql_status \'Innodb_buffer_pool_pages_data\' innodb_buffer_pool_pages_data
                mysql_status \'Innodb_buffer_pool_pages_misc\' innodb_buffer_pool_pages_misc
                mysql_status \'Innodb_buffer_pool_pages_free\' innodb_buffer_pool_pages_free
                mysql_status \'Innodb_buffer_pool_pages_total\' innodb_buffer_pool_pages_total

                mysql_status \'Innodb_buffer_pool_read_ahead_seq\' innodb_buffer_pool_read_ahead_seq
                mysql_status \'Innodb_buffer_pool_read_requests\' innodb_buffer_pool_read_requests

                mysql_status \'Innodb_os_log_pending_fsyncs\' innodb_os_log_pending_fsyncs
                mysql_status \'Innodb_os_log_pending_writes\'   innodb_os_log_pending_writes
                mysql_status \'Innodb_log_waits\' innodb_log_waits

                mysql_status \'Innodb_row_lock_time\' innodb_row_lock_time
                mysql_status \'Innodb_row_lock_waits\' innodb_row_lock_waits

                human_readable $innodb_indexes innodb_indexesHR
                cecho "Current InnoDB index space = $innodb_indexesHR $unit"
                human_readable $innodb_data innodb_dataHR
                cecho "Current InnoDB data space = $innodb_dataHR $unit"
                percent_innodb_buffer_pool_free=$(($innodb_buffer_pool_pages_free*100/$innodb_buffer_pool_pages_total))
                cecho "Current InnoDB buffer pool free = "$percent_innodb_buffer_pool_free" %"

                else
                cecho "Cannot parse InnoDB stats prior to 5.0.x" red
                $mysql -s -e "SHOW /*!50000 ENGINE */ INNODB STATUS\G"
                fi

                human_readable $innodb_buffer_pool_size innodb_buffer_pool_sizeHR
                cecho "Current innodb_buffer_pool_size = $innodb_buffer_pool_sizeHR $unit"
                cecho "Depending on how much space your innodb indexes take up it may be safe"
                cecho "to increase this value to up to 2 / 3 of total system memory"
        else
                cecho "No InnoDB Support Enabled!" boldred
        fi
}

total_memory_used () {

## -- Total Memory Usage -- ##
        cecho "MEMORY USAGE" boldblue

        mysql_variable \'read_buffer_size\' read_buffer_size
        mysql_variable \'read_rnd_buffer_size\' read_rnd_buffer_size
        mysql_variable \'sort_buffer_size\' sort_buffer_size
        mysql_variable \'thread_stack\' thread_stack
        mysql_variable \'max_connections\' max_connections
        mysql_variable \'join_buffer_size\' join_buffer_size
        mysql_variable \'tmp_table_size\' tmp_table_size
        mysql_variable \'max_heap_table_size\' max_heap_table_size
        mysql_variable \'log_bin\' log_bin
        mysql_status \'Max_used_connections\' max_used_connections

        if [ "$major_version" = "3.23" ] ; then
                mysql_variable \'record_buffer\' read_buffer_size
                mysql_variable \'record_rnd_buffer\' read_rnd_buffer_size
                mysql_variable \'sort_buffer\' sort_buffer_size
        fi

        if [ "$log_bin" = "ON" ] ; then
                mysql_variable \'binlog_cache_size\' binlog_cache_size
        else
                binlog_cache_size=0
        fi

        if [ $max_heap_table_size -le $tmp_table_size ] ; then
                effective_tmp_table_size=$max_heap_table_size
        else
                effective_tmp_table_size=$tmp_table_size
        fi


        per_thread_buffers=$(echo "($read_buffer_size+$read_rnd_buffer_size+$sort_buffer_size+$thread_stack+$join_buffer_size+$binlog_cache_size)*$max_connections" | bc -l)
        per_thread_max_buffers=$(echo "($read_buffer_size+$read_rnd_buffer_size+$sort_buffer_size+$thread_stack+$join_buffer_size+$binlog_cache_size)*$max_used_connections" | bc -l)

        mysql_variable \'innodb_buffer_pool_size\' innodb_buffer_pool_size
        if [ -z $innodb_buffer_pool_size ] ; then
        innodb_buffer_pool_size=0
        fi

        mysql_variable \'innodb_additional_mem_pool_size\' innodb_additional_mem_pool_size
        if [ -z $innodb_additional_mem_pool_size ] ; then
        innodb_additional_mem_pool_size=0
        fi

        mysql_variable \'innodb_log_buffer_size\' innodb_log_buffer_size
        if [ -z $innodb_log_buffer_size ] ; then
        innodb_log_buffer_size=0
        fi

        mysql_variable \'key_buffer_size\' key_buffer_size

        mysql_variable \'query_cache_size\' query_cache_size
        if [ -z $query_cache_size ] ; then
        query_cache_size=0
        fi

        global_buffers=$(echo "$innodb_buffer_pool_size+$innodb_additional_mem_pool_size+$innodb_log_buffer_size+$key_buffer_size+$query_cache_size" | bc -l)


        max_memory=$(echo "$global_buffers+$per_thread_max_buffers" | bc -l)
        total_memory=$(echo "$global_buffers+$per_thread_buffers" | bc -l)

        pct_of_sys_mem=$(echo "scale=0; $total_memory*100/$physical_memory" | bc -l)

        if [ $pct_of_sys_mem -gt 90 ] ; then
                txt_color=boldred
                error=1
        else
                txt_color=
                error=0
        fi

        human_readable $max_memory max_memoryHR
        cecho "Max Memory Ever Allocated : $max_memoryHR $unit" $txt_color
        human_readable $per_thread_buffers per_thread_buffersHR
        cecho "Configured Max Per-thread Buffers : $per_thread_buffersHR $unit" $txt_color
        human_readable $global_buffers global_buffersHR
        cecho "Configured Max Global Buffers : $global_buffersHR $unit" $txt_color
        human_readable $total_memory total_memoryHR
        cecho "Configured Max Memory Limit : $total_memoryHR $unit" $txt_color
#       human_readable $effective_tmp_table_size effective_tmp_table_sizeHR
#       cecho "Plus $effective_tmp_table_sizeHR $unit per temporary table created"
        human_readable $physical_memory physical_memoryHR
        cecho "Physical Memory : $physical_memoryHR $unit" $txt_color
        if [ $error -eq 1 ] ; then
                printf "\n"
                cecho "Max memory limit exceeds 90% of physical memory" $txt_color
        else
                cecho "Max memory limit seem to be within acceptable norms" green
        fi
        unset txt_color
}

## Required Functions  ##

login_validation () {
        check_for_socket                # determine the socket location -- 1st login
        check_for_plesk_passwords       # determine the login method -- 2nd login
        check_mysql_login               # determine if mysql is accepting login -- 3rd login
        export major_version=$($mysql -Bse "SELECT SUBSTRING_INDEX(VERSION(), '.', +2)")
#       export mysql_version_num=$($mysql -Bse "SELECT LEFT(REPLACE(SUBSTRING_INDEX(VERSION(), '-', +1), '.', ''),4)" )
        export mysql_version_num=$($mysql -Bse "SELECT VERSION()" |
                awk -F \. '{ printf "%02d", $1; printf "%02d", $2; printf "%02d", $3 }')

}

shared_info () {
        export major_version=$($mysql -Bse "SELECT SUBSTRING_INDEX(VERSION(), '.', +2)")
        # export mysql_version_num=$($mysql -Bse "SELECT LEFT(REPLACE(SUBSTRING_INDEX(VERSION(), '-', +1), '.', ''),4)" )
        export mysql_version_num=$($mysql -Bse "SELECT VERSION()" |
                awk -F \. '{ printf "%02d", $1; printf "%02d", $2; printf "%02d", $3 }')
        mysql_status \'Questions\' questions
#       socket_owner=$(find -L $socket -printf '%u\n')
        socket_owner=$(ls -nH $socket | awk '{ print $3 }')
}


get_system_info () {

    export OS=$(uname)

    # Get information for various UNIXes
    if [ "$OS" = 'Darwin' ]; then
        ps_socket=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }' | head -1)
        found_socks=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }')
        export physical_memory=$(sysctl -n hw.memsize)
        export duflags=''
    elif [ "$OS" = 'FreeBSD' ] || [ "$OS" = 'OpenBSD' ]; then
        ## On FreeBSD must be root to locate sockets.
        ps_socket=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }' | head -1)
        found_socks=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }')
        export physical_memory=$(sysctl -n hw.realmem)
        export duflags=''
    elif [ "$OS" = 'Linux' ] ; then
        ## Includes SWAP
        ## export physical_memory=$(free -b | grep -v buffers |  awk '{ s += $2 } END { printf("%.0f\n", s ) }')
        ps_socket=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }' | head -1)
        found_socks=$(netstat -ln | awk '/mysql(.*)?\.sock/ { print $9 }')
        export physical_memory=$(awk '/^MemTotal/ { printf("%.0f", $2*1024 ) }' < /proc/meminfo)
        export duflags='-b'
    elif [ "$OS" = 'SunOS' ] ; then
        ps_socket=$(netstat -an | awk '/mysql(.*)?.sock/ { print $5 }' | head -1)
        found_socks=$(netstat -an | awk '/mysql(.*)?.sock/ { print $5 }')
        export physical_memory=$(prtconf | awk '/^Memory\ size:/ { print $3*1048576 }')
    fi
    if [ -z $(which bc) ] ; then
        echo "Error: Command line calculator 'bc' not found!"
        exit
    fi
}


## Optional Components Groups ##

banner_info () {
        shared_info
        print_banner            ; echo
        check_mysql_version     ; echo
        post_uptime_warning     ; echo
}

misc () {
        shared_info
        check_slow_queries      ; echo
        check_binary_log        ; echo
        check_threads           ; echo
        check_used_connections  ; echo
        check_innodb_status     ; echo
}

memory () {
        shared_info
        total_memory_used       ; echo
        check_key_buffer_size   ; echo
        check_query_cache       ; echo
        check_sort_operations   ; echo
        check_join_operations   ; echo
}

file () {
        shared_info
        check_open_files        ; echo
        check_table_cache       ; echo
        check_tmp_tables        ; echo
        check_table_scans       ; echo
        check_table_locking     ; echo
}

all () {
        banner_info
        misc
        memory
        file
}

prompt () {
        prompted='true'
        read -p "Username [anonymous] : " user
        read -rp "Password [<none>] : " pass
        cecho " "
        read -p "Socket [ /var/lib/mysql/mysql.sock ] : " socket
        if [ -z $socket ] ; then
                export socket='/var/lib/mysql/mysql.sock'
        fi

        if [ -z $pass ] ; then
        export mysql="mysql -S $socket -u$user"
        export mysqladmin="mysqladmin -S $socket -u$user"
        else
        export mysql="mysql -S $socket -u$user -p$pass"
        export mysqladmin="mysqladmin -S $socket -u$user -p$pass"
        fi

        check_for_socket
        check_mysql_login

        if [ $? = 1 ] ; then
                exit 1
        fi
        read -p "Mode to test - banner, file, misc, mem, innodb, [all] : " REPLY
        if [ -z $REPLY ] ; then
                REPLY='all'
        fi
        case $REPLY in
                banner | BANNER | header | HEADER | head | HEAD)
                banner_info
                ;;
                misc | MISC | miscelaneous )
                misc
                ;;
                mem | memory |  MEM | MEMORY )
                memory
                ;;
                file | FILE | disk | DISK )
                file
                ;;
                innodb | INNODB )
                innodb
                ;;
                all | ALL )
                cecho " "
                all
                ;;
                * )
                cecho "Invalid Mode!  Valid options are 'banner', 'misc', 'memory', 'file', 'innodb' or 'all'" boldred
                exit 1
                ;;
        esac
}

## Address environmental differences ##
get_system_info
# echo $ps_socket

if [ -z "$1" ] ; then
        login_validation
        mode='ALL'
elif [ "$1" = "prompt" ] || [ "$1" = "PROMPT" ] ; then
        mode=$1
elif [ "$1" != "prompt" ] || [ "$1" != "PROMPT" ] ; then
        login_validation
        mode=$1
fi

case $mode in
        all | ALL )
        cecho " "
        all
        ;;
        mem | memory |  MEM | MEMORY )
        cecho " "
        memory
        ;;
        file | FILE | disk | DISK )
        cecho " "
        file
        ;;
        banner | BANNER | header | HEADER | head | HEAD )
        banner_info
        ;;
        misc | MISC | miscelaneous )
        cecho " "
        misc
        ;;
        innodb | INNODB )
        banner_info
        check_innodb_status ; echo
        ;;
        prompt | PROMPT )
        prompt
        ;;
        *)
        cecho "usage: $0 [ all | banner | file | innodb | memory | misc | prompt ]" boldred
        exit 1
        ;;
esac

Now make it executable by typing: chmod +x MyTuner.sh and run it by typing: ./MyTuner.sh

Step 4 – Update your settings accordingly

Now change your my.cnf file with the changes shown in the tuner.

That’s it, I hope this helped

Chris aka carpenox

How to – Scratch install ViciBox 11 on OpenSuSE Leap 15.5 with Asterisk 16.17.0-vici

Asterisk 18

How to – Scratch install ViciBox 11 on OpenSuSE Leap 15.5 with Asterisk 16.17.0-vici

Install Asterisk 16 on Vicidial

I have been asked to write up an article for a scratch install for ViciBox 11 on OpenSuSE Leap 15.5 with Asterisk 16.17-0-vici, so here it is.


zypper ar https://mirrorcache-us.opensuse.org/update/leap/15.5/oss/openSUSE:Leap:15.5:Update.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/devel:/languages:/perl/15.5/devel:languages:perl.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_15.5/devel:languages:php.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/devel:/languages:/python/15.5/devel:languages:python.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/home:/vicidial/openSUSE_Leap_15.5/home:vicidial.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/home:/vicidial:/vicibox/openSUSE_Leap_15.5/home:vicidial:vicibox.repo
zypper ar https://mirrorcache-us.opensuse.org/repositories/home:/zippy:/jx:/packages-ready/15.4/home:zippy:jx:packages-ready.repo



zypper ref
zypper up
zypper in dahdi*
zypper in libpri*
zypper in libedit*
zypper in net-snmp*
zypper in libjansson4*

zypper install sqlite3-devel mariadb-server mariadb make patch gcc gcc-c++ subversion php php-devel php-gd gd-devel php-mbstring php-mcrypt php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel httpd libpcap libpcap-devel libnet ncurses ncurses-devel screen mysql-devel ntp mutt wget nano unzip sipsak sox libuuid-devel httpd php-common php-pdo mod_ssl perl-DBI perl-DBD-MySQL perl-Digest-HMAC perl-YAML perl-ExtUtils-ParseXS perl-NetAddr-IP perl-Crypt-SSLeay perl-Curses perl-DBD-Pg perl-Module-ScanDeps perl-Text-CSV perl-HTML-Template perl-IO-Compress perl-Text-Glob perl-Jcode perl-Test-Script perl-Archive-Tar perl-Test-Base perl-OLE-Storage_Lite perl-Archive-Zip perl-Net-Server perl-Convert-ASN1 perl perl-Compress-Raw-Zlib perl-Digest-SHA1 perl-Data-Dumper perl-Error perl-ExtUtils-CBuilder perl-Test-Tester perl-Parse-RecDescent perl-Spiffy perl-IO-Zlib perl-Module-Build perl-HTML-Parser perl-Net-SSLeay perl-Proc-ProcessTable perl-TermReadKey perl-Term-ReadLine-Gnu perl-Digest-SHA perl-Tk perl-Net-SNMP perl-Test-NoWarnings perl-XML-Writer perl-Proc-PID-File perl-Compress-Raw-Bzip2 perl-libwww-perl perl-XML-Parser perl-File-Remove perl-Parse-CPAN-Meta perl-Set-Scalar perl-Probe-Perl perl-File-Which perl-Package-Constants perl-Module-Install perl-File-HomeDir perl-Spreadsheet-ParseExcel perl-Mail-Sendmail perl-Spreadsheet-XLSX asterisk-perl perl-version perl-Crypt-DES perl-URI perl-Net-Daemon perl-IO-stringy perl-YAML-Tiny perl-HTML-Tagset perl-Socket6 perl-BSD-Resource perl-IPC-Run3 perl-Text-CSV_XS perl-Unicode-Map perl-Net-Telnet perl-PAR-Dist perl-Date-Manip perl-JSON perl-rrdtool lame screen iftop htop perl-GD gcc gcc-c++- bzip2 make libjansson-devel dahdi-linux-devel libxml2-tools libxml2-2 libxml2-devel libuuid-devel sqlite3-devel



perl -MCPAN -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'

cpan -i String::CRC Tk::TableMatrix Net::Address::IP::Local Term::ReadLine::Gnu Spreadsheet::Read Net::Address::IPv4::Local RPM::Specfile Spreadsheet::XLSX Spreadsheet::ReadSXC MD5 Digest::MD5 Digest::SHA1 Bundle::CPAN Pod::Usage Getopt::Long DBI DBD::mysql Net::Telnet Time::HiRes Net::Server Mail::Sendmail Unicode::Map Jcode Spreadsheet::WriteExcel OLE::Storage_Lite Proc::ProcessTable IO::Scalar Scalar::Util Spreadsheet::ParseExcel Archive::Zip Compress::Raw::Zlib Spreadsheet::XLSX Test::Tester Spreadsheet::ReadSXC Text::CSV Test::NoWarnings Text::CSV_PP File::Temp Text::CSV_XS Spreadsheet::Read LWP::UserAgent HTML::Entities HTML::Strip HTML::FormatText HTML::TreeBuilder Switch Time::Local MIME::POP3Client Mail::IMAPClient Mail::Message IO::Socket::SSL readline 

cd /usr/bin/
curl -LOk http://xrl.us/cpanm
chmod +x cpanm
cpanm -f File::Which
cpanm -f File::HomeDir
cpanm CPAN::Meta::Requirements
cpanm -f CPAN
cpanm -f DBD::mysql
cpanm User::Identity --force
cpanm YAML MD5 Digest::MD5 Digest::SHA1 Curses Getopt::Long Net::Domain Term::ReadKey Term::ANSIColor HTML::FormatText MIME::Decoder Mail::POP3Client Mail::Message Crypt::Eksblowfish::Bcrypt

### Create DB & Cron user
mysql
CREATE DATABASE `asterisk` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'cron'@'localhost' IDENTIFIED BY '1234';
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@'%' IDENTIFIED BY '1234';
GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES on asterisk.* TO cron@localhost IDENTIFIED BY '1234';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
flush privileges;
exit

### Install Asterisk 16 ###
mkdir /usr/src/asterisk
wget http://download.vicidial.com/beta-apps/asterisk-16.17.0-vici.tar.gz
tar -xzvf asterisk-16.17.0-vici.tar.gz
./configure --libdir=/usr/lib64 --with-pjproject-bundled -with-jansson-bundled
make && make install && make samples && make config && make basic-pbx
/usr/share/astguiclient/start_asterisk_boot.pl

Want to upgrade to Asterisk 18? Click here

mkdir /usr/src/astguiclient
cd /usr/src/astguiclient
svn checkout svn://svn.eflo.net:3690/agc_2-X/trunk

mysql
SET GLOBAL connect_timeout=60;
use asterisk;
\. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql
\. /usr/src/astguiclient/trunk/extras/first_server_install.sql
ALTER TABLE phones ALTER template_id SET DEFAULT '';
quit

/usr/src/astguiclient/trunk/install.pl
/usr/share/astguiclient/ADMIN_area_code_populate.pl
/usr/src/astguiclient/trunk/bin/ADMIN_update_server_ip.pl

nano /etc/rc.local

### paste this below: 

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# OPTIONAL enable ip_relay(for same-machine trunking and blind monitoring)
/usr/share/astguiclient/ip_relay/relay_control start 2>/dev/null 1>&2

# Disable console blanking and powersaving
/usr/bin/setterm -blank
/usr/bin/setterm -powersave off
/usr/bin/setterm -powerdown

### start up the MySQL server
systemctl start mariadb.service
systemctl enable mariadb.service

### start up the apache web server
systemctl start apache2
systemctl enable apache2

### roll the Asterisk logs upon reboot
/usr/share/astguiclient/ADMIN_restart_roll_logs.pl

### clear the server-related records from the database
/usr/share/astguiclient/AST_reset_mysql_vars.pl

### load dahdi drivers
modprobe dahdi
/usr/sbin/dahdi_cfg -vvvvvvvvvvvvv

### sleep for 20 seconds before launching Asterisk
sleep 20

### start up asterisk
/usr/share/astguiclient/start_asterisk_boot.pl


############## END PASTE HERE ##################


crontab -e

### paste below:

### recording mixing/compressing/ftping scripts
#0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl --MIX
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl
1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --GSM
#2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --GSM

### keepalive script for astguiclient processes
* * * * * /usr/share/astguiclient/ADMIN_keepalive_ALL.pl --cu3way

### kill Hangup script for Asterisk updaters
* * * * * /usr/share/astguiclient/AST_manager_kill_hung_congested.pl

### updater for voicemail
* * * * * /usr/share/astguiclient/AST_vm_update.pl

### updater for conference validator
* * * * * /usr/share/astguiclient/AST_conf_update.pl

### flush queue DB table every hour for entries older than 1 hour
11 * * * * /usr/share/astguiclient/AST_flush_DBqueue.pl -q

### fix the vicidial_agent_log once every hour and the full day run at night
33 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl
50 0 * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --last-24hours
## uncomment below if using QueueMetrics
#*/5 * * * * /usr/share/astguiclient/AST_cleanup_agent_log.pl --only-qm-live-call-check

## uncomment below if using Vtiger
#1 1 * * * /usr/share/astguiclient/Vtiger_optimize_all_tables.pl --quiet

### updater for VICIDIAL hopper
* * * * * /usr/share/astguiclient/AST_VDhopper.pl -q

### adjust the GMT offset for the leads in the vicidial_list table
1 1,7 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --debug

### reset several temporary-info tables in the database
2 1 * * * /usr/share/astguiclient/AST_reset_mysql_vars.pl

### optimize the database tables within the asterisk database
3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl

## adjust time on the server with ntp
30 * * * * /usr/sbin/ntpdate -u pool.ntp.org 2>/dev/null 1>&2

### VICIDIAL agent time log weekly and daily summary report generation
2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl
22 0 * * * /usr/share/astguiclient/AST_agent_day.pl

### VICIDIAL campaign export scripts (OPTIONAL)
#32 0 * * * /usr/share/astguiclient/AST_VDsales_export.pl
#42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl

### remove old recordings more than 7 days old
#24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f

### roll logs monthly on high-volume dialing systems
#30 1 1 * * /usr/share/astguiclient/ADMIN_archive_log_tables.pl

### remove old vicidial logs and asterisk logs more than 2 days old
28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f
29 0 * * * /usr/bin/find /var/log/asterisk -maxdepth 3 -type f -mtime +2 -print | xargs rm -f
30 0 * * * /usr/bin/find / -maxdepth 1 -name "screenlog.0*" -mtime +4 -print | xargs rm -f

### cleanup of the scheduled callback records
25 0 * * * /usr/share/astguiclient/AST_DB_dead_cb_purge.pl --purge-non-cb -q

### GMT adjust script - uncomment to enable
#45 0 * * * /usr/share/astguiclient/ADMIN_adjust_GMTnow_on_leads.pl --list-settings

### Dialer Inventory Report
1 7 * * * /usr/share/astguiclient/AST_dialer_inventory_snapshot.pl -q --override-24hours

### inbound email parser
* * * * * /usr/share/astguiclient/AST_inbound_email_parser.pl

################ END PASTE HERE ####################



reboot

go to http://127.0.0.1/vicidial/admin.php

I honestly have not tested this so whoever tried it please comment below any problems you had, errors or anything that was wrong. Also post if it worked without issue. Thank you

-Chris aka carpenox

P.S. – You may have to run this fix for dahdi on the latest kernel on Leap 15.5 – How to – Fix ViciBox 11 after kernel update

How to – Upgrade Asterisk 13/16 to Asterisk 18

Asterisk 18

How to – Upgrade Asterisk 13/16 to Asterisk 18

This post will go over the steps to upgrade your asterisk from 13 or 16 to Asterisk 18. It was pretty easy except for one little bug I ran into but there’s any easy fix for it. Ok so let’s get started.

Step 1 – Download Asterisk 18 to your server.

Screenshot 20230725 1036162

We need to get the file from the Asterisk website for version 18 which can be found at https://downloads.asterisk.org/pub/telephony/asterisk

Go to your source directory by typing “cd /usr/src/asterisk/” – If the directory doesn’t exist, create it by using mkdir.

Now locate the file you need on the asterisk website (shown below).

Time to download the file by typing “wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18.19.0.tar.gz”

Unzip the file and then we will begin compiling.

Screenshot 20230725 1036512

Step 2 – Compile Asterisk

We will need Asterisk to be patched with ViciDial changes for it to work correctly. Follow this article. To compile Asterisk, first we need to go to it’s folder by typing “cd /etc/asterisk”. Once here type the following 4 commands:

./configure

make menuselect

make && make install

Step 3 – Remove old modules

Screenshot 20230725 1402182

Remove the 4 files listed above from the directory it tells you. For me it was:

/usr/lib/asterisk/modules

Step 4 – Restart Asterisk

Login to asterisk and restart it by doing “core restart now”. That’s it, you’re now using Asterisk 18.

Screenshot 20230725 1342442

If for some reason Asterisk doesn’t start up after you restart it, type “screen asterisk vvc” and of it keeps you in the screen press control+A then control+D

How to – Setup Two Factor Authentication (2FA) on your ViciDial system

2FA

How to – Setup Two Factor Authentication (2FA) on your ViciDial system

This article will go over how to setup two factor authentication on your Vicidial system using the phone method. Later on I will add the SMS and Email methods.

Step 1 – Create the 2FA settings container

First we need to create the 2FA settings container that we will need to choose in system settings when we enable two factor authentication. Below is an example of how to setup a container for a phone call auth:

2FA settings container

Step 2 – Set an email and mobile phone on the admin user

You must make sure to add an email and mobile phone to the admin user you are saying 2FA for or you will lock yourself out of the system.

2FA requirements

Step 3 – Enable two factor authentication on system settings

The next thing we need to do is turn this feature on and set a couple variables needed for it to work. To do this go to Admin then system settings as shown below:

Two Factor authentication

Now when you hit submit, it’s going to turn on 2FA and if you didn’t set it up correctly you will be locked out of the system for good or until you fix it via MySQL with the following code:

mysql -p
> use asterisk
> UPDATE system_settings SET two_factor_auth_hours='0';

If you did everything correctly you should see this when you try to login:

Screenshot 20230611 1423572

Hopefully this has helped you guys set this up with less headache than I went through.

Chris aka carpenox

Why do my agents say paused when they are on a live call?

CyburDial Realtime Screen

Why do my agents say paused when they are on a live call?

Why do your agents say paused while still on a live call? The simple answer is Google. Yes Chrome has enabled a more complex JavaScript throttling which you can read more about on ViciDial’s docs section here. There’s a few ways to fix this problem. One is to just use webphones and it won’t happen. The second is to enable hidden sounds in system settings and finally, the third is to change Agent Screen Timer from “setTimeout” to “EventSource”

Option 1 – Use WebPhones(WebRTC)

Just install and use webphones which you can do following these directions.

CyburPhone
CyburPhone

Option 2 – Enable hidden sounds

Within System Settings you can enable a feature called hidden sounds. You set a volume which doesn’t matter because it’s silent but I chose 25 and then set the timer for how long. Then set the sound of not auto selected but choose “click_quiet”. Now with Google’s new throttling settings which will time you out as early as 10 seconds, set this to 5 as shown below:

Screenshot 20230605 1132042

Option 3 – Change “Agent Screen Timer”

Change the Agent Screen Timer from setTimeout to EventSource in system settings as shown below:

Agent Screen Timer

This can also be changed to “setTimeoutAudioLoop” of the first change didn’t help.

Hopefully one of these 3 options will help you get back to business as usual. When your ready to have a custom system built with full CRM integrations and API features gone over with you one by one figuring out how we can make your business more efficient and profitable then join my chat and one of our trips will help you get started or fill out this form and someone will reach out to you. I hope this has helped.

Chris aka carpenox

Optimize Outbound Calls with Predictive and Automated Dialer Software 

CyburDial

Optimize Outbound Calls with Predictive and Automated Dialer Software 

outboundcalls

Every second counts when it comes to sales.

And you know time is money. This is why cloud-based predictive dialer and auto dialer software is in demand these days.

These systems help you save time and optimize outbound calls by connecting agents to quality leads while offering capabilities to enhance customer satisfaction, agent productivity, and revenue.

Previously, agents had to manually dial each phone number, wait for leads to attend the call, and manage everything in traditional systems. As a result, much of their time was spent on other stuff than their core job: selling. This is why they used to make fewer calls every day, which can negatively influence revenue.

Predictive and auto dialer software solves these issues by automating manual, repetitive tasks that include automatic dialing, managing lists, scheduling, notifications, reports, and more with lots of additional features to help you and your agents further.

In this article, I’ll discuss the software, how it can help your agents and bring more revenue and growth to your business.

Ready?

Let’s go! ?

Auto Dialer Software

autodialer

Autodialer software is a system that dials phone numbers automatically for agents. It either assigns calls to available agents or plays recorded messages when someone answers the calls.

Auto dialers increase agent efficiency with automation and can manage more extensive outbound campaigns with heavy call volumes. They can also increase dial rates, aid in monitoring performance, reduce unproductive calls, and help increase conversion rates.

Most of these solutions are cloud-based and used by call centers to save time and streamline the process of connecting to prospects or customers without manual methods. It has different use cases such as telemarketing, market research, political campaigns, cold-emailing, and broadcasting payment reminders, service outages, appointment reminders, and more.

Benefits

  • The software reduces agents’ idle time by assigning only quality calls to save time and increase their productivity.
  • It offers better conversion rates by simplifying and accelerating complex sales processes while showing agents all the essential information about contacts.
  • You get real-time insights and reporting into your call performance, agent activity, and operations so you can enhance each aspect for better performance.
  • It improves your operational efficiency with the power of automation for dialing, follow-ups, reminders, and so on.
  • The software helps you stay compliant and avoid the risks of penalties.

Predictive Dialer Software

predictivedailer

Predictive dialer software is a system that can automate the dialing and matching of phone numbers. It can automate calls seamlessly to enable sales reps to track all the missed calls, busy signals, no response calls, and so on.

Predictive dialers have more capabilities than just dialing numbers automatically. They predict human activities and actions using mathematical algorithms to figure out when a prospect or customer can take the calls. In addition to that, you can dial multiple phone numbers simultaneously using them.

The primary usage of these systems is to boost agent efficiency by connecting them to the right contacts at a suitable time for more conversions. Predictive dialers are utilized in call centers, the banking sector, and more.

Benefits

  • It offers intelligent call assigning to only the available agents
  • The software lets you organize and manage the client database seamlessly and update it
  • It works for both outbound and inbound calls
  • With excellent reporting, you can track the performance of teams and agents and train them accordingly.
  • It optimizes your agents, sales team, and overall organization by creating a competitive, productive environment for all the members.
  • It offers automatic workload management and assignment without human interference, prejudices, or bias.

Now take a look at CyburDial and why it ranks among the top dialer systems in the market.

CyburDial
CyburDial Access Portal

Why doesn’t my ViciBox 10.0.2 install work?

Data Center

Why doesn’t my ViciBox 10.0.2 install work?

So it seems that there is duplicate Listen directives for apache, more specifically, targeted towards the dynamic portal. What you need to do it edit the listen.conf for apache. You can do so by copying and pasting the following command into your Linux CLI:

nano /etc/apache2/listen.conf

You should now see what you see below. You’ll notice there is 2 entries for ports 81 and 446, just remove one from each and restart apache with “service apache2 restart”. That’s it, browse to your ViciDial admin URL and login.

Listen 80
Listen 81
Listen 81

<IfDefine SSL>
<IfDefine !NOSSL>
<IfModule mod_ssl.c>

   Listen 443
   Listen 446
   Listen 446

 </IfModule>
 </IfDefine>
</IfDefine>
Data center
The hall of ViciDial servers.

That’s all there is to it, you should now have a working ViciBox install. Of you have any questions, feel free to comment here or join our group chat that has over 175 members from the ViciDial forums: https://join.skype.com/ujkQ7i5lV78O <—Click here or scam the QR Code below to join.

IMG 20230602 171449 01 edited

I hope this has helped

Chris aka carpenox

How To – Fix the Perl repo for ViciBox 10(Leap 15.3)

Repository 'openSUSE-Leap-15.2-PHP-Applications' is invalid.

How To – Fix the Perl repo for ViciBox 10(Leap 15.3)

If you’ve tried to update your ViciBox 10 system you’ll see that the Perl repo gives an error and you can’t update from that repo any longer. The reason for this is because Leap 15.3 has gone end of life(EOL) and will no longer be getting updates. The other repos will begin to die as well and your system will remain vulnerable to hackers as dialer system are high priority targets right now for ransomware groups, denialof service attackers and crypto miners. So how do you fix this issue? You upgrade to leap 15.4 following this article: How to – Upgrade OpenSuSE Leap 15.3 to 15.4.

Repository 'openSUSE-Leap-15.2-PHP-Applications' is invalid.
Repository ‘openSUSE-Leap-15.3-PERL’ is invalid.

Hopefully this helps those of you running into this problem and you’ll now be able to keep your systems secure.

Chris aka carpenox

How to – Upgrade OpenSuSE Leap 15.3 to 15.4

How to – Upgrade OpenSuSE Leap 15.3 to 15.4

This article will go over how to upgrade Leap 15.3 to 15.4 since 15.3 is end of life

Step 1. Preparations – Backup everything

Keep verified backups: Do not skip this step. Before typing the following commands, you must back up all data and config files. Also, ensure your system backup is up-to-date and restorable in an emergency. The author or nixCraft is not liable for damages due to failed upgrades.

Step 2. Update OpenSUSE 15.3 packages

The openSUSE Leap version 15.3 is only available as the 64-bit release. Next, type the following zypper command to update all existing packages. To refresh a repo, enter:
$ sudo zypper ref
Outputs:

Repository 'openSUSE-Leap-15.3' is up to date.                                                     
Repository 'openSUSE-Leap-15.3-Update' is up to date.                                              
Repository 'openSUSE-Leap-15.3-Update-Non-Oss' is up to date.                                      
Repository 'Update repository of openSUSE Backports' is up to date.                                
Retrieving repository 'Update repository with updates from SUSE Linux Enterprise 15' metadata[done]
Building repository 'Update repository with updates from SUSE Linux Enterprise 15' cache ....[done]
All repositories have been refreshed.

Update ALL installed packages with newer versions and patches

Before the upgrade procedure can begin, apply all pending upgrades or security patches. For example:
$ sudo zypper up
Outputs:

Loading repository data...
Warning: Repository 'openSUSE-Leap-15.3-Update' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

The following 10 packages are going to be upgraded:
  cups cups-client cups-config libcups2 libcupscgi1 libcupsimage2 libcupsmime1 libcupsppdc1
  libfreetype6 libqpdf26

10 packages to upgrade.
Overall download size: 8.4 MiB. Already cached: 0 B. After the operation, additional 79.8 KiB will
be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package cups-config-2.2.7-150000.3.35.1.x86_64    (1/10), 239.1 KiB (  3.1 MiB unpacked)
Retrieving: cups-config-2.2.7-150000.3.35.1.x86_64.rpm ......................................[done]
Retrieving package libfreetype6-2.10.4-150000.4.12.1.x86_64  (2/10), 447.3 KiB (  1.1 MiB unpacked)
Retrieving: libfreetype6-2.10.4-150000.4.12.1.x86_64.rpm ....................................[done]
....
..
Checking for file conflicts: ................................................................[done]
( 1/10) Installing: cups-config-2.2.7-150000.3.35.1.x86_64 ..................................[done]
( 2/10) Installing: libfreetype6-2.10.4-150000.4.12.1.x86_64 ................................[done]
( 3/10) Installing: libqpdf26-9.0.2-150200.3.3.1.x86_64 .....................................[done]
....
( 9/10) Installing: cups-client-2.2.7-150000.3.35.1.x86_64 ..................................[done]
Failed to try-restart cups-lpd@.service: Unit name cups-lpd@.service is missing the instance name.
See system logs and 'systemctl status cups-lpd@.service' for details.
(10/10) Installing: cups-2.2.7-150000.3.35.1.x86_64 .........................................[done]
Executing %posttrans scripts ................................................................[done]

Step 3. Reboot the server

How To Upgrade OpenSUSE Leap To 15.4

Now note down the current Linux kernel version, type:
$ uptime
$ uname -mrs

You must reboot the Linux cloud box, using the shutdown command or reboot command:
$ sudo systemctl reboot
## OR ##
$ sudo shutdown -r now

Log in using the ssh command once system comes back online:
$ ssh ec2-user@your-aws-ec2-dns-ip-here
## OR ##
$ ssh root@your-Linode-dnsname-OR-ip-here

Then verify Linux kernel version:
$ uname -mrs
Also note down the OpenSUSE Linux version using the cat command:
$ cat /etc/os-release

Step 4. Upgrading OpenSUSE 15.3 to 15.4

Now my cloud server is fully patched. It is time to update the server to OpenSUSE version 15.4.

List the repositories

The update repository must exist and is enabled and update before upgrading to 15.3. Verify it using the zypper command as follows:
$ sudo zypper repos --uri
## OR type ##
$ sudo zypper lr -u

Output indicating that there are no 3rd party repos and Update repos are enabled on my OpenSUSE 15.3 server:

Repository priorities are without effect. All enabled repositories share the same priority.
 
# | Alias                             | Name                                                                                        | Enabled | GPG Check | Refresh | URI
--+-----------------------------------+---------------------------------------------------------------------------------------------+---------+-----------+---------+---------------------------------------------------------------
1 | openSUSE-Leap-15.3                | openSUSE-Leap-15.3                                                                          | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.3/repo/oss/
2 | openSUSE-Leap-15.3-Update         | openSUSE-Leap-15.3-Update                                                                   | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.3/oss/
3 | openSUSE-Leap-15.3-Update-Non-Oss | openSUSE-Leap-15.3-Update-Non-Oss                                                           | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.3/non-oss/
4 | repo-backports-debug-update       | Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports | No      | ----      | ----    | http://download.opensuse.org/update/leap/15.3/backports_debug/
5 | repo-backports-update             | Update repository of openSUSE Backports                                                     | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.3/backports/
6 | repo-sle-debug-update             | Update repository with debuginfo for updates from SUSE Linux Enterprise 15                  | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.3/sle/
7 | repo-sle-update                   | Update repository with updates from SUSE Linux Enterprise 15                                | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.3/sle/

Verify that we can get latest OpenSUSE 15.4 version, run:
$ sudo zypper --releasever=15.4 lr -u
Here is what I see

Warning: Enforced setting: $releasever=15.4
Repository priorities are without effect. All enabled repositories share the same priority.
 
# | Alias                             | Name                                                                                        | Enabled | GPG Check | Refresh | URI
--+-----------------------------------+---------------------------------------------------------------------------------------------+---------+-----------+---------+---------------------------------------------------------------
1 | openSUSE-Leap-15.3                | openSUSE-Leap-15.3                                                                          | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.4/repo/oss/
2 | openSUSE-Leap-15.3-Update         | openSUSE-Leap-15.3-Update                                                                   | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/oss/
3 | openSUSE-Leap-15.3-Update-Non-Oss | openSUSE-Leap-15.3-Update-Non-Oss                                                           | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/non-oss/
4 | repo-backports-debug-update       | Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports | No      | ----      | ----    | http://download.opensuse.org/update/leap/15.4/backports_debug/
5 | repo-backports-update             | Update repository of openSUSE Backports                                                     | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/backports/
6 | repo-sle-debug-update             | Update repository with debuginfo for updates from SUSE Linux Enterprise 15                  | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.4/sle/
7 | repo-sle-update                   | Update repository with updates from SUSE Linux Enterprise 15                                | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/sle/

In the above output results, check the last URI column). All repository links should contain 15.4 or openSUSE_Leap_15.4 as a version number. If not check if your Leap repos defined in /etc/zypp/repos.d/ are using the $releasever variable already in the URIs. For example, try the grep command:
$ sudo grep baseurl /etc/zypp/repos.d/*.repo
If you see hard-coded version 15.3 Leap version number, then you need to modify them first. This can be done using the sed command to find and replace with sed:
$ sudo sed -i 's/15.3/${releasever}/g' /etc/zypp/repos.d/*.repo
Now verify again:
$ sudo zypper --releasever=15.4 lr -u

Running the upgrade for 15.4

It is time to switch and refresh all repositories to 15.4 using the following syntax and grab the repository metadata:
$ sudo zypper --releasever=15.4 ref
For slower

Warning: Enforced setting: $releasever=15.4
Retrieving repository 'openSUSE-Leap-15.3' metadata ................................................................................................................................................................................................................................[done]
Building repository 'openSUSE-Leap-15.3' cache .....................................................................................................................................................................................................................................[done]
Retrieving repository 'openSUSE-Leap-15.3-Update' metadata .........................................................................................................................................................................................................................[done]
Building repository 'openSUSE-Leap-15.3-Update' cache ..............................................................................................................................................................................................................................[done]
Retrieving repository 'openSUSE-Leap-15.3-Update-Non-Oss' metadata .................................................................................................................................................................................................................[done]
Building repository 'openSUSE-Leap-15.3-Update-Non-Oss' cache ......................................................................................................................................................................................................................[done]
Retrieving repository 'Update repository of openSUSE Backports' metadata ...........................................................................................................................................................................................................[done]
Building repository 'Update repository of openSUSE Backports' cache ................................................................................................................................................................................................................[done]
Retrieving repository 'Update repository with updates from SUSE Linux Enterprise 15' metadata ......................................................................................................................................................................................[done]
Building repository 'Update repository with updates from SUSE Linux Enterprise 15' cache ...........................................................................................................................................................................................[done]
All repositories have been refreshed.

Next, execute the following command for full distribution upgrade to 15.4 from 15.3. Please note that command must be typed from non-GUI (KDE/GNOME) mode. Hence, it is recommended you run the command from either runlevel 3 (text + network), or a virtual console (see how to switch boot target to text or GUI in systemd Linux for more info.). You can press Ctrl-Alt-F2 (all at the same time) to switch to virtual terminal 2. One can also issue the following command:
$ sudo systemctl set-default multi-user.target
Let us start the distribution upgrade that will get your system to the new version:
$ sudo zypper --releasever=15.4 dup
OR first download everything on slower internet connection to avoid any problem with upgrades:
$ sudo zypper --releasever=15.4 dup --download-in-advance
Once the dup is finished, openSUSE sets the releasever variable to the new version 15.4:

Final confirmation

At the following prompt type y and hit the [Enter] key to start upgrade procedure:

The following 11 packages are going to be REMOVED:
  kernel-default-5.3.18-150300.59.87.1 kernel-default-5.3.18-150300.59.90.1 kernel-default-extra-5.3.18-150300.59.87.1
  kernel-default-extra-5.3.18-150300.59.90.1 kernel-default-optional-5.3.18-150300.59.87.1
  kernel-default-optional-5.3.18-150300.59.90.1 librsvg-lang libusbguard0 libwebkit2gtk3-lang libyui-ncurses-pkg15
  systemd-icon-branding-openSUSE
 
The following package requires a system reboot:
  kernel-default-5.14.21-150400.24.18.1
 
486 packages to upgrade, 4 to downgrade, 55 new, 11 to remove.
Overall download size: 688.7 MiB. Already cached: 0 B. After the operation, additional 51.0 MiB will be used.
 
    Note: System reboot required.
Continue? [y/n/v/...? shows all options] (y): y

The zypper command will download, install, or upgrade a total of 486 packages on my cloud server. The procedure to download and install packages takes its own sweet time. So, naturally, your Internet and cloud server speed plays a significant role. In the end, you should see an output as follows showing you must reboot the OpenSUSE server or desktop:

....
..
dracut: *** Stripping files done ***
dracut: *** Creating image file '/boot/initrd-5.14.21-150400.24.18-default' ***
dracut: *** Creating initramfs image file '/boot/initrd-5.14.21-150400.24.18-default' done ***
(403/552) Installing: kernel-default-5.14.21-150400.24.18.1.x86_64 ......................................................[done]
(404/552) Removing kernel-default-5.3.18-150300.59.87.1.x86_64 ..........................................................[done]
(405/552) Removing kernel-default-5.3.18-150300.59.90.1.x86_64 ..........................................................[done]
(406/552) Installing: util-linux-lang-2.37.2-150400.8.3.1.noarch ........................................................[done]
(407/552) Installing: systemd-network-249.12-150400.8.10.1.x86_64 .......................................................[done]
(408/552) Installing: kernel-default-extra-5.14.21-150400.24.18.1.x86_64 ................................................[done]
(409/552) Installing: grub2-systemd-sleep-plugin-2.06-150400.11.5.2.noarch ..............................................[done]
.....
..
Executing %posttrans scripts ............................................................................................[done]
There are running programs which still use files and libraries deleted or updated by recent upgrades. They should be restarted to benefit from the latest updates. Run 'zypper ps -s' to list these programs.
 
Since the last system boot core libraries or services have been updated.
Reboot is suggested to ensure that your system benefits from these updates.

Therefore, reboot the Linode or AWS cloud server using the shutdown command or reboot command as follows:
$ sudo reboot

Step 5: Verification

How to Upgrade OpenSUSE 15.3 to OpenSUSE 15.4 and verify it

Make sure everything is working. First, find OpenSuse Linux Version and other info:
$ uname -mrs
$ cat /etc/os-release
$ hostnamectl


Then check your Linux server log file. For instance, use the journalctl command/tail command/dmesg command command and others:
$ sudo tail -f /var/log/nginx/www.nixcraft_com_access.log
$ dmesg | more
$ journalctl -xe

Step 6: Apply any newly released updates

Finally, again use the zypper command to apply security patches, software updates and Linux kernel:
$ sudo zypper refresh
$ sudo zypper patch
$ sudo zypper update
# if a new Linux kernel installed, reboot the box
$ sudo reboot

Hopefully this will help a lot of you keep up to date and secure

Chris aka carpenox

What does – The statuses at the bottom of each list mean?

List statuses

What does – The statuses at the bottom of each list mean?

List Statuses Breakdown

In this article, I will go over what the list statuses mean in relation to reporting. What I’m talking about is at the bottom of each list as shown in the picture below:

List statuses

All of these different statuses can become pretty confusing, especially because they are not all on the agent screen and some are not even on the system statuses either which becomes really challenging. Ok so let’s stay from the to, I’ll outline them all on a simple “List” layout.

  • A – Answering machine disposition marked by an agent
  • AA – Answering machine disposition automatically detected by the AMD(Answering Machine Detection) system
  • AB – Busy signal automatically detected by the carrier
  • ADC – Disconnected number detected by carrier
  • ADCT – Congested number reported by carrier
  • B – Busy disposition marked by agent
  • CallBK – Agent setup a callback which can be done in there agent interface and a calendar down to them
  • CBHold – Scheduled ANYONE callback that has not hit it’s trigger, or an AGENTONLY callback
  • DAIR – Dead air dispo marked by an agent, usually because they hear nothing when they get the call
  • DC – Disconnected number marked by an agent
  • Dec – Declined sale dispo marked by agent because customer denied ever purchasing anything from your business
  • DNC – Do Not Call dispo marked by agent, usually requested by customer
  • DNCL – Do Not Call dispo automatically marked by system because a number already marked DNC was in there Hopper
  • ERI – Agent error – usually closes browser accidentally or logs out accidentally, or similar

The next 5 dispos are related to KHOMP AMD also used with a 3rd party service called AI AMD(Artificially Intelligent Answering Machine Detection) If interested in this message me via Skype -:- live:carpenox_3 | Back to the list statuses

  • N – No Answer dispo marked by the agent, usually because no one answered the phone
  • NA – No Answer dispo automatically detected, Any outbound call that does not receive an Answer signal(or other signal) from the carrier. This can include ring-no-answer, disconnected, carrier congestion and other errors
  • New – New Lead, never called
  • NI – Not Interested dispo marked by agent
  • NP – No Pitch No Price dispo marked by agent, didn’t get a chance to read the pitch and/or give the price
  • Sale – Agent closed the call and made the sale

The last thing I want to go over is the other columns, “called”, “not called”, “dialable” and”penetration”.

  • Called – The number of leads dialed since the lists last reset
  • Not Called – The amount of leads not called since last reset
  • Dialable – How many of the “Not Called” leads are dialable at that time, in my example you’ll see 0 because when I took that screen shot I was outside of allowed call times for that campaign or list. So it shows you dialable leads within time zone parameters
  • Penetration – Some dispos get the lead marked as “completed”, such as Sale, DNC, Not interested, etc. So as leads with a completed status get marked, it takes those out of rotation and calculated what percent along with all the rest of the dispositions and puts it as penetrated

Campaign List Statuses

The other place you’ll see a similar layout of statuses is at the bottom of any campaign. I’ll go over what this means as well. Below is a picture to help you follow along:

Screenshot 20230512 0325112

As you can see above it looks very similar to the results on the bottom of each list, except this combines all active lists on the campaign and shows you only called and not called results. What this means is the numbers next to each dispo for the called campaign have all been dialed since the last reset of the lists attached and active, and the same for the not called except those numbers are how many leads have not been dialed since the last lists reset.

I hope this article has helped some of you that may have been confused about this past of the system, comment below or join our chat: https://join.skype.com/ujkQ7i5lV78O of you have any questions.

Chris aka carpenox