StreamBase Monitor Adapter Sample

This sample contains two StreamBase applications that demonstrate the use of the TIBCO StreamBase® Monitor Adapter.

This Sample's Files

The sample includes the following EventFlow applications:

  • 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.

  • 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 the OperatorBusy output stream.

Running SBMonitorAdapter in StreamBase Studio

  1. In the Package Explorer, double-click to open SBMonitorAdapter.sbapp. Make sure the application is the currently active tab in the EventFlow Editor.

  2. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  3. In the Application Output 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.

  4. Try selecting a single stream such as SystemInfo from the drop-down in the Application Output view. For SystemInfo, notice that the timeRunning field increases by one every second, and that the memory statistics such as totalMemory and freeMemory change slightly as the application runs.

  5. When done, press F9 or click the Stop Running Application button.

Running SBMonitorServer in StreamBase Studio

  1. In the Package Explorer, double-click to open SBMonitorServer.sbapp. Make sure the application is the currently active tab in the EventFlow Editor.

  2. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  3. In the Application Output 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 filter IsThreadBusy, which drops everything except threads using high amounts of CPU.

  4. 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 changing ThreadCPUThresholdMS to 5 and restarting the server.

    In the Application Output view, notice that the ThreadBusy output stream is now printing alerts for threads that use more than 5 milliseconds every sampling period.

  5. When done, press F9 or click the Stop Running Application button.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top menu, select FileLoad StreamBase Sample.

  • 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.

Sample Location

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 the permission problems that can occur when trying to work with the initially installed location of the sample. 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 location of streambase-install-dir on your system. This location may require administrator privileges for write access, depending on your platform.

Back to Top ^