diff --git a/get-all-logs.sh b/get-all-logs.sh index cc2486e..2be6195 100755 --- a/get-all-logs.sh +++ b/get-all-logs.sh @@ -94,6 +94,24 @@ finish() { du -h ${ARCNAME} } +mysql_connect(){ + logfile=$1; + query=$2; + fullcmd="docker exec -it mysql bash -c \"mysql isp -p\\\$MYSQL_ROOT_PASSWORD -e "$query"\" >> ${LOGDIR}/$logfile"; + + #./1.sh "'select id,name,node from vm_host;'" + #q=$1; + #func(){ + #query=$1; + #eval "docker exec -it mysql bash -c \"mysql isp -p\\\$MYSQL_ROOT_PASSWORD -e "$query"\""; + #} + + #func "$q"; + echo $fullcmd; + echo -e "\n $cmd \n">> ${LOGDIR}/$logfile; + eval $fullcmd; +} + node_connect() { ip_addr=$1; ssh_port=$2; @@ -153,6 +171,7 @@ _vm_host() { _node() { node_ip=$1; node_port=$2; + mysql_connect "${node_ip}_db.log" "'select id,name from vm_node where ip_addr=\\\"$node_ip\\\";'" node_connect $node_ip $node_port "${node_ip}_hostnamectl.log" "hostnamectl"; node_connect $node_ip $node_port "${node_ip}_release.log" "\"cat /etc/*release\""; node_connect $node_ip $node_port "${node_ip}_dmesg.log" "\"dmesg | grep -i -E 'error|failed|critical|bug|panic'\"";