Running WebAgent

The s-Server WebAgent accepts certain HTTP requests which represent sql queries and send the queries to an s-Server. The agent replies with the query results, as JSON objects.

WebAgent functions as a simple, miniature Web server, and is an integral part of SQLstream StreamLab and s-Dashboard. For StreamLab, the WebAgent performs these functions:

  • it directly includes some StreamLab server-side components (including SQL orchestration, discovery and the scrutineer)
  • it provides a websocket interface for sending streaming data to the StreamLab client

In this section you can find information under these topics:

For more information about WebAgent, see Using s-Server over the Internet.

Running Webagent

Starting and Stopping WebAgent

You can start WebAgent:

You can stop WebAgent:

Starting WebAgent as a service

Assuming you have installed s-Server as root, there will normally be a webagentd service installed.

[sudo] service webagentd start

Use sudo if you are not logged in as root. Environment variables and command line switches are defined in /etc/default/webagentd

Managing Parameters for webagentd service

There are several variables defined in /etc/default/webagentd that can be used to control the service:

Variable Equivalent WebAgent command line option Description
WEBAGENT_ENABLE_WEBAPP -a Enables WebAgent Test tool. See Using the WebAgent Test Tool for more details.
WEBAGENT_ENABLE_WRITE -w Enables writable service APIs (/sqlstream and /write)
WEBAGENT_TRACE_DIR Location for trace files (normally */opt/sqlstream/<version>/clienttools/WebAgent)

Other variables in the file are set by installation and normally should not be modified.

Stopping webagent service

[sudo] service webagentd stop

Starting WebAgent as a foreground process

To run WebAgent as a foreground process, you initiate its shell script along the following lines:

webagent.sh –-port <port number> [ -a ] [ -w ]

See also command line options below for more information

Stopping WebAgent as a foreground process

If you are in the terminal session that is running the process, you can just press Ctrl-C to stop webagent.

If you are not in the same terminal session, you can stop webagent in the same way as stopping a background process.

Starting WebAgent as a background process

To run as a background process we place an ampersand at the end of the command line. We may also use nohup if we want to ensure that the process keeps running after the user has logged out.

[nohup] webagent.sh –-port <port number> -a -w &

Stopping WebAgent as a background process

Get the process id (pid) by using the jps utility:

PID=$($JAVA_HOME/bin/jps | grep Main | cut -d' ' -f1)

If there is more than one result, consider using ps instead:

PID=(ps -ef | grep webagent.Main | grep -v grep | awk '{print $2}')

Then stop the process gracefully:

kill $PID

Command-Line Options

When run with no arguments, the WebAgent runs on port 5580 and uses "localhost" and 5570 as the default host and port for the JDBC connection to s-Server. Each request to WebAgent can specify the s-Server host and port, so a single instance of WebAgent can communicate with multiple s-Server instances. See Parameters Common to All Requests.

Following are the command line options for webagent.sh:

Option Alias Description
-a --enable-app Enables WebAgent Test tool. See Using the WebAgent Test Tool for more details. Default is disabled
-p --port Selects WebAgent port. Default is 5580
-sn --SQLstream-name Specifies s-Server user name, default is “”
-sp --SQLstream-password Specifies s-Server password, default is “”
-su --SQLstream-url Specifies s-Server JDBC URL, default is “jdbc:sqlstream:sdp://localhost:5570”
-w --enable-write Enables writable services (/sqlstream and /write)
-g --debug Sets a debug port for WebAgent
-v --verbose Enables verbose mode
--help Shows help message
-D Sets a java property, such as: webagent.sh -Dwebagent.stream.fetchTimeout=30orwebagent.sh -D websocket.maxwaitforwrite = N (where N is seconds. Default is 10 seconds)