Few days ago I wrote about Agents in OBIEE 12c and how it was possible to enable them by script, automating that part of the process which was still manual.
This time I’m going to write about 2 examples of how I used my findings about Agents, providing the code as download so you can use it in just few seconds.

Two use cases as example

Today I’m going to cover two possible needs with Agents, one mainly for upgrades or code promotion between environments and the second to provide a functionality to the consumers of your OBIEE dashboards and analysis.

  • Execute an agent from a dashboard page / analysis
  • Mass enabling in one step of Agents

(Code is provided, feel free to look at it and adapt or use it as you want)

All the tests and analysis have been done on OBIEE 12.2.1.2.0.
The libraries are probably the same for the previous OBIEE 12c releases and will also work, with some little adjustments for OBIEE 11g (11.1.1.7, 11.1.1.9) as the main javascript libraries are the same.

Keep in mind jQuery wasn’t there in OBIEE 11g, so that’s the main change required.

Mass enabling of Agents in one step

In a running prod OBIEE you can easily have tens or hundreds of Agents: nothing bad with this, they provide functionalities for the consumers. But what happen when you upgrade your old PROD OBIEE 11g to OBIEE 12c? What happen to the Agents?

Well … the Agents end up on the new system but … all disabled ! Now have fun going through the full catalog, finding out which Agents must be enabled and enable them again one by one, by hand.
Not funny at all without forgetting the risk of missing some and have your consumers complaining your upgrade is actually a regression.

Stop fearing your next upgrade, you can enable all your Agents with few clicks from a single page.

Mass enabling Agents from an OBIEE dashboard page

As seen in previous post the OBIEE front-end catalog page uses a lot of javascript to interact with Agents, to enable them. So I put together some javascript code to use these OBIEE libraries to make my (and your) life easier.

Download the OBIEE catalog archive with the dashboard and code

The process to deploy and use this dashboard page is really simple:

  1. In your OBIEE instance go in the Catalog and create a new empty folder (to avoid issues in case you have a dashboard with the same exact name of the one in the file already). Can be your personal folder or the shared folder, works in both places, the path doesn’t matter.
  2. Download the file (a catalog archive) and unarchive (first unzip, then OBIEE unarchive) inside the newly create folder.

    In a empty folder (to avoid issues) unarchive the file

     

  3. Open the imported dashboard named “Manage Agents”

    Open the imported dashboard to see the page managing Agents

     

  4. When the page open, it searches the Agents in the catalog and display a list of them (can take some seconds if you have lot of them)

    A list of all the Agents found in the catalog.

  5. Select the Agents you want to enable (or all of them using the “check all” link) and click the button. If you are sure confirm.

    Select Agents from the list (or all with the “check all” link), click the “Enable selected agents” button and if you are sure confirm.

  6. The javascript OBIEE libraries are doing the work now, the logs show you what’s happening in the background. Once done the list of Agents is reloaded with the new status (if enabled the checkbox isn’t active anymore).

    While running the logs are added Agent by Agent and once done the list is reloaded (with the new status for Agents)

Done ! You can now enable lot of Agents at once.

If the page doesn’t work or take too long to load the list of Agents have a look at your browser console, it gives some output faster than the log box on screen.

Loading the list of Agents can take some time (10-15 seconds for 104 Agents). The console log give you an output of what’s going on while waiting.

How does it work?

The page is a normal dashboard page with “Text” elements containing some javascript and HTML.

Only some javascript and HTML

It uses the embedded jQuery in OBIEE 12c to manage everything: load the required files, actions on checkboxes and button, output to screen.
Completely uses the OBIEE javascript libraries, so it does exactly what the Catalog does, nothing else. There are just 2 methods which are overwritten as they can’t work outside the Catalog (to handle the result and update available actions on an Agent).

Feel free to take the code and change it as you want, you can easily add a disable action too. Something you will maybe want to do is to customize the search of Agents in the catalog by defining a specific path and pattern for names.

You can adjust the value of “path” and “mask” as you want, even add them on screen as text field for a more interactive experience.

All my tests and development have been done on a OBIEE 12.2.1.2.0 but the catalog file must be fine for other 12c versions too. For 11g you will have to adapt things as jQuery isn’t there by default even if the OBIEE javascript functions are probably (tested a bit) 95-100% identical.
I have enabled 102 Agents at once using this script: the page become unresponsive at the beginning when things are running but just leave it there, few minutes later all the Agents were enabled!

Important note: permissions & privileges

As this script does exactly what happen when you click one by one in the catalog the same limitations apply. If your users don’t have the required permissions on the catalog to access the Agents or to enable them this script will not bypass these limitations. It uses the privileges of your current session, so it’s advised to use it with an admin-like account.

Execute an Agent from a dashboard page or an analysis

Sometimes you want to allow your consumers to execute an Agent, run it immediately, from a dashboard page or an analysis. For example if you have somebody in charge of validation of some data/analysis before to send it out to a wider audience.

The approval can be done visually using a dashboard or an analysis, and then to send out the data/analysis you can use an Agent setup without schedule and containing the full list of people, so you find it in the Catalog and click on “Run” directly.

Wouldn’t it be better if you could have a button directly on the validation dashboard page?

Clicking a button on the dashboard page execute the Agent.

Good news again: doable with a really small piece of code.

All you need is a text object with the required code inside.

In this code the path to the Agent is hardcoded, you can definitely change it or make it smarter (a generic event handler reading the path from an attribute of the button HTML tag). Can be executed by a link or anything else as long as it can be triggered in a way or another.

The execution window popup just like in Catalog.

A full example of the script in action.

Important note: permissions & privileges

As this script does exactly what happen when you click “Run” in the Catalog the same limitations apply. If your users don’t have the required permissions on the catalog to access the Agent or to run it, this script will not bypass these limitations. It uses the privileges of your current session.

Final word

As you saw in the above examples a lot is doable. OBIEE is a web application which means you can easily hack pieces and reuses its own libraries for your needs.

If you want to see the details of other actions available on Agents find the actionhandlerimpl.js file on your OBIEE instance (you will find the same file few times) and look inside. If you check the saw.catalogaction.IbotsActionHandler.prototype.handleAction function you see all the actions available in the Catalog for Agents and the same file has details on actions on other kind of objects.

Do not abuse it! If you end up recoding half of the UI you maybe chose the wrong tool for the job.

If it doesn’t work … that’s life: look at the code, analyse what happen, compare with the actual OBIEE native javascript, debug by adding logging and breakpoints.

Feel free to post a comment if you have issues using the code in 12.2.1.0.0 or 12.2.1.1.0, I can easily have a look at those versions, for 11g it’s a bit more difficult as I don’t have environments easily accessible.

Share This