diff options
author | Jorge Romero <Jorge.Romero@openbondx.com> | 2016-05-20 12:42:41 -0400 |
---|---|---|
committer | Jorge Romero <Jorge.Romero@openbondx.com> | 2016-05-20 12:42:41 -0400 |
commit | 6371d774628d75ddf474c6d571bbc82458550e4b (patch) | |
tree | 3e0171311a2283740dbf1c9b5ddfcfcd09097f4d /charts.d/tomcat.chart.sh | |
parent | 3bb9a064a4a0e61709edb28a934f6d85036990eb (diff) |
detect tomcat port from url
Diffstat (limited to 'charts.d/tomcat.chart.sh')
-rwxr-xr-x | charts.d/tomcat.chart.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh index 4e10a9183a..f7809ddd31 100755 --- a/charts.d/tomcat.chart.sh +++ b/charts.d/tomcat.chart.sh @@ -62,13 +62,14 @@ tomcat_check() { } tomcat_get() { - # Collect tomcat values + # collect tomcat values + tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")" mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss "$tomcat_url" |\ xmlstarlet sel \ -t -m "/status/jvm/memory" -v @free \ - -n -m "/status/connector[@name='\"http-bio-8080\"']/threadInfo" -v @currentThreadCount \ + -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \ -n -v @currentThreadsBusy \ - -n -m "/status/connector[@name='\"http-bio-8080\"']/requestInfo" -v @requestCount \ + -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/requestInfo" -v @requestCount \ -n -v @bytesSent -n -) tomcat_jvm_freememory="${lines[0]}" |