|
Main Universal Agent page
>
Screen shot tour
> Integration Example #1
Integration Example #1
Integrating an application for which you have source code
This integration example (the roulette application)
is available for download in Solaris and
Windows versions. The download includes
full source code.
Integrating an application for which you have source
code is almost trivial. Remember that you need not modify your source
code. OC Systems' patented application patching technology instruments
the application at runtime, when it is in memory.
 |
|
For a larger view please click
the image. |
Here you see a Node View of the Universal Agent showing
an integration of application roullette.exe. The specific resources that
are being monitored are Bet, Debt, and BankTotal. These resources
represent program variables within the application.
How did we extract the program variable values from the
application without modifying the source code, and how did we integrate
those values into Unicenter NSM?
At the bottom left of the screenshot we see a portion of
file roullette.c, the source code for the application. We are interested
in extracting the following program variables:
-
The parameter "Amount" that is passed to
function "Bet()".
-
The return value from function "BankTotal()".
-
Variable "Debt" (not shown—declared as a
static global variable).
At the bottom right of the screenshot we see the
complete contents of file roullette.apc. This is the code that was
developed to instrument the application and integrate it into NSM. Let's
take a look at what the code does:
-
"probe extern:Bet()" indicates that
function "Bet()" is to be instrumented.
-
"on_entry" indicates that the following
code is to be executed when this function is called, before the
function's existing code is executed.
-
"probe extern:BankTotal()" indicates that
function "BankTotal()" is to be instrumented.
-
"on_exit" indicates that the following
code is to be executed when this function returns, after the
function's existing code is executed.
The code that is executed in these probes is the
Universal Agent API. Let's look at the UA_api() calling sequence. The
first parameter identifies the resource name; the third parameter
specifies its value. Notice how each individual portion (separated by
dots) of the resource name is mapped into distinct nodes in Node View.
The resource values being passed in the UA_api() calls
are as follows:
-
"$Amount" is the value of parameter
"Amount" in function "Bet()".
-
"$return" is the value returned by
function "BankTotal()".
-
"$Debt" is the value of global variable
"Debt" as it exists when function "BankTotal()"
returns.
The Universal Agent application instrumentation
technology allows you to inject code into your application at any
location: program entry and exit, function entry and exit, even down to
the source code line level! Although the original application source
code is never modified, the injected code is written as though, and
behaves exactly as if, it were a part of the original source code.
Now take a look at
Integration
Code Example #2: Integrating an application for which you have NO source
code.
Even if you have source code for an application, you may
still want to use the "no-source" instrumentation/integration
techniques. For example, if you are interested in overall resource usage
by the application, you may only be able to obtain this data by
instrumenting the system API layer. In other cases, it is simply easier
to extract the desired resource data by instrumenting the API layer.
Want to learn more? Schedule an
online
demo.
|