diff options
author | Jorge Romero <Jorge.Romero@openbondx.com> | 2016-05-06 15:28:28 -0400 |
---|---|---|
committer | Jorge Romero <Jorge.Romero@openbondx.com> | 2016-05-06 15:28:28 -0400 |
commit | 5e5cf142e7e86b9cb41fa6df6dd7e399e07e2c83 (patch) | |
tree | 9b591dc1ec6fa939adca747368e6242e889edff2 /charts.d/tomcat.chart.sh | |
parent | f6ae8f332eb5a57c880a7af4cab5479c3106ac6a (diff) |
adding checks to make sure url, username and password are set.
Diffstat (limited to 'charts.d/tomcat.chart.sh')
-rwxr-xr-x | charts.d/tomcat.chart.sh | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh index fd8d33920a..ee17d1757e 100755 --- a/charts.d/tomcat.chart.sh +++ b/charts.d/tomcat.chart.sh @@ -4,9 +4,10 @@ # Author: Jorge Romero # the URL to download tomcat status info -tomcat_url="http://localhost:8080/manager/status?XML=true" +# usually http://localhost:8080/manager/status?XML=true +tomcat_url="" -# set tomcat user/password here +# set tomcat username/password here tomcatUser="" tomcatPassword="" @@ -29,10 +30,26 @@ tomcat_check() { require_cmd xmlstarlet || return 1 + + # check if url, username, passwords are set + if [ -z "${tomcat_url}" ]; then + echo "tomcat url is unset or set to the empty string" + return 1 + fi + if [ -z "${tomcatUser}" ]; then + echo "tomcat user is unset or set to the empty string" + return 1 + fi + if [ -z "${tomcatPassword}" ]; then + echo "tomcat password is unset or set to the empty string" + return 1 + fi + + # check if we can get to tomcat's status page tomcat_get if [ $? -ne 0 ] then - echo >&2 "tomcat: cannot find status page on URL '${tomcat_url}'. Please set tomcat_url='http://localhost:8080/manager/status?XML=true'" + echo >&2 "tomcat: couldn't get to status page on URL '${tomcat_url}'. Please make sure tomcat url, username and password are correct." return 1 fi |