Added skel for ndb status collector

This commit is contained in:
Fernando Ipar
2017-10-09 22:26:46 -03:00
parent b44138fd7c
commit 58d1d2c3b4
3 changed files with 29 additions and 55 deletions

View File

@@ -921,6 +921,10 @@ collect_mysql_innodb_status () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'SHOW /*!50000 ENGINE*/ INNODB STATUS' 2>/dev/null
}
collect_mysql_ndb_status () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'show /*!50000 ENGINE*/ NDB STATUS' 2>/dev/null
}
collect_mysql_processlist () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'SHOW FULL PROCESSLIST' 2>/dev/null
}
@@ -1026,6 +1030,7 @@ collect_mysql_info () {
collect_mysql_plugins > "$dir/mysql-plugins"
collect_mysql_slave_status > "$dir/mysql-slave"
collect_mysql_innodb_status > "$dir/innodb-status"
collect_mysql_ndb_status > "$dir/ndb-status"
collect_mysql_processlist > "$dir/mysql-processlist"
collect_mysql_users > "$dir/mysql-users"
@@ -1374,7 +1379,7 @@ pretty_print_cnf_file () {
perl -n -l -e '
my $line = $_;
if ( $line =~ /^[ \t]*[a-zA-Z[]/ ) {
if ( $line =~ /^\s*[a-zA-Z[]/ ) {
if ( $line=~/\s*(.*?)\s*=\s*(.*)\s*$/ ) {
printf("%-35s = %s\n", $1, $2)
}
@@ -1387,6 +1392,7 @@ pretty_print_cnf_file () {
}
find_checkpoint_age() {
local file="$1"
awk '
@@ -1576,6 +1582,13 @@ format_innodb_status () {
fi
}
format_ndb_status() {
local file=$1
[ -e "$file" ] || return
cat "$file"
}
format_overall_db_stats () {
local file="$1"
local tmpfile="$PT_TMPDIR/format_overall_db_stats.tmp"
@@ -2097,19 +2110,6 @@ section_mysqld () {
done < "$executables_file"
}
section_slave_hosts () {
local slave_hosts_file="$1"
[ -e "$slave_hosts_file" ] || return
section "Slave Hosts"
if [ -s "$slave_hosts_file" ]; then
cat "$slave_hosts_file"
else
echo "No slaves found"
fi
}
section_mysql_files () {
local variables_file="$1"
@@ -2162,41 +2162,6 @@ parse_wsrep_provider_options () {
' "$looking_for"
}
report_jemalloc_enabled() {
local JEMALLOC_STATUS=''
local GENERAL_JEMALLOC_STATUS=0
local JEMALLOC_LOCATION=''
for PID in $(pidof mysqld); do
grep -qc jemalloc /proc/${PID}/environ || ldd $(which mysqld) | grep -qc jemalloc
JEMALLOC_STATUS=$?
if [ $JEMALLOC_STATUS = 1 ]; then
echo "jemalloc is not enabled in MySQL config for process with ID ${PID}"
else
echo "jemalloc enabled in MySQL config for process with ID ${PID}"
GENERAL_JEMALLOC_STATUS=1
fi
done
if [ $GENERAL_JEMALLOC_STATUS = 1 ]; then
# Check location for libjemalloc.so.1
#for libjemall in "${SCRIPT_PWD}/lib/mysql" "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
if [ -r "$libjemall/libjemalloc.so.1" ]; then
JEMALLOC_LOCATION="$libjemall/libjemalloc.so.1"
break
fi
done
if [ -z $JEMALLOC_LOCATION ]; then
echo "Jemalloc library not found"
else
echo "Using jemalloc from $JEMALLOC_LOCATION"
fi
fi
}
report_mysql_summary () {
local dir="$1"
@@ -2210,8 +2175,6 @@ report_mysql_summary () {
section_mysqld "$dir/mysqld-executables" "$dir/mysql-variables"
section_slave_hosts "$dir/mysql-slave-hosts"
local user="$(get_var "pt-summary-internal-user" "$dir/mysql-variables")"
local port="$(get_var port "$dir/mysql-variables")"
local now="$(get_var "pt-summary-internal-now" "$dir/mysql-variables")"
@@ -2391,9 +2354,9 @@ report_mysql_summary () {
section "InnoDB"
local have_innodb="$(get_var "have_innodb" "$dir/mysql-variables")"
local innodb_version="$(get_var "innodb_version" "$dir/mysql-variables")"
if [ "${have_innodb}" = "YES" ] || [ -n "${innodb_version}" ]; then
if [ "${have_innodb}" = "YES" ]; then
section_innodb "$dir/mysql-variables" "$dir/mysql-status"
if [ -s "$dir/innodb-status" ]; then
format_innodb_status "$dir/innodb-status"
fi
@@ -2434,8 +2397,6 @@ report_mysql_summary () {
name_val "Config File" "Cannot autodetect or find, giving up"
fi
section "Memory management library"
report_jemalloc_enabled
section "The End"
}

View File

@@ -108,6 +108,10 @@ collect_mysql_innodb_status () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'SHOW /*!50000 ENGINE*/ INNODB STATUS' 2>/dev/null
}
collect_mysql_ndb_status () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'show /*!50000 ENGINE*/ NDB STATUS' 2>/dev/null
}
collect_mysql_processlist () {
$CMD_MYSQL $EXT_ARGV -ssE -e 'SHOW FULL PROCESSLIST' 2>/dev/null
}
@@ -223,6 +227,7 @@ collect_mysql_info () {
collect_mysql_plugins > "$dir/mysql-plugins"
collect_mysql_slave_status > "$dir/mysql-slave"
collect_mysql_innodb_status > "$dir/innodb-status"
collect_mysql_ndb_status > "$dir/ndb-status"
collect_mysql_processlist > "$dir/mysql-processlist"
collect_mysql_users > "$dir/mysql-users"

View File

@@ -557,6 +557,14 @@ format_innodb_status () {
fi
}
format_ndb_status() {
local file=$1
[ -e "$file" ] || return
# at the time being, just cat the file.
cat "$file"
}
# Summarizes per-database statistics for a bunch of different things: count of
# tables, views, etc. $1 is the file name. $2 is the database name; if none,
# then there should be multiple databases.