Skip to main content

Remote Validation URL Check

So I decided today that I wanted to be able to check validation URLs much like the previous post I wrote Bash Check Validation URLs but this time I didn't want to have to login to each EPM environment to do it. I simply wanted to open a terminal and run a command to check the validationContext URL's that are stored in the registry.html file. In order to do this
you need to have a copy locally of each EPM environments registry.html file. Since you can't have more than one file with the same name I decided to rename each environments registry.html file something like this: dev_registry.html, qa_registry.html, prod_registry.html.

Now that I have the registry.html files locally I want to check the validation URL's but I need to create a function to do it.

Since I use Bash on a daily basis I decided to put my URL checking functions in my local .bashrc file. This way as soon as I fire up my terminal my monitoring checking commands are ready for use.

The first function I need is one that can parse the correct registry.html file and pass the host name port and URL to check over to a second function that actually does the checking. The first function named 'check_remote_webapps' accepts a parameter of [ dev, qa, or prod ]. I've used some variable arrays to store a few values. Mainly the EPM environments name of the registry file to read, the hostname of the webserver, and the port number of the web server. I'm using OHS in this example so the port is 19000 but it could easily be changed to whatever port number your WEB_SERVER component has in the registry.html file.


check_remote_webapps () {
# parse _registry.html files for required values
# $1 = epm env ie: dev1, dev2, test, prod

  declare -A epmdev=(["regfile"]="dev_registry.html" ["host"]="hyp_dev_web_server" ["port"]="19000")
  declare -A epmqa=(["regfile"]="qa_registry.html" ["host"]="hyp_qa_web_server" ["port"]="19000")
  declare -A epmprod=(["regfile"]="prod_registry.html" ["host"]="hyp_prod_web_server" ["port"]="19000")

  printf "response time | http status code | URL\n"

  case $1 in
  "dev")
    for url in $(cat ./${epmdev1["regfile"]} | grep validationContext | cut -d'>' -f5 | cut -d'<' -f1)
    do
     check_url ${epmdev1["host"]} ${epmdev1["port"]} ${url}
    done
    ;;
  "qa")
    for url in $(cat ./${epmqa["regfile"]} | grep validationContext | cut -d'>' -f5 | cut -d'<' -f1)
    do
     check_url ${epmqa["host"]} ${epmqa["port"]} ${url}
    done
    ;;
  "prod")
    for url in $(cat ./${epmprod["regfile"]} | grep validationContext | cut -d'>' -f5 | cut -d'<' -f1)
    do
     check_url ${epmprod["host"]} ${epmprod["port"]} ${url}
    done
    ;;
  esac

}

My second function is named 'check_url'. It accepts three arguments. The first is the hostname of the web server, the second is the port of the web server and the third is the validationContext URL that we'll be checking. This function requires the use of curl, so if you don't have that installed this won't work, but curl is a pretty common tool so I'm sure you'll have it available.

check_url () {
local host=$1
local port=$2
local url=$3

curl -fL ${host}:${port}/$url -w '%{time_total} | %{http_code} | %{url_effective}\n' -so /dev/null
}

So now that we have both functions saved to the .bashrc file all you need to do now is source the file. You can do something like this:

. .bashrc

Now run the command
check_remote_webapps dev

Sample of Output below

response time | http status code | URL
1.318 | 200 | HTTP://hyp_web_server:19000/HyperionPlanning/
0.166 | 200 | HTTP://hyp_web_server:19000/calcmgr/index.htm
0.707 | 200 | http://hyp_web_server:19000/WebAnalysis/
0.143 | 200 | HTTP://hyp_web_server:19000/hr/status.jsp
0.368 | 200 | HTTP://hyp_web_server:19000/awb/conf/AwbConfig.xml
0.249 | 200 | HTTP://hyp_web_server:19000/easconsole/console.html
0.147 | 200 | HTTP://hyp_web_server:19000/aps/APS
0.077 | 403 | HTTP://hyp_web_server:19000/essbase-webservices/AdminService
2.758 | 200 | http://hyp_web_server:19000/DataSync/

0.140 | 200 | HTTP://hyp_web_server:19000/raframework/index.jsp

So with just a few lines of code you can have a very simple but effective monitoring tool. You can get the file from this link or from my Downloads page.

Comments

Popular posts from this blog

Bash function to check validation URLs

Here's a simple bash function that with the use of the 'curl' command can run some simple tests to see if your application is actually up and running. We know in the monitoring world of Hyperion it's not enough to just check the port. The java process could be bound and listening to a port but the Java webapp might not have initialized due to many possible reasons.

bash function to run MaxL scripts & error handling

Lately I've been working on creating a function in bash so that I can generically call MaxL scripts and process return codes from them so that I can do some error handling and possibly send a notification via email or SMS message depending on the situation. How the essbase_run_task function works is like this: