@cryptotaxi247 / netdata-1 / commits / 6371d7746

detect tomcat port from url

Jorge Romero committed May 20, 2016 at 12:42 UTC 6371d774628d75ddf474c6d571bbc82458550e4b
1 file changed +4 -3
charts.d/tomcat.chart.sh
+4 -3
@@ -62,13 +62,14 @@ tomcat_check() {
62 }
63
64 tomcat_get() {
65 - # Collect tomcat values
65 + # collect tomcat values
66 + tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")"
67 mapfile -t lines < <(curl -u "$tomcatUser":"$tomcatPassword" -Ss "$tomcat_url" |\
68 xmlstarlet sel \
69 -t -m "/status/jvm/memory" -v @free \
69 - -n -m "/status/connector[@name='\"http-bio-8080\"']/threadInfo" -v @currentThreadCount \
70 + -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \
71 -n -v @currentThreadsBusy \
71 - -n -m "/status/connector[@name='\"http-bio-8080\"']/requestInfo" -v @requestCount \
72 + -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/requestInfo" -v @requestCount \
73 -n -v @bytesSent -n -)
74
75 tomcat_jvm_freememory="${lines[0]}"