-
Notifications
You must be signed in to change notification settings - Fork 149
[TRAFODION-3248]provide more dcscheck option #1761
base: master
Are you sure you want to change the base?
Changes from 1 commit
b20451c
d569ea1
b09c697
17e27d0
2919c96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ | |
|
|
||
| dcsznode=/$USER/dcs/master | ||
| jpscmd=$JAVA_HOME/bin/jps | ||
| JAVA=$JAVA_HOME/bin/java | ||
| jstatcmd=$JAVA_HOME/bin/jstat | ||
| jstackcmd=$JAVA_HOME/bin/jstack | ||
| cfg_mxo_cnt=0 | ||
| act_mxo_cnt=0 | ||
| down_mxo_cnt=0 | ||
|
|
@@ -30,7 +33,7 @@ cfg_dcsserver_cnt=0 | |
| actual_dcsserver_cnt=0 | ||
| down_dcsserver_cnt=0 | ||
| activeMaster=localhost | ||
|
|
||
| OPT_VALUE=$1 | ||
| if [ -e $SQ_PDSH ]; then | ||
| L_PDSH="$SQ_PDSH $MY_NODES " | ||
| else | ||
|
|
@@ -171,17 +174,65 @@ if ( [ $sq_stat == 0 ] || [ $sq_stat == 1 ] ); then | |
| fi | ||
| echo | ||
| fi | ||
| echo -e "Process\t\tConfigured\tActual\t\tDown" | ||
| echo -e "---------\t----------\t------\t\t----" | ||
| echo -e "DcsMaster\t$cfg_dcsmaster_cnt\t\t$actual_dcsmaster_cnt\t\t$down_dcsmaster_cnt" | ||
| echo -e "DcsServer\t$cfg_dcsserver_cnt\t\t$actual_dcsserver_cnt\t\t$down_dcsserver_cnt" | ||
| echo -e "mxosrvr\t\t$cfg_mxo_cnt\t\t$act_mxo_cnt\t\t$down_mxo_cnt\n" | ||
| else | ||
| echo "DCS is not installed. Please install and configure DCS..." | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Trafodion is not started or is not operational..." | ||
| echo | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$OPT_VALUE" ]; then | ||
|
|
||
| echo -e "Process\t\tConfigured\tActual\t\tDown" | ||
| echo -e "---------\t----------\t------\t\t----" | ||
| echo -e "DcsMaster\t$cfg_dcsmaster_cnt\t\t$actual_dcsmaster_cnt\t\t$down_dcsmaster_cnt" | ||
| echo -e "DcsServer\t$cfg_dcsserver_cnt\t\t$actual_dcsserver_cnt\t\t$down_dcsserver_cnt" | ||
| echo -e "mxosrvr\t\t$cfg_mxo_cnt\t\t$act_mxo_cnt\t\t$down_mxo_cnt\n" | ||
| exit 0 | ||
| else | ||
| echo | ||
| case $OPT_VALUE in | ||
| -m) | ||
| if [ -e $SQ_PDSH ]; then | ||
| STAT_CMD="$SQ_PDSH -w $activeMaster $jstatcmd -gc " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How will this work? Don't we need to specify the pid of dcsmaster to get the statistics?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes. At the line 204 there is related code to form a complete command which has pid of dcsmaster.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry . Yes I noticed that change and forgot to delete my comment |
||
| else | ||
| STAT_CMD=" $jstatcmd -gc " | ||
| fi | ||
| J_STATUS=`$STAT_CMD $activeDcsPid ` | ||
| EC=`echo $J_STATUS | sed -n 1p | awk '{ print $20 }'` | ||
| EU=`echo $J_STATUS | sed -n 1p | awk '{ print $21 }'` | ||
| OC=`echo $J_STATUS | sed -n 1p | awk '{ print $22 }'` | ||
| OU=`echo $J_STATUS | sed -n 1p | awk '{ print $23 }'` | ||
| PERCENT_EU=$(echo "scale=2;$EU/$EC "| bc) | ||
| PERCENT_OU=$(echo "scale=2;$OU/$OC "| bc) | ||
|
|
||
| echo -e "Active DCSMaster VM status:" | ||
| echo -e "EC\tEU\tOC\tOU\tPERCENT_EU\tPERCENT_OU\t" | ||
| echo -e "$EC\t$EU\t$OC\t$OU\t$PERCENT_EU\t\t$PERCENT_OU\t" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is going to helpful while looking at issues then, It would be nice if the title is not abbreviated and the units are qualified |
||
| #$STAT_CMD $activeDcsPid | ||
| ;; | ||
|
|
||
| -t) | ||
| if [ -e $SQ_PDSH ]; then | ||
| STAT_CMD="$SQ_PDSH -w $activeMaster $jstackcmd " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how will this work? pid of the process need to be specified |
||
| else | ||
| STAT_CMD=" $jstackcmd " | ||
| fi | ||
| echo `$STAT_CMD $activeDcsPid \ | ||
| | sed -n '/Thread-6/, /ListenerWorker.java/p'` | ||
|
|
||
| echo `$STAT_CMD $activeDcsPid \ | ||
| | sed -n '/Thread-5/, /ListenerService.java/p'` | ||
| #| awk '/java.lang.Thread.State/{print $2}' ` | ||
| ;; | ||
| -s) | ||
| "$JAVA" -XX:OnOutOfMemoryError="kill -9 %p" -classpath ${CLASSPATH}:${DCS_INSTALL_DIR}/target/classes org.trafodion.dcs.zookeeper.ZKShellTool 2>/dev/null | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is incorrect directory specified here. target folder does not exist when dcs is packaged and installed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I made a mistake here. I will correct it in time. Thank you very much |
||
| ;; | ||
| *) | ||
| ;; | ||
| esac | ||
| fi | ||
| exit 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /** | ||
| * @@@ 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 @@@ | ||
| */ | ||
| package org.trafodion.dcs.zookeeper; | ||
|
|
||
| import java.util.Properties; | ||
| import java.util.Map.Entry; | ||
| import java.util.List; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.trafodion.dcs.util.DcsConfiguration; | ||
| import java.sql.Timestamp; | ||
| /** | ||
| * Tool for reading ZooKeeper servers from dcs XML configuration and producing | ||
| * a line-by-line list for use by bash scripts. | ||
| */ | ||
| public class ZKShellTool { | ||
| /** | ||
| * Run the tool. | ||
| * @param args Command line arguments. | ||
| */ | ||
| public static void main(String args[]) throws Exception{ | ||
| String username = System.getProperty("user.name"); | ||
| System.out.println("User: " + username); | ||
| ZkClient zkc = new ZkClient(); | ||
| zkc.connect(); | ||
|
|
||
| String registeredPath = new String("/"+username + "/dcs/servers/registered"); | ||
| List<String> zks = zkc.getChildren(registeredPath, null); | ||
|
|
||
| System.out.println("State\t\tNode\tProcessId\tProcessName\tIpAddress\tPort\tClientName\tClientApp\tClientIp\tClientPort"); | ||
| for (String nodeName: zks){ | ||
| String nodePath = registeredPath + "/" + nodeName; | ||
| String currentData = new String(zkc.getData(nodePath, false, null)); | ||
| String[] node_status = currentData.split(":"); | ||
| for(int i = 0; i < node_status.length; i++){ | ||
| if (i != 1 && i != 2) | ||
| System.out.print(node_status[i]+"\t"); | ||
| } | ||
| System.out.println(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section can be moved to the default section of the case statement rather than specifically checking blank OPT_VALUE