From 50485bedfd9818165aa1d039d0abe95a559134b7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 8 Feb 2019 08:31:03 +0100 Subject: Merging upstream version 1.12.0. Signed-off-by: Daniel Baumann --- collectors/charts.d.plugin/tomcat/README.md | 6 +++++- collectors/charts.d.plugin/tomcat/tomcat.chart.sh | 26 ++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'collectors/charts.d.plugin/tomcat') diff --git a/collectors/charts.d.plugin/tomcat/README.md b/collectors/charts.d.plugin/tomcat/README.md index d82951aac..843378604 100644 --- a/collectors/charts.d.plugin/tomcat/README.md +++ b/collectors/charts.d.plugin/tomcat/README.md @@ -1,2 +1,6 @@ +# tomcat + > THIS MODULE IS OBSOLETE. -> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT +> USE [THE PYTHON ONE](../../python.d.plugin/tomcat) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT + +[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Ftomcat%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]() diff --git a/collectors/charts.d.plugin/tomcat/tomcat.chart.sh b/collectors/charts.d.plugin/tomcat/tomcat.chart.sh index 294487b8b..9ca75e63e 100644 --- a/collectors/charts.d.plugin/tomcat/tomcat.chart.sh +++ b/collectors/charts.d.plugin/tomcat/tomcat.chart.sh @@ -32,24 +32,23 @@ tomcat_priority=60000 # will be in the proper units tomcat_decimal_detail=1000000 -# used by volume chart to convert bytes to KB -tomcat_decimal_KB_detail=1000 +# used by volume chart to convert bytes to kB +tomcat_decimal_kB_detail=1000 tomcat_check() { require_cmd xmlstarlet || return 1 - # check if url, username, passwords are set if [ -z "${tomcat_url}" ]; then - error "tomcat url is unset or set to the empty string" + error "tomcat url is unset or set to the empty string" return 1 fi if [ -z "${tomcat_user}" ]; then # check backwards compatibility # shellcheck disable=SC2154 if [ -z "${tomcatUser}" ]; then - error "tomcat user is unset or set to the empty string" + error "tomcat user is unset or set to the empty string" return 1 else tomcat_user="${tomcatUser}" @@ -59,7 +58,7 @@ tomcat_check() { # check backwards compatibility # shellcheck disable=SC2154 if [ -z "${tomcatPassword}" ]; then - error "tomcat password is unset or set to the empty string" + error "tomcat password is unset or set to the empty string" return 1 else tomcat_password="${tomcatPassword}" @@ -69,8 +68,7 @@ tomcat_check() { # check if we can get to tomcat's status page tomcat_get # shellcheck disable=2181 - if [ $? -ne 0 ] - then + if [ $? -ne 0 ]; then error "cannot get to status page on URL '${tomcat_url}'. Please make sure tomcat url, username and password are correct." return 1 fi @@ -84,8 +82,12 @@ tomcat_check() { tomcat_get() { # collect tomcat values - tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")" - mapfile -t lines < <(run curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\ + tomcat_port="$( + IFS=/ read -ra a <<<"$tomcat_url" + hostport=${a[2]} + echo "${hostport#*:}" + )" + mapfile -t lines < <(run curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" | run xmlstarlet sel \ -t -m "/status/jvm/memory" -v @free \ -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \ @@ -107,8 +109,8 @@ tomcat_create() { cat <