A description of how to customize the appropriate section of the c8-server.conf file to configure the general purpose plugin.
Sybase CEP Engine includes a general purpose plugin, which invokes any executable program you specify in response to an event.
If necessary, you may configure multiple instances of the general purpose plugin to execute different programs in response to different events. You may specify as many event/program pairs as you wish for each Sybase CEP Server. To spawn a single event to more than one program, or to spawn one program from more than one event, a separate instance of the general purpose plugin should be configured for each invocation of each program in response to each desired event.
If you are configuring multiple instances of the plugin, follow the steps described here for each instance you are defining:
This section already contains a "SampleCommandLinePlugin" subsection that looks like this:
<!-- <section name="SampleCommandLinePlugin"> <preference name="LibraryName" value="c8_server_plugins_lib"/> <preference name="InitializeFunction" value="c8_command_line_plugin_initialize"/> <preference name="ExecuteFunction" value="c8_command_line_plugin_execute"/> <preference name="ShutdownFunction" value="c8_command_line_plugin_shutdown"/> <preference name="MessageGroup" value="SampleMessageGroup"/> <preference name="MessageName" value="SampleMessageName"/> <preference name="CommandName" value="/usr/bin/some_command"/> <preference name="CommandArgument1" value="-a={MessageGroup}"/> <preference name="CommandArgument2" value="-b={MessageName}"/> <preference name="CommandArgument3" value="-c={ObjectID}"/> <preference name="CommandArgument4" value="-d={Value}"/> <preference name="MaxRunningProcesses" value="10"/> <preference name="CommandTimeoutSeconds" value="5"/> </section> -->
You can either remove the markings from this section and customize it, as described in this section, or make a copy of the section below the original and customize that copy.
It is best to give the section a meaningful name. Use any name that is unique within the configuration file. For example:
<section name="testplugin1">
<preference name="LibraryName" value="c8_server_plugins_lib"/> <preference name="InitializeFunction" value="c8_command_line_plugin_initialize"/> <preference name="ExecuteFunction" value="c8_command_line_plugin_execute"/> <preference name="ShutdownFunction" value="c8_command_line_plugin_shutdown"/>
For a list of available Sybase CEP Server event groups and the events included in each group, see "Sybase CEP Server Events".
On Microsoft Windows, you can specify only the name of the program, without the path, if the path to the program appears in the %PATH% environment variable.
Replace these with the actual arguments you want to pass to your program. You may also add additional "CommandArgument#" preferences as necessary or delete extra preferences, as needed.
Use the "CommandArgument1" preference to specify the first argument you want to pass to the command, then specify any subsequent arguments in numeric order: using preferences "CommandArgument2", "CommandArgument3" and so on. Sybase CEP Server ignores any arguments that are specified out of order.
For example, configure a shell command such as this:
command -a -b -c -d " -quoted value "
like this:
... <preference name="CommandArgument1" value="-a"/> <preference name="CommandArgument2" value="-b"/> <preference name="CommandArgument3" value="-c"/> <preference name="CommandArgument3" value="-d"/> <preference name="CommandArgument4" value="-quoted value"/> ...
The quotation marks in this example are optional. Sybase CEP Engine automatically adds quotation marks around values that require them, so you do not have to explicitly indicate quotation marks in the argument configuration.
Sybase CEP Engine replaces these names with the corresponding values for every invocation:
{SourceTimestamp}is replaced by the time at which the event took place.
{MessageGroup}is replaced by the message group of the event.
{MessageName}is replaced by the message name of the event, as it occurs within its message group.
{ObjectID}is replaced by the URI of the object to which event applies.
{Value}is replaced by the value associated with the event.
For example:
... <preference name="CommandArgument1" value="\{a\}"/> ...
This preference works in conjunction with the "CommandTimeoutSeconds" preference, and allows you to set the maximum number of event-handling programs spawned by the current instance of the plugin that may execute at the same time.
If a new event arrives when the maximum number of programs are running, Sybase CEP Server attempts to terminate any running event-handling processes that have either finished execution, or have reached the maximum time limit specified by the "CommandTimeoutSeconds" preference. If none of the running processes can be terminated, the new process does not launch.
If you delete this preference, the number of maximum running process defaults to 32.
This works in conjunction with "MaxRunningProcesses" and takes effect only when the indicated maximum number of processes are running. Once the number of running processes reaches the maximum indicated by "MaxRunningProcesses", Sybase CEP Engine terminates all processes launched previously by the current instance of the plugin that have been running longer than the number of seconds indicated by "CommandTimeoutSeconds".
If you delete this preference entirely, "CommandTimeoutSeconds" defaults to 60. A value of 0 indicates that processes should never be timed out.
Most event-handling programs take less than one second to process events that regularly occur once per second: for example notifications about CPU consumption.
Events that occur infrequently, such as Container failure, usually do not occur in groups of more than one, so, in most cases, the maximum running processes and timeout interval is irrelevant. However, Sybase suggests that you consider the maximum number of such events that could occur within a specified time, and set the preferences accordingly.