blob: 980ad56f7c36e7d2b587c71f330c0632ace28464 [file] [log] [blame]
# @@@ START COPYRIGHT @@@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# @@@ END COPYRIGHT @@@
# Configuration file for the Trafodion Scanner
#
# A line with comments must start with a '#' character.
#
# The Trafodion Scanner can be configured to perform one or more of the
# following operations: RECORD_CONFIG, CHECK_CONFIG, COMPARE_CONFIG.
#
# The RECORD_CONFIG operation is used to collect various system information for future
# reference, such as to aid with troubleshooting. This is done by executing a command
# on each node specified in the Trafodion configuration and recording the output
# in the trafodion_scanner log file.
#
# The CHECK_CONFIG operation is used to check the cluster for attributes
# that will commonly cause Trafodion installation issues, runtime performance problems,
# and so on. These attributes are divided into two categories: required and recommended.
# The checks for required attributes are configured with a severity level of [error],
# while the checks for recommended attributes are configured with a severity level of [warning].
# A check is performed by executing a command on each node specified in the Trafodion
# configuration and comparing the output against an expected value, using the specified
# comparison operator.
#
# The COMPARE_CONFIG operation is used to check the consistency among all cluster nodes, for
# example, check whether all nodes have the same HBase version. This is done by executing a
# command on each node specified in the Trafodion configuration and comparing the output.
# If the output is different, the nodes are deemed to be inconsistent. Similar to
# the CHECK_CONFIG operation, a severity level of either [error] or [warning] is configured
# for each consistency check.
#
# Here is the precise specification format for each type of operation:
#
# CHECK_CONFIG ::: <name> ::: <description> ::: <severity level> ::: <expected value> ::: <comparison operator> ::: <command>
# COMPARE_CONFIG ::: <name> ::: <description> ::: <severity level> ::: <command>
# RECORD_CONFIG ::: <description> ::: <command>
#
# Here is an explanation of each token:
#
# <name> is a short identifier for the configured operation. It must be unique. In other words,
# the same name cannot be used for multiple operations within a configuration file.
#
# <description> is an English description for the configured operation.
#
# <severity level> is the severity level for the configured operation. The possible values are 'error' and 'warning'.
#
# <expected value> is the expected value for the configured operation.
#
# <comparison operator> is the operator to use for comparison of the <expected value> and "<command> output".
# There are two types of operators: for string comparison and integer comparison.
# The available operators for string comparison are: str_lt, str_le, str_eq, str_ne, str_ge, str_gt.
# The available operators for integer comparison are: int_lt, int_le, int_eq, int_ne, int_ge, int_gt.
# Here is the meaning for each operator: lt means "less than", le means "less than or equal",
# eq means "equal", ne means "not equal", ge means "greater than or equal", gt means "greater than".
# The operator will be applied as follows: <expected value> <comparison operator> "<command> output",
# for example: <expected value> int_le "<command> output". The comparison will be done only once, on
# the entire "<command> output", even if it contains multiple values/lines.
#
# <command> is the command to execute for the configured operation. This command will be executed on each node specified in
# the Trafodion configuration. The command string can span multiple lines. However, pipelines within
# the command string cannot be split across multiple lines. Special placeholder variables can be specified
# in the command string within <<<>>>. The Trafodion Scanner will replace each placeholder variable by its
# corresponding value, as determined at runtime. Currently the following placeholder variables are available:
# a) All variables specified in the Trafodion configuration, for example <<<TRAF_USER>>>, <<<TRAF_PACKAGE>>>, etc.
# The value is 'undefined' when the variable is not defined in the Trafodion configuration.
### Configuration Recording ###
RECORD_CONFIG ::: Number of cores ::: grep -c '^processor' /proc/cpuinfo
RECORD_CONFIG ::: GB of total physical memory ::: grep MemTotal /proc/meminfo | awk '{printf ("%.0f",$2/(1024*1024))}'
RECORD_CONFIG ::: Linux distribution ::: lsb_release -a
RECORD_CONFIG ::: User limit settings ::: ulimit -a
RECORD_CONFIG ::: System information ::: uname -a
RECORD_CONFIG ::: Kernel parameters ::: /sbin/sysctl -a
RECORD_CONFIG ::: Network configuration ::: /sbin/ip addr show
RECORD_CONFIG ::: Available filesystems ::: df -h
RECORD_CONFIG ::: Installed RPMs ::: rpm -qa | sort
RECORD_CONFIG ::: Hadoop version ::: hadoop version
RECORD_CONFIG ::: HBase version ::: hbase version
RECORD_CONFIG ::: HBase Java version ::: hbase -version
RECORD_CONFIG ::: Default Java version ::: java -version
### Configuration Checking ###
CHECK_CONFIG ::: HardwarePlatform ::: Supported hardware platform ::: error ::: x86_64 ::: str_eq ::: uname -i
CHECK_CONFIG ::: MinNumCores ::: Minimum number of cores ::: warning ::: 2 ::: int_le ::: grep -c '^processor' /proc/cpuinfo
CHECK_CONFIG ::: MinGBTotalPhysicalMemory ::: Minimum GB of total physical memory ::: warning ::: 16 ::: int_le :::
grep MemTotal /proc/meminfo | awk '{printf ("%.0f",$2/(1024*1024))}'
CHECK_CONFIG ::: LinuxDistro ::: Supported Linux distribution ::: error ::: 0 ::: int_ne :::
lsb_release -a | grep -c -e 'Red' -e 'CentOS'
CHECK_CONFIG ::: ValidHostnameFQDNConfig ::: Valid hostname FQDN configuration ::: warning ::: PASS ::: str_eq :::
if [[ "$(hostname -f)" == "$(hostname -s)" ]]; then
echo FAIL
elif [[ "$(hostname -f | grep -c '\.')" != "1" ]]; then
echo FAIL
else
echo PASS
fi
CHECK_CONFIG ::: KernelPidMaxLimit ::: Upper limit for kernel.pid_max setting ::: error ::: 65535 ::: int_ge :::
/sbin/sysctl -n kernel.pid_max
CHECK_CONFIG ::: ntpdServiceRunning ::: ntpd service is running ::: error ::: 0 ::: int_ne :::
/sbin/service ntpd status | grep -c 'is running'
CHECK_CONFIG ::: iptablesFirewallNotEnabled ::: iptables firewall is not enabled ::: warning ::: notEnabled ::: str_eq :::
stat=$(sudo -n /sbin/service iptables status 2>&1)
if echo "$stat" | grep -q -e 'is not running' -e 'unrecognized service'; then
echo notEnabled
elif echo "$stat" | grep -q '^[0-9]'; then
echo enabled
else
echo notEnabled
fi
CHECK_CONFIG ::: HyperthreadingEnabled ::: Hyperthreading is enabled, if capability exists ::: warning ::: 1 ::: int_ne :::
if grep '^flags' /proc/cpuinfo | grep -iq 'HT'; then
grep -E '^(cpu cores|siblings)' /proc/cpuinfo | cut -d ':' -f 2 | uniq | wc -l
else
echo 0
fi
CHECK_CONFIG ::: HadoopDistro ::: Supported Hadoop distribution ::: error ::: 0 ::: int_ne :::
hadoop version 2>&1 | grep -c -e 'hortonworks' -e 'cloudera'
CHECK_CONFIG ::: HBaseVersion ::: Supported HBase version ::: error ::: 0 ::: int_ne :::
if [[ "<<<CDH_5_3_HDP_2_2_SUPPORT>>>" == "Y" ]]; then
hbase version 2>&1 | grep -c -e 'HBase 0.98.4' -e 'HBase 0.98.6'
else
hbase version 2>&1 | grep -c -e 'HBase 0.98.0.2' -e 'HBase 0.98.1'
fi
CHECK_CONFIG ::: HBaseJavaVersion ::: Supported HBase Java version ::: error ::: 0 ::: int_ne :::
hbase -version 2>&1 | grep -c '1.7.'
CHECK_CONFIG ::: YumAndInternetConnection ::: Yum and Internet connection ::: warning ::: PASS ::: str_eq :::
which yumdownloader &>/dev/null
if [[ "$?" == "0" ]]; then
mkdir /tmp/yum-check-temp-dir-$$ &>/dev/null
cmdout=$(yumdownloader --destdir /tmp/yum-check-temp-dir-$$ 'pdsh' 2>&1)
if [[ "$?" == "0" ]]; then
echo PASS
else
echo "$cmdout"
fi
rm -rf /tmp/yum-check-temp-dir-$$ &>/dev/null
else
cmdout=$(wget --spider 'http://downloads.trafodion.org' 2>&1)
if [[ "$?" == "0" ]]; then
echo PASS
else
echo "$cmdout"
fi
fi
### Consistency Checking ###
COMPARE_CONFIG ::: SameHadoopVersion ::: Same Hadoop version ::: error ::: hadoop version 2>&1 | grep 'Hadoop'
COMPARE_CONFIG ::: SameHBaseVersion ::: Same HBase version ::: error ::: hbase version 2>&1 | grep -o 'HBase.*$'