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 is, surprisingly, an Oracle ACE Associate. He hopes to contribute frequently to US Weekly, People and Sensible Chuckle magazines on improving reporting solutions, creating master data management systems and zzz…


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

  2. Is there any way to test connection of any data server ? I seen one function testDataServer but not able to use that. Could you please assist here.

  3. Hi,

    When you do have an agent fail, is there a way to get an email notification? I know I can build a package to ping the agent and then send mail if it fails but I’d need to add that to a load plan. My issue is I want an email notification that sends automatically if the agent fails to run, before it even gets to the load plan.


  4. Hi,

    Does anyone know what the script for a cron job that notifies me of a nightly ODI agent run fail would look like? I want to schedule a notification if the agent for our nightly run does not work but I’m not sure how to set it up.


Leave a Reply

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