The ODI Agent, Restarts and Groovy

I tend to work with ODI quite a bit. Recently, I came across a scenario where the standalone agent on one of our boxes was turning itself off once in a while. While the issue was fixed, it did provide the impetus for this post. Today, we’ll take a look at the ODI (11g) standalone agent, and, at a simple start script to (re)start it. If we open up the physical agent from ODI Studio, we can see that it has the following components.

The host name, is the server on which the agent is installed. The agent install is tied to a port (usually, 20910). The protocol used, is “http”, in this case. The application context is set to “oraclediagent” for standalone agents. BTW, Oracle provides an example tutorial on setting up the 11g agent.

If we put those pieces together, we have the components to put together a URL. For instance, if we open up a browser and put those elements in, we get the following results, if everything is working normally:

If we now turn the agent service off, we can see:

We can use this information to our advantage when starting the ODI agent. The thing to understand, is that when resolving URLs, a return code of “200” is considered to be successful (see statuses). We can ascertain this for the ODI agent URL, on Firefox, by right clicking and selecting Inspect Element.

Knowing this, we can set up a simple script to check whether the service is available, and turn it on, if needed. I will be using Groovy code (for earlier examples on the Groovy Console, check this link) in this example. The first line sets up the agentURL, and the second line, preps a DOS command (we are using “sc” as the agent is on a Windows box) which can be used to start the agent.

Note that you need to escape the “\”. Also, the location of the “sc” executable maybe different on your machine. Lastly, the service name on my box, is “oracle.odi.agent”.

We can now set up a simple “try/catch” statement to open the http connection and check for the response code. This is done in the “try” section below.

The “catch exception” section above checks for http connection issues. It then proceeds to run the “sc start” command. It also writes out the responses to the console. Let’s look at this code in action. In the screenshot below, the agent is up and functional.

In the screenshot below, the agent service is down, and is being restarted by the script.

You can then add a “sleep” if you wish to check if the agent is up again if you wish. The code in its entirety:

Obviously, there are different ways to do this type of thing. You can write this sort of code with any programming platform. You can also check status of the agent directly as well. I thought it would be a different way to understand how the ODI agent works before exploring some of the posts coming soon, which address other aspects of ODI.


About Vijay Kurian

Known as the Clem Fandango of EPM consulting, Vijay Kurian has been developing enterprise solutions for companies for the last 12 years (increment years if reading post-2015). Having worked with Essbase, Planning, DRM and other assorted technologies during that time, he’s made the frankly, average decision, to write about them. He hopes to contribute frequently to US Weekly, People and Sensible Chuckle magazines on improving reporting solutions, creating master data management systems and zzz…

One Comment

  1. Hey Mr Vijay,
    What ended up being the problem with the agent?

Leave a Reply

Your email address will not be published. Required fields are marked *