Difference between revisions of "SQWareCentral:mysql"

From Wiki_dbSQWare
Jump to: navigation, search
(sqwc_ExpVar.cfg)
m (Updated by BatchUser)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
== auto ==
 
== auto ==
 +
=== sqwmys_AdddbSQWareProfile.ksh ===
 +
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_AdddbSQWareProfile.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_AdddbSQWareProfile.ksh.<br>
 +
Add dbSQWare profile
 +
<br><br>
 +
Action:
 +
<pre>
 +
lfsqw_Action()
 +
{
 +
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
 +
do
 +
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 +
lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1)
 +
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
 +
if [ -r ~/.profile ]
 +
then
 +
if [ \$(grep -c 'gvsqw_MysBin' ~/.profile) -eq 0 ]
 +
then
 +
cat <<EOFCAT >>~/.profile
 +
 +
#dbSQWare
 +
export gvsqw_Env=''
 +
export gvsqw_MysBin=\\\$HOME/SQWareProduction/mysql/bin
 +
lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?)
 +
if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_MysBin/../etc/.profile_confort ]
 +
then
 +
. \\\$gvsqw_MysBin/../etc/.profile_confort
 +
fi
 +
 +
EOFCAT
 +
fi
 +
elif [ -r ~/.bash_profile ]
 +
then
 +
if [ \$(grep -c 'gvsqw_MysBin' ~/.bash_profile) -eq 0 ]
 +
then
 +
cat <<EOFCAT >>~/.bash_profile
 +
 +
#dbSQWare
 +
export gvsqw_Env=''
 +
export gvsqw_MysBin=\\\$HOME/SQWareProduction/mysql/bin
 +
lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?)
 +
if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_MysBin/../etc/.profile_confort ]
 +
then
 +
. \\\$gvsqw_MysBin/../etc/.profile_confort
 +
fi
 +
 +
EOFCAT
 +
fi
 +
fi
 +
EOFSSH
 +
done <$gvsqw_TmpFile.lst
 +
 +
}
 +
</pre>
 +
<br>
 
=== sqwmys_DeplScripts.ksh ===
 
=== sqwmys_DeplScripts.ksh ===
 
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_DeplScripts.ksh:<br>
 
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_DeplScripts.ksh:<br>
Line 12: Line 67:
 
do
 
do
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
ssh -T $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
+
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
 
mkdir -p $gvsqw_RootSQWareProductionMysql/$gvsqw_VersDeplSQWareProductionMysql
 
mkdir -p $gvsqw_RootSQWareProductionMysql/$gvsqw_VersDeplSQWareProductionMysql
 
cd $gvsqw_RootSQWareProductionMysql
 
cd $gvsqw_RootSQWareProductionMysql
Line 20: Line 75:
 
rsync -aHv $gvsqw_RsyncPathMysql --delete $gvsqw_RootSQWareProduction/mysql/$gvsqw_VersDeplSQWareProductionMysql $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionMysql/.
 
rsync -aHv $gvsqw_RsyncPathMysql --delete $gvsqw_RootSQWareProduction/mysql/$gvsqw_VersDeplSQWareProductionMysql $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionMysql/.
 
done <$gvsqw_TmpFile.lst
 
done <$gvsqw_TmpFile.lst
 +
}
 +
</pre>
 +
<br>
 +
=== sqwmys_GatherIndicatorsDist.ksh ===
 +
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GatherIndicatorsDist.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GatherIndicatorsDist.ksh.<br>
 +
Mysql gather indicators in distant mode
 +
<br><br>
 +
Action:
 +
<pre>
 +
lfsqw_Action()
 +
{
 +
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
 +
do
 +
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 +
ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_mysql <<EOFSSH &
 +
\$gvsqw_MysBin/sqwmys_GatherIndicators.ksh -I "$lvsqw_Instance" -Dist
 +
EOFSSH
 +
sleep 1
 +
done <$gvsqw_TmpFile.lst
 +
jobs
 +
wait
 
}
 
}
 
</pre>
 
</pre>
Line 35: Line 112:
 
do
 
do
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh -T $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
+
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A IndicDba
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A IndicDba
Line 43: Line 120:
 
jobs
 
jobs
 
wait
 
wait
 +
}
 +
</pre>
 +
<br>
 +
=== sqwmys_Gen_dbSQWare.ksh ===
 +
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_Gen_dbSQWare.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_Gen_dbSQWare.ksh.<br>
 +
generate dbSQWare files
 +
<br><br>
 +
Action:
 +
<pre>
 +
lfsqw_Action()
 +
{
 +
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
 +
do
 +
lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1)
 +
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 +
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
 +
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 +
if [ "\$MYSQL_SID" != "$lvsqw_Instance" ]
 +
then
 +
export MYSQL_SID="$lvsqw_Instance"
 +
fi
 +
\$gvsqw_MysBin/../tools/sqwmys_GenerateCreateInstance.ksh -dbsOnly <<EOF
 +
y
 +
EOF
 +
EOFSSH
 +
done <$gvsqw_TmpFile.lst
 +
}
 +
</pre>
 +
<br>
 +
=== sqwmys_GenSshKeysInstance.ksh ===
 +
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GenSshKeysInstance.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GenSshKeysInstance.ksh.<br>
 +
ssh keys deployment for MySql
 +
<br><br>
 +
Action:
 +
<pre>
 +
lfsqw_Action()
 +
{
 +
 +
echo "#########################################################################"
 +
echo "#Create/Retrieve key for SQWareCentral"
 +
mkdir -p $HOME/tmp
 +
if [ -r $HOME/.ssh/id_dsa.pub ]
 +
then
 +
echo "Id DSA found:"
 +
ls -l $HOME/.ssh/id_dsa.pub
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub)
 +
elif [ -r $HOME/.ssh/id_rsa.pub ]
 +
then
 +
echo "Id RSA found:"
 +
ls -l $HOME/.ssh/id_rsa.pub
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
 +
else
 +
ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
 +
fi
 +
#Retrieve additionnal keys if found (your windows key for exemple)
 +
if [ -r $HOME/.ssh/id_dbSQWare.pub ]
 +
then
 +
echo "Id dbSQWare found:"
 +
ls -l $HOME/.ssh/id_dbSQWare.pub
 +
lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub)
 +
else
 +
lvsqw_AdditionnalKey=""
 +
fi
 +
chmod go-w $HOME
 +
touch $HOME/.ssh/authorized_keys
 +
chmod 700 $HOME/.ssh
 +
chmod 600 $HOME/.ssh/authorized_keys
 +
echo "${c_menu}#########################################################################"
 +
echo "#create key if not found and put SQWareCentral key for distant users"
 +
echo "Enter password when necessary${c_normal}"
 +
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
 +
do
 +
echo ""
 +
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
 +
ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
 +
mkdir -p \$HOME/tmp
 +
if [ -r \$HOME/.ssh/id_dsa.pub ]
 +
then
 +
echo "Id DSA found:"
 +
ls -l \$HOME/.ssh/id_dsa.pub
 +
cat \$HOME/.ssh/id_dsa.pub
 +
elif [ -r \$HOME/.ssh/id_rsa.pub ]
 +
then
 +
echo "Id RSA found:"
 +
ls -l \$HOME/.ssh/id_rsa.pub
 +
cat \$HOME/.ssh/id_rsa.pub
 +
else
 +
ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa
 +
cat \$HOME/.ssh/id_rsa.pub
 +
fi
 +
chmod go-w \$HOME
 +
echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys
 +
echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys
 +
chmod 700 \$HOME/.ssh
 +
chmod 600 \$HOME/.ssh/authorized_keys
 +
EOFSSH
 +
 +
done <$gvsqw_TmpFile.lst
 +
}
 +
</pre>
 +
<br>
 +
=== sqwmys_GenSshKeys.ksh ===
 +
Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GenSshKeys.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GenSshKeys.ksh.<br>
 +
ssh keys deployment for MySql
 +
<br><br>
 +
Action:
 +
<pre>
 +
lfsqw_Action()
 +
{
 +
 +
echo "#########################################################################"
 +
echo "#Create/Retrieve key for SQWareCentral"
 +
mkdir -p $HOME/tmp
 +
if [ -r $HOME/.ssh/id_dsa.pub ]
 +
then
 +
echo "Id DSA found:"
 +
ls -l $HOME/.ssh/id_dsa.pub
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub)
 +
elif [ -r $HOME/.ssh/id_rsa.pub ]
 +
then
 +
echo "Id RSA found:"
 +
ls -l $HOME/.ssh/id_rsa.pub
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
 +
else
 +
ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa
 +
lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
 +
fi
 +
#Retrieve additionnal keys if found (your windows key for exemple)
 +
if [ -r $HOME/.ssh/id_dbSQWare.pub ]
 +
then
 +
echo "Id dbSQWare found:"
 +
ls -l $HOME/.ssh/id_dbSQWare.pub
 +
lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub)
 +
else
 +
lvsqw_AdditionnalKey=""
 +
fi
 +
chmod go-w $HOME
 +
touch $HOME/.ssh/authorized_keys
 +
chmod 700 $HOME/.ssh
 +
chmod 600 $HOME/.ssh/authorized_keys
 +
echo "${c_menu}#########################################################################"
 +
echo "#create key if not found and put SQWareCentral key for distant users"
 +
echo "Enter password when necessary${c_normal}"
 +
while read lvsqw_HostName lvsqw_UserName
 +
do
 +
echo ""
 +
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
 +
ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
 +
mkdir -p \$HOME/tmp
 +
if [ -r \$HOME/.ssh/id_dsa.pub ]
 +
then
 +
echo "Id DSA found:"
 +
ls -l \$HOME/.ssh/id_dsa.pub
 +
cat \$HOME/.ssh/id_dsa.pub
 +
elif [ -r \$HOME/.ssh/id_rsa.pub ]
 +
then
 +
echo "Id RSA found:"
 +
ls -l \$HOME/.ssh/id_rsa.pub
 +
cat \$HOME/.ssh/id_rsa.pub
 +
else
 +
ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa
 +
cat \$HOME/.ssh/id_rsa.pub
 +
fi
 +
chmod go-w \$HOME
 +
echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys
 +
echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys
 +
chmod 700 \$HOME/.ssh
 +
chmod 600 \$HOME/.ssh/authorized_keys
 +
EOFSSH
 +
 +
done <$gvsqw_TmpFile.lst
 
}
 
}
 
</pre>
 
</pre>
Line 58: Line 310:
 
do
 
do
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh -T $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
+
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A PurgeAlert
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A PurgeAlert
Line 81: Line 333:
 
do
 
do
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
 
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh -T $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
+
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A SlowQuery
 
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A SlowQuery
Line 102: Line 354:
 
your modifications (only variables you want to modify).<br>
 
your modifications (only variables you want to modify).<br>
 
<br>
 
<br>
 
+
File content:
 +
<pre>
 +
</pre>
 +
<br>
 +
<br>
 +
Variable explanation:
 +
<pre>
 +
</pre>
 +
<br>
 
=== sqwc_DbRefVar.cfg ===
 
=== sqwc_DbRefVar.cfg ===
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_DbRefVar.cfg:<br>
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_DbRefVar.cfg:<br>
Line 123: Line 383:
 
Variable explanation:
 
Variable explanation:
 
<pre>
 
<pre>
gvsqw_DbRefDatabase_mssql => Database of SQWareRepository for Mssql
+
gvsqw_DbRefDatabase_mysql =>  
gvsqw_DbRefInstance_mssql => Instance of SQWareRepository for Mssql
+
gvsqw_DbRefInstance_mysql =>  
gvsqw_DbRefPass_mssql => password to connect to SQWareRepository for Mssql
+
gvsqw_DbRefPass_mysql =>  
gvsqw_DbRefPort_mssql => Not used
+
gvsqw_DbRefPort_mysql =>  
gvsqw_DbRefType_mssql => type of RDBMS for SQWareRepository for Mssql
+
gvsqw_DbRefType_mysql =>  
gvsqw_DbRefUser_mssql => user to connect to SQWareRepository for Mssql
+
gvsqw_DbRefUser_mysql =>  
 
</pre>
 
</pre>
 
<br>
 
<br>
 
 
=== sqwc_ExpVar.cfg ===
 
=== sqwc_ExpVar.cfg ===
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_ExpVar.cfg:<br>
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_ExpVar.cfg:<br>
Line 141: Line 400:
 
File content:
 
File content:
 
<pre>
 
<pre>
export gvsqw_RootSQWareProductionMysql="~$gvsqw_UserUniqueMysql/SQWareProduction/mysql"
+
export gvsqw_RootexpdbExpMysql="~$gvsqw_UserUniqueMysql/SQWareProduction/mysql"
export gvsqw_VersSQWareProductionMysql='prod'
+
export gvsqw_VersexpdbExpMysql='prod'
export gvsqw_VersDeplSQWareProductionMysql='v1.2'
+
export gvsqw_VersDeplexpdbExpMysql='v3.1'
 
export gvsqw_Mail_mysql='dba'
 
export gvsqw_Mail_mysql='dba'
 
export gvsqw_MailMsg_mysql='TrtMysqlAuto'
 
export gvsqw_MailMsg_mysql='TrtMysqlAuto'
Line 151: Line 410:
 
Variable explanation:
 
Variable explanation:
 
<pre>
 
<pre>
gvsqw_MailMsg_mssql => begining of email subject for Mssql
+
gvsqw_MailMsg_mysql =>  
gvsqw_Mail_mssql => email adress for Mssql
+
gvsqw_Mail_mysql =>  
gvsqw_RootSQWareProductionMssql => SQWareProduction directory source for Mssql
+
gvsqw_RootexpdbExpMysql =>  
gvsqw_VersDeplSQWareProductionMssql => version of SQWareProduction to deploy for Mssql
+
gvsqw_VersDeplexpdbExpMysql =>  
gvsqw_VersSQWareProductionMssql => link for current version of SQWareProduction for Mssql
+
gvsqw_VersexpdbExpMysql =>  
 
</pre>
 
</pre>
 
<br>
 
<br>
 
 
=== sqwc_GlobalVar.cfg ===
 
=== sqwc_GlobalVar.cfg ===
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_GlobalVar.cfg:<br>
 
Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_GlobalVar.cfg:<br>
Line 168: Line 426:
 
File content:
 
File content:
 
<pre>
 
<pre>
export gvsqw_UserUniqueMysql='sysdba'
+
export gvsqw_Mail_mysql='default@dbsqware.com'
 +
export gvsqw_MailMsg_mysql='TrtMysqlAuto'
 +
export gvsqw_UserUniqueMysql='dbsqware'
 +
export gvsqw_RootSQWareProductionMysql="~$gvsqw_UserUniqueMysql/SQWareProduction/mysql"
 +
export gvsqw_VersSQWareProductionMysql='prod'
 +
export gvsqw_VersDeplSQWareProductionMysql='v3.1'
 +
export gvsqw_DistSQWareProdUser_mysql="$gvsqw_UserUniqueMysql@$gvsqw_Hostname"
 
</pre>
 
</pre>
 
<br>
 
<br>
Line 174: Line 438:
 
Variable explanation:
 
Variable explanation:
 
<pre>
 
<pre>
 +
gvsqw_DistSQWareProdUser_mysql =>
 +
gvsqw_MailMsg_mysql =>
 +
gvsqw_Mail_mysql =>
 +
gvsqw_RootSQWareProductionMysql =>
 
gvsqw_UserUniqueMysql =>  
 
gvsqw_UserUniqueMysql =>  
 +
gvsqw_VersDeplSQWareProductionMysql =>
 +
gvsqw_VersSQWareProductionMysql =>
 
</pre>
 
</pre>
 
<br>
 
<br>
 
=== .profile_confort ===
 
=== .profile_confort ===
 
File to put aliases $gvsqw_RootexpdbCentral/action/mysql/etc/.profile_confort:<br>
 
File to put aliases $gvsqw_RootexpdbCentral/action/mysql/etc/.profile_confort:<br>
File to put aliases $gvsqw_RootexpdbCentral/action/mysql/etc/.profile_confort:<br>
 
Contains confort aliases of SQWareCentral for RDBMS mysql.<br>
 
 
Contains confort aliases of SQWareCentral for RDBMS mysql.<br>
 
Contains confort aliases of SQWareCentral for RDBMS mysql.<br>
 
<br>
 
<br>
Line 186: Line 454:
 
<pre>
 
<pre>
 
  act_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/prod;ls -al'
 
  act_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/prod;ls -al'
  depl_mys => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_DeplScripts.ksh sqwmys_GenLstUnique.ksh NOLOG CONFIRM'
+
  etc_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/etc;ls -al'
 +
  lst_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/lst;ls -al'
 +
  auto_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/auto;ls -al'
 +
  cetc_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/etc_cust;ls -al'
 +
  clst_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/lst_cust;ls -al'
 +
  cauto_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/auto_cust;ls -al'
 +
  depl_mys => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh mysql sqwmys_DeplScripts.ksh sqwmys_GenLstUnique.ksh'
 
  repind_mys => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_GatherIndicators.ksh sqwmys_GenLstRepind.ksh NOLOG'
 
  repind_mys => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_GatherIndicators.ksh sqwmys_GenLstRepind.ksh NOLOG'
 +
  repind_mys_dist => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_GatherIndicatorsDist.ksh sqwmys_GenLstRepindDist.ksh NOLOG'
 
  gen_mys => '$gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefMysql.ksh'
 
  gen_mys => '$gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefMysql.ksh'
 +
  menu_mys => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh mysql'
 
</pre>
 
</pre>
 
<br>
 
<br>
Line 194: Line 470:
  
 
== lst ==
 
== lst ==
 +
=== sqwc_Extract_CMDB_Mysql.ksh ===
 +
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_Extract_CMDB_Mysql.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwc_Extract_CMDB_Mysql.ksh.<br>
 +
<br><br>
 +
Query used:
 +
<pre>
 +
select concat('MYS;',ref.mysql_sid,';',ifnull(hst.host_name,'N.A'),';',
 +
from tsqw_Repository ref left outer join tsqw_GenHisto hist
 +
        on (ref.mysql_sid = hist.mysql_sid and hist.month = str_to_date(concat('01/',month(now()),'/',year(now())), '%d/%m/%Y'))
 +
order by 1
 +
</pre>
 +
<br>
 
=== sqwc_GenRefDbMysql.ksh ===
 
=== sqwc_GenRefDbMysql.ksh ===
 
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefDbMysql.ksh:<br>
 
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefDbMysql.ksh:<br>
Line 217: Line 505:
 
Query used:
 
Query used:
 
<pre>
 
<pre>
select cast(virt_host_name as char(22)) "Virthost",
+
select cast(virt_host_name as char(30)) "Virthost",
 
from tsqw_Repository
 
from tsqw_Repository
select cast(virt_host_name as char(22)) "Virthost",
+
select cast(virt_host_name as char(30)) "Virthost",
 
from tsqw_RepositoryOther
 
from tsqw_RepositoryOther
order by 6,2,1,3,4'| sed 's,\|, ,g'|grep -v '+' |sed 's,^  *,,' > $lvsqw_FicRef
+
order by 6,2,1,3,4
 +
</pre>
 +
<br>
 +
=== sqwmys_GenLstInstanceDist.ksh ===
 +
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstInstanceDist.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstInstanceDist.ksh.<br>
 +
Generation of the list of Mysql instances for distant connection (tsqw_Repository)
 +
<br><br>
 +
Query used:
 +
<pre>
 +
select virt_host_name, username, mysql_sid
 +
from tsqw_Repository
 +
where status  in ('DIST','MIX')
 +
order by virt_host_name, username
 
</pre>
 
</pre>
 
<br>
 
<br>
Line 233: Line 534:
 
select virt_host_name, username, mysql_sid
 
select virt_host_name, username, mysql_sid
 
from tsqw_Repository
 
from tsqw_Repository
where status = 'ON'
+
where status in ('ON','MIX')
 +
order by virt_host_name, username
 +
</pre>
 +
<br>
 +
=== sqwmys_GenLstInstanceNew.ksh ===
 +
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstInstanceNew.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstInstanceNew.ksh.<br>
 +
Generation of the list of Mysql instances (tsqw_Repository) status 'NEW'
 +
<br><br>
 +
Query used:
 +
<pre>
 +
select virt_host_name, username, mysql_sid
 +
from tsqw_Repository
 +
where status  = 'NEW'
 
order by virt_host_name, username
 
order by virt_host_name, username
 +
</pre>
 +
<br>
 +
=== sqwmys_GenLstRepindDist.ksh ===
 +
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstRepindDist.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstRepindDist.ksh.<br>
 +
Generation of the list for reprise of indicators for distant connection (tsqw_Repository/tsqw_GenHisto)
 +
<br><br>
 +
Query used:
 +
<pre>
 +
select virt_host_name, username, mysql_sid
 +
from tsqw_Repository ref
 +
where ref.status in ('DIST','MIX')
 +
and not exists ( select 1 from tsqw_GenHisto inf
 +
where inf.gather_date = date(now())
 +
and ref.mysql_sid = inf.mysql_sid)
 
</pre>
 
</pre>
 
<br>
 
<br>
Line 246: Line 575:
 
select virt_host_name, username, mysql_sid
 
select virt_host_name, username, mysql_sid
 
from tsqw_Repository ref
 
from tsqw_Repository ref
where ref.status = 'ON'
+
where ref.status in ('ON','MIX')
 
and not exists ( select 1 from tsqw_GenHisto inf
 
and not exists ( select 1 from tsqw_GenHisto inf
 
where inf.gather_date = date(now())
 
where inf.gather_date = date(now())
Line 261: Line 590:
 
select distinct host_name, '$gvsqw_UserUniqueMysql'
 
select distinct host_name, '$gvsqw_UserUniqueMysql'
 
from tsqw_Repository
 
from tsqw_Repository
where status != 'OFF'
+
where status in ('ON','MIX')
 
select distinct host_name, '$gvsqw_UserUniqueMysql'
 
select distinct host_name, '$gvsqw_UserUniqueMysql'
 
from tsqw_RepositoryOther
 
from tsqw_RepositoryOther
 +
order by host_name
 +
</pre>
 +
<br>
 +
=== sqwmys_GenLstUniqueNew.ksh ===
 +
List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstUniqueNew.ksh:<br>
 +
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstUniqueNew.ksh.<br>
 +
Generation of the user unique list (tsqw_Repository) statut 'NEW'
 +
<br><br>
 +
Query used:
 +
<pre>
 +
select distinct host_name, '$gvsqw_UserUniqueMysql'
 +
from tsqw_Repository
 +
where status = 'NEW'
 
order by host_name
 
order by host_name
 
</pre>
 
</pre>
 
<br>
 
<br>
 
<br><br>
 
<br><br>

Latest revision as of 22:53, 17 December 2012

auto

sqwmys_AdddbSQWareProfile.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_AdddbSQWareProfile.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_AdddbSQWareProfile.ksh.
Add dbSQWare profile

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1)
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
if [ -r ~/.profile ]
then
	if [ \$(grep -c 'gvsqw_MysBin' ~/.profile) -eq 0 ]
	then
		cat <<EOFCAT >>~/.profile

#dbSQWare
export gvsqw_Env=''
export gvsqw_MysBin=\\\$HOME/SQWareProduction/mysql/bin
lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?)
if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_MysBin/../etc/.profile_confort ]
then
	. \\\$gvsqw_MysBin/../etc/.profile_confort
fi

EOFCAT
	fi
elif [ -r ~/.bash_profile ]
then
	if [ \$(grep -c 'gvsqw_MysBin' ~/.bash_profile) -eq 0 ]
	then
		cat <<EOFCAT >>~/.bash_profile

#dbSQWare
export gvsqw_Env=''
export gvsqw_MysBin=\\\$HOME/SQWareProduction/mysql/bin
lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?)
if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_MysBin/../etc/.profile_confort ]
then
	. \\\$gvsqw_MysBin/../etc/.profile_confort
fi

EOFCAT
	fi
fi
EOFSSH
done <$gvsqw_TmpFile.lst

}


sqwmys_DeplScripts.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_DeplScripts.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_DeplScripts.ksh.
SQWareProduction deployment for Mysql

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
mkdir -p $gvsqw_RootSQWareProductionMysql/$gvsqw_VersDeplSQWareProductionMysql
cd $gvsqw_RootSQWareProductionMysql
rm -f $gvsqw_VersSQWareProductionMysql
ln -s $gvsqw_VersDeplSQWareProductionMysql $gvsqw_VersSQWareProductionMysql
EOFSSH
rsync -aHv $gvsqw_RsyncPathMysql --delete $gvsqw_RootSQWareProduction/mysql/$gvsqw_VersDeplSQWareProductionMysql $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionMysql/.
done <$gvsqw_TmpFile.lst
}


sqwmys_GatherIndicatorsDist.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GatherIndicatorsDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GatherIndicatorsDist.ksh.
Mysql gather indicators in distant mode

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_mysql <<EOFSSH &
\$gvsqw_MysBin/sqwmys_GatherIndicators.ksh -I "$lvsqw_Instance" -Dist
EOFSSH
sleep 1
done <$gvsqw_TmpFile.lst
jobs
wait
}


sqwmys_GatherIndicators.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GatherIndicators.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GatherIndicators.ksh.
Mysql gather indicators

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A IndicDba
EOFSSH
sleep 1
done <$gvsqw_TmpFile.lst
jobs
wait
}


sqwmys_Gen_dbSQWare.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_Gen_dbSQWare.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_Gen_dbSQWare.ksh.
generate dbSQWare files

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1)
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
if [ "\$MYSQL_SID" != "$lvsqw_Instance" ]
then
	export MYSQL_SID="$lvsqw_Instance"
fi
\$gvsqw_MysBin/../tools/sqwmys_GenerateCreateInstance.ksh -dbsOnly <<EOF
y
EOF
EOFSSH
done <$gvsqw_TmpFile.lst
}


sqwmys_GenSshKeysInstance.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GenSshKeysInstance.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GenSshKeysInstance.ksh.
ssh keys deployment for MySql

Action:

lfsqw_Action()
{

echo "#########################################################################"
echo "#Create/Retrieve key for SQWareCentral"
mkdir -p $HOME/tmp
if [ -r $HOME/.ssh/id_dsa.pub ]
then
	echo "Id DSA found:"
	ls -l $HOME/.ssh/id_dsa.pub
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub)
elif [ -r $HOME/.ssh/id_rsa.pub ]
then
	echo "Id RSA found:"
	ls -l $HOME/.ssh/id_rsa.pub
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
else
	ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
fi
#Retrieve additionnal keys if found (your windows key for exemple)
if [ -r $HOME/.ssh/id_dbSQWare.pub ]
then
	echo "Id dbSQWare found:"
	ls -l $HOME/.ssh/id_dbSQWare.pub
	lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub)
else
	lvsqw_AdditionnalKey=""
fi
chmod go-w $HOME
touch $HOME/.ssh/authorized_keys
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
echo "${c_menu}#########################################################################"
echo "#create key if not found and put SQWareCentral key for distant users"
echo "Enter password when necessary${c_normal}"
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo ""
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
mkdir -p \$HOME/tmp
if [ -r \$HOME/.ssh/id_dsa.pub ]
then
	echo "Id DSA found:"
	ls -l \$HOME/.ssh/id_dsa.pub
	cat \$HOME/.ssh/id_dsa.pub
elif [ -r \$HOME/.ssh/id_rsa.pub ]
then
	echo "Id RSA found:"
	ls -l \$HOME/.ssh/id_rsa.pub
	cat \$HOME/.ssh/id_rsa.pub
else
	ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa
	cat \$HOME/.ssh/id_rsa.pub
fi
chmod go-w \$HOME
echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys
echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys
chmod 700 \$HOME/.ssh
chmod 600 \$HOME/.ssh/authorized_keys
EOFSSH

done <$gvsqw_TmpFile.lst
}


sqwmys_GenSshKeys.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_GenSshKeys.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_GenSshKeys.ksh.
ssh keys deployment for MySql

Action:

lfsqw_Action()
{

echo "#########################################################################"
echo "#Create/Retrieve key for SQWareCentral"
mkdir -p $HOME/tmp
if [ -r $HOME/.ssh/id_dsa.pub ]
then
	echo "Id DSA found:"
	ls -l $HOME/.ssh/id_dsa.pub
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub)
elif [ -r $HOME/.ssh/id_rsa.pub ]
then
	echo "Id RSA found:"
	ls -l $HOME/.ssh/id_rsa.pub
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
else
	ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa
	lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub)
fi
#Retrieve additionnal keys if found (your windows key for exemple)
if [ -r $HOME/.ssh/id_dbSQWare.pub ]
then
	echo "Id dbSQWare found:"
	ls -l $HOME/.ssh/id_dbSQWare.pub
	lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub)
else
	lvsqw_AdditionnalKey=""
fi
chmod go-w $HOME
touch $HOME/.ssh/authorized_keys
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
echo "${c_menu}#########################################################################"
echo "#create key if not found and put SQWareCentral key for distant users"
echo "Enter password when necessary${c_normal}"
while read lvsqw_HostName lvsqw_UserName
do
echo ""
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}"
ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH
mkdir -p \$HOME/tmp
if [ -r \$HOME/.ssh/id_dsa.pub ]
then
	echo "Id DSA found:"
	ls -l \$HOME/.ssh/id_dsa.pub
	cat \$HOME/.ssh/id_dsa.pub
elif [ -r \$HOME/.ssh/id_rsa.pub ]
then
	echo "Id RSA found:"
	ls -l \$HOME/.ssh/id_rsa.pub
	cat \$HOME/.ssh/id_rsa.pub
else
	ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa
	cat \$HOME/.ssh/id_rsa.pub
fi
chmod go-w \$HOME
echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys
echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys
chmod 700 \$HOME/.ssh
chmod 600 \$HOME/.ssh/authorized_keys
EOFSSH

done <$gvsqw_TmpFile.lst
}


sqwmys_PurgeAlert.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_PurgeAlert.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_PurgeAlert.ksh.
Mysql rotate error log

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A PurgeAlert
EOFSSH
sleep 1
done <$gvsqw_TmpFile.lst
jobs
wait
}


sqwmys_SlowQuery.ksh

Action script $gvsqw_RootexpdbCentral/action/mysql/auto/sqwmys_SlowQuery.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/auto_cust/sqwmys_SlowQuery.ksh.
Mysql rotate slow query log

Action:

lfsqw_Action()
{
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance
do
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}"
ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH &
. \$gvsqw_MysBin/../tools/sqwmys_SetEnv.ksh $lvsqw_Instance
\$gvsqw_MysBin/sqwmys_RunJob.ksh -I $lvsqw_Instance -A SlowQuery
EOFSSH
sleep 1
done <$gvsqw_TmpFile.lst
jobs
wait
}




etc

CrontabRef.cfg

Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/CrontabRef.cfg:
It contains the operating variables of SQWareCentral for mysql.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/mysql/etc_cust/CrontabRef.cfg
your modifications (only variables you want to modify).

File content:




Variable explanation:



sqwc_DbRefVar.cfg

Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_DbRefVar.cfg:
It contains the operating variables of SQWareCentral for mysql.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/mysql/etc_cust/sqwc_DbRefVar.cfg
your modifications (only variables you want to modify).

File content:

export gvsqw_DbRefType_mysql='mysql'
export gvsqw_DbRefPort_mysql='InstancePortForMysql'
export gvsqw_DbRefInstance_mysql='InstanceNameForMysql'
export gvsqw_DbRefDatabase_mysql='DatabaseInstanceNameForMysql'
export gvsqw_DbRefUser_mysql='ConnexionUserForMysql'
export gvsqw_DbRefPass_mysql='ConnexionPassForMysql'



Variable explanation:

gvsqw_DbRefDatabase_mysql => 
gvsqw_DbRefInstance_mysql => 
gvsqw_DbRefPass_mysql => 
gvsqw_DbRefPort_mysql => 
gvsqw_DbRefType_mysql => 
gvsqw_DbRefUser_mysql => 


sqwc_ExpVar.cfg

Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_ExpVar.cfg:
It contains the operating variables of SQWareCentral for mysql.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/mysql/etc_cust/sqwc_ExpVar.cfg
your modifications (only variables you want to modify).

File content:

export gvsqw_RootexpdbExpMysql="~$gvsqw_UserUniqueMysql/SQWareProduction/mysql"
export gvsqw_VersexpdbExpMysql='prod'
export gvsqw_VersDeplexpdbExpMysql='v3.1'
export gvsqw_Mail_mysql='dba'
export gvsqw_MailMsg_mysql='TrtMysqlAuto'



Variable explanation:

gvsqw_MailMsg_mysql => 
gvsqw_Mail_mysql => 
gvsqw_RootexpdbExpMysql => 
gvsqw_VersDeplexpdbExpMysql => 
gvsqw_VersexpdbExpMysql => 


sqwc_GlobalVar.cfg

Configuration file $gvsqw_RootexpdbCentral/action/mysql/etc/sqwc_GlobalVar.cfg:
It contains the operating variables of SQWareCentral for mysql.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/mysql/etc_cust/sqwc_GlobalVar.cfg
your modifications (only variables you want to modify).

File content:

export gvsqw_Mail_mysql='default@dbsqware.com'
export gvsqw_MailMsg_mysql='TrtMysqlAuto'
export gvsqw_UserUniqueMysql='dbsqware'
export gvsqw_RootSQWareProductionMysql="~$gvsqw_UserUniqueMysql/SQWareProduction/mysql"
export gvsqw_VersSQWareProductionMysql='prod'
export gvsqw_VersDeplSQWareProductionMysql='v3.1'
export gvsqw_DistSQWareProdUser_mysql="$gvsqw_UserUniqueMysql@$gvsqw_Hostname"



Variable explanation:

gvsqw_DistSQWareProdUser_mysql => 
gvsqw_MailMsg_mysql => 
gvsqw_Mail_mysql => 
gvsqw_RootSQWareProductionMysql => 
gvsqw_UserUniqueMysql => 
gvsqw_VersDeplSQWareProductionMysql => 
gvsqw_VersSQWareProductionMysql => 


.profile_confort

File to put aliases $gvsqw_RootexpdbCentral/action/mysql/etc/.profile_confort:
Contains confort aliases of SQWareCentral for RDBMS mysql.

Alias explanation:

	  act_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/prod;ls -al'
	  etc_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/etc;ls -al'
	  lst_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/lst;ls -al'
	  auto_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/auto;ls -al'
	  cetc_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/etc_cust;ls -al'
	  clst_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/lst_cust;ls -al'
	  cauto_mys => 'cd $gvsqw_RootexpdbCentral/action/mysql/auto_cust;ls -al'
	  depl_mys => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh mysql sqwmys_DeplScripts.ksh sqwmys_GenLstUnique.ksh'
	  repind_mys => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_GatherIndicators.ksh sqwmys_GenLstRepind.ksh NOLOG'
	  repind_mys_dist => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh mysql sqwmys_GatherIndicatorsDist.ksh sqwmys_GenLstRepindDist.ksh NOLOG'
	  gen_mys => '$gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefMysql.ksh'
	  menu_mys => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh mysql'




lst

sqwc_Extract_CMDB_Mysql.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_Extract_CMDB_Mysql.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwc_Extract_CMDB_Mysql.ksh.


Query used:

select concat('MYS;',ref.mysql_sid,';',ifnull(hst.host_name,'N.A'),';',
from tsqw_Repository ref left outer join tsqw_GenHisto hist
        on (ref.mysql_sid = hist.mysql_sid and hist.month = str_to_date(concat('01/',month(now()),'/',year(now())), '%d/%m/%Y'))
order by 1


sqwc_GenRefDbMysql.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefDbMysql.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwc_GenRefDbMysql.ksh.


Query used:

select concat('MYS;',ref.mysql_sid,';',vol.database_name,';',ref.env,';',
from tsqw_Repository ref, tsqw_GenHisto hist, tsqw_VolInstance inst, tsqw_VolDb vol
where hist.month = str_to_date(concat('01/',month(now()),'/',year(now())), '%d/%m/%Y')
    and hist.mysql_sid = ref.mysql_sid
    and hist.mysql_sid = vol.mysql_sid
    and hist.gather_date = vol.gather_date
    and hist.mysql_sid = inst.mysql_sid
    and hist.gather_date = inst.gather_date
order by 1


sqwc_GenRefMysql.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwc_GenRefMysql.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwc_GenRefMysql.ksh.


Query used:

select cast(virt_host_name as char(30)) "Virthost",
from tsqw_Repository
select cast(virt_host_name as char(30)) "Virthost",
from tsqw_RepositoryOther
order by 6,2,1,3,4


sqwmys_GenLstInstanceDist.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstInstanceDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstInstanceDist.ksh.
Generation of the list of Mysql instances for distant connection (tsqw_Repository)

Query used:

select virt_host_name, username, mysql_sid
from tsqw_Repository
where status  in ('DIST','MIX')
order by virt_host_name, username


sqwmys_GenLstInstance.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstInstance.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstInstance.ksh.
Generation of the list of Mysql instances (tsqw_Repository)

Query used:

select virt_host_name, username, mysql_sid
from tsqw_Repository
where status  in ('ON','MIX')
order by virt_host_name, username


sqwmys_GenLstInstanceNew.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstInstanceNew.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstInstanceNew.ksh.
Generation of the list of Mysql instances (tsqw_Repository) status 'NEW'

Query used:

select virt_host_name, username, mysql_sid
from tsqw_Repository
where status  = 'NEW'
order by virt_host_name, username


sqwmys_GenLstRepindDist.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstRepindDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstRepindDist.ksh.
Generation of the list for reprise of indicators for distant connection (tsqw_Repository/tsqw_GenHisto)

Query used:

select virt_host_name, username, mysql_sid
from tsqw_Repository ref
where ref.status in ('DIST','MIX')
and not exists ( select 1 from tsqw_GenHisto inf
where inf.gather_date = date(now())
and ref.mysql_sid = inf.mysql_sid)


sqwmys_GenLstRepind.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstRepind.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstRepind.ksh.
Generation of the list for reprise of indicators (tsqw_Repository/tsqw_GenHisto)

Query used:

select virt_host_name, username, mysql_sid
from tsqw_Repository ref
where ref.status in ('ON','MIX')
and not exists ( select 1 from tsqw_GenHisto inf
where inf.gather_date = date(now())
and ref.mysql_sid = inf.mysql_sid)


sqwmys_GenLstUnique.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstUnique.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstUnique.ksh.
Generation of the user unique list (tsqw_Repository)

Query used:

select distinct host_name, '$gvsqw_UserUniqueMysql'
from tsqw_Repository
where status  in ('ON','MIX')
select distinct host_name, '$gvsqw_UserUniqueMysql'
from tsqw_RepositoryOther
order by host_name


sqwmys_GenLstUniqueNew.ksh

List generator $gvsqw_RootexpdbCentral/action/mysql/lst/sqwmys_GenLstUniqueNew.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/mysql/lst_cust/sqwmys_GenLstUniqueNew.ksh.
Generation of the user unique list (tsqw_Repository) statut 'NEW'

Query used:

select distinct host_name, '$gvsqw_UserUniqueMysql'
from tsqw_Repository
where status = 'NEW'
order by host_name