Contents
This sample contains two StreamBase applications that demonstrate the use of the TIBCO StreamBase® Monitor Adapter.
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, select
> . -
Enter
monitor
to narrow the list of options. -
Select StreamBase Monitor Input Adapter From the StreamBase Standard Adapters category.
-
Click
.
StreamBase Studio creates a project folder for this sample.
-
In the Project Explorer view, open the sample you just loaded.
If you see red marks on a project folder, wait a moment for the project to load its features.
If the red marks do not resolve themselves after a minute, select the project, right-click, and select
> from the context menu. -
Open the
src/main/eventflow/
folder.packageName
-
Open the
SBMonitorAdapter.sbapp
file and click the Run button. This opens the SB Test/Debug perspective and starts the module. -
In the Output Streams view, select All Output Streams to view the adapter output. Observe a burst of output once per second, describing all performance information for the server instance hosting this application.
-
Try selecting a single stream such as
SystemInfo
from the drop-down in the Output Streams view. ForSystemInfo
, notice that thetimeRunning
field increases by one every second, and that the memory statistics such astotalMemory
andfreeMemory
change slightly as the application runs. -
When done, press F9 or click the Terminate EventFlow Fragment button.
-
Continuing with the same sample project, open the
SBMonitorServer.sbapp
file and click the Run button. This opens the SB Test/Debug perspective and starts the module. -
In the Output Streams view, select All Output Streams to view the adapter output. Unlike the simple
SBMonitorAdapter
application, in this case, the output from the adapter is filtered to emit only events of interest. For example, the Thread information (port #4) is connected to filterIsThreadBusy
, which drops everything except threads using high amounts of CPU. -
In the EventFlow Editor for
SBMonitorServer.sbapp
, select the Parameters tab. These parameters are used by the various filters to determine whether to pass an interesting event. Try changingThreadCPUThresholdMS
to 5 and restarting the server.In the Output Streams view, notice that the
ThreadBusy
output stream is now printing alerts for threads that use more than 5 milliseconds every sampling period. -
When done, press F9 or click the Terminate EventFlow Fragment button.
The sample includes the following EventFlow applications:
-
src/main/eventflow/com.sample.adapter.sbmonitor/SBMonitorAdapter.sbapp
contains a single StreamBase Monitor adapter with all of its output ports enabled. Start this application to see the monitor data for the server instance running the application itself. -
src/main/eventflow/com.sample.adapter.sbmonitor/SBMonitorServer.sbapp
can run in its own StreamBase Server instance and connect remotely to another server, or can be added to a new container in a server with a running application. It will emit tuples only when certain performance thresholds are passed. For example, if any operator uses more than 0.3 seconds of CPU time in a one-second cycle sample, all information about that operator is emitted on theOperatorBusy
output stream.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/sample_adapter_embedded_sbmonitor
See Default Installation
Directories for the default location of studio-workspace
on your system.