Contents
This sample contains two StreamBase applications that demonstrate the use of the TIBCO StreamBase® Monitor Adapter.
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.
-
In the Project Explorer, double-click to open
src/main/eventflow/com.sample.adapter.sbmonitor/SBMonitorAdapter.sbapp
. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the
Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Output Streams view, select All Output Streams to view the output from the adapter. 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
Stop Running Application button.
-
In the Project Explorer, double-click to open
src/main/eventflow/com.sample.adapter.sbmonitor/SBMonitorServer.sbapp
. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the
Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Output Streams view, select All Output Streams to view the output from the adapter. 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
Stop Running Application button.
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, select
→ . -
Type
monitor
in the search field to narrow the list of samples. -
From the Standard Adapters category, select StreamBase Monitor.
-
Click OK.
StreamBase Studio creates a project folder for this sample.
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 location of studio-workspace
on your system.
In the default TIBCO StreamBase installation, this sample's files are initially installed in:
streambase-install-dir
/sample/adapter/embedded/sbmonitor
See Default Installation Directories for the default location of studio-workspace
on your system.