diff options
author | paulfantom <paulfantom@gmail.com> | 2016-06-17 17:01:54 +0200 |
---|---|---|
committer | paulfantom <paulfantom@gmail.com> | 2016-06-17 17:01:54 +0200 |
commit | 70e2d2feb380d3ae43e9b89e10cea721c30260ac (patch) | |
tree | 6fb710b3a4003072d1557764af49dfe354bdb5fb /charts.d | |
parent | 5208f7d2a75dc1cf38a91b7b5e2808968a9804c2 (diff) |
fix variable naming in tomcat.chart.sh
Diffstat (limited to 'charts.d')
-rwxr-xr-x | charts.d/tomcat.chart.sh | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh index b0eddc7f0d..50a17e2b3f 100755 --- a/charts.d/tomcat.chart.sh +++ b/charts.d/tomcat.chart.sh @@ -9,8 +9,8 @@ tomcat_url="" tomcat_curl_opts="" # set tomcat username/password here -tomcatUser="" -tomcatPassword="" +tomcat_user="" +tomcat_password="" # _update_every is a special variable - it holds the number of seconds # between the calls of the _update() function @@ -37,13 +37,23 @@ tomcat_check() { echo >&2 "tomcat url is unset or set to the empty string" return 1 fi - if [ -z "${tomcatUser}" ]; then - echo >&2 "tomcat user is unset or set to the empty string" - return 1 + if [ -z "${tomcat_user}" ]; then + # check backwards compatibility + if [ -z "${tomcatUser}" ]; then + echo >&2 "tomcat user is unset or set to the empty string" + return 1 + else + tomcat_user="${tomcatUser}" + fi fi - if [ -z "${tomcatPassword}" ]; then - echo >&2 "tomcat password is unset or set to the empty string" - return 1 + if [ -z "${tomcat_password}" ]; then + # check backwards compatibility + if [ -z "${tomcatPassword}" ]; then + echo >&2 "tomcat password is unset or set to the empty string" + return 1 + else + tomcat_password="${tomcatPassword}" + fi fi # check if we can get to tomcat's status page @@ -65,7 +75,7 @@ tomcat_check() { tomcat_get() { # 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_curl_opts} "$tomcat_url" |\ + mapfile -t lines < <(curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\ xmlstarlet sel \ -t -m "/status/jvm/memory" -v @free \ -n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \ |