Senin, 04 Oktober 2010

Auto starting your SpagoBI

We have implemented SpagoBI as one of our monitoring dashboard. It was great so we decided to put it in one of our big screen TV so everyone can watch. We're using a regular desktop PC so regular restart is needed.

One of my main concern is, someone has to maintain it, so everytime it gets started, spago is automatically brought up, authenticate and redirects you to the specific page.

This is really easy. But first, you need to have an access to a webserver. It doesnt have to be a sophisticated one, as long as it could handle 1 KB page.

This 1 KB page we'll use a trigger to authenticate, so basically what will be contained in the 1 KB page is as below:

<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
</head>
<body onload="document.forms.form1.submit();">
<form id="form1" action="http://spagoserver:8080/SpagoBI/servlet/AdapterHTTP?PAGE=LoginPage&NEW_SESSION=TRUE" method="post">
<input name="userID" type="hidden" value="yuvi" /> </input>
<input name="password" type="hidden" value="mypassword" /> </input>
</form>
</body>
</html>

As you can see, my server is installed mostly with default setting. The page above will automatically redirect us to the spagoBI page and authenticate, see our hidden input that is automatically submitted.

And we know it aint enough since we need to see one specific page instead of the homepage. So what would you do?

We only need to add additional object label and parameter to above action attribute within form tag. According to the SpagoBI wiki, the complete URL should be:

http<or https>://<your server name>:<your server port>/SpagoBI/servlet/AdapterHTTP?PAGE=LoginPage&NEW_SESSION=TRUE&OBJECT_LABEL=<label of the document you want to be executed>&PARAMETERS=<parameters for document execution>

In my case, it is:
http://spagoserver:8080/SpagoBI/servlet/AdapterHTTP?PAGE=LoginPage&NEW_SESSION=TRUE&OBJECT_LABEL=<CC%20Today>&PARAMETERS=documentLabel

During object creation (by the Spago Admin of course), the parameter is defined, and that is where the documentLabel come from. To know better, you could check out the metadata information for that object.

Now, one more problem to resolve, which is to automatically bring up browser once it is restarted.

In windows, it's quite easy, you just need to add one scheduled task, run everytime the system starts up and the command line interface is quite simple. I happen to use google chrome and it goes this way:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --app="http://localhost/autostart.html". As you can see, I'm using local web server. It's not that much of requirement for hardware, run with only 512 MB.

For firefox, you can use this:
"C:\Program Files\Mozilla Firefox\firefox.exe" "http://127.0.0.1/autostart.html"

The autostart.html is the one that contains the above html file.

And that is all.

Tidak ada komentar: