close

Filter

loading table of contents...

Operations Basics / Version 2107

Table Of Contents

4.9.3.2 Action Elements

An action definition is defined by the tag <ActionType>. For <ActionType>, the name of the desired action is entered. A list of all possible actions is given in the table below. The action is configured with a series of attributes, as follows:

Note

Note

Actions that need to log into the Content Server, such as the ServerMode or ProcessStatus action, can use the predefined user "watchdog" with the default password "watchdog" for this purpose.

General attributes

Attribute Optional Description
name   The name of the action. It must be unique within the configuration file.
interval x Interval (in seconds) at which the number of action calls is checked. Checking is switched off with "0" (Default).
events x Maximum permissible number of calls of the action within "interval". If the maximum number is exceeded, the action is not executed and the error message "respawning_too_fast" is delivered. "events" is only used if "interval" <> "0".
timeout x Time (in seconds) to wait until a pending action is canceled with the error message "11". The default value is 60 seconds.

Table 4.12. General attributes of the Action element


In addition, specific attributes can be assigned to the actions. These can be found in the following description of the actions.

Possible actions

Custom  
Description

This action invokes a custom watchdog action (see the Javadoc of CustomAction for details). You have to add two nested tags - Custom and Action - into the watchdog.xml file to call the action.

Example:

<Custom name="my first action" timeout="10">
 <Action class="com.customer.MyWatchDogAction" myprop="ok">
  <MySub class="com.customer.MySub" foo="bar"/>
  <MySub class="com.customer.MySub" foo="baz"/>
 </Action>
</Custom>

In this example, class com.customer.MyWatchDogAction would need to implement CustomAction, would need a no-args constructor, a setter for myprop and a method addMySub accepting a MySub object. The Class com.customer.MySub would need a no-args constructor and a setter for foo. This allows for elaborate configuration. Please read the chapter "The BeanParser" of the Workflow Manual for details.

Make sure that your custom action will not accumulate resources (Database, JMS connections etc.), otherwise the watchdog would itself need to be watched. In all nontrivial cases, starting an external script is strongly preferred.

The nested tags of the Action tag depend on the setters defined in your custom action class, here com.customer.MyWatchdogAction.

Attributes The Custom tag supports the general attributes for actions. All sub tags of Custom need the class attribute. All other attributes of the Action tag and its sub tags depend on the custom action.
Error Codes The error codes returned from the execute() method of the custom action class.

Table 4.13. Custom Action


DB  
Description This action checks a CoreMedia database over the JDBC API.
Attribute

driver

JDBC driver to use

url

URL where to connect to the database

user

Name of the database user

password

Password of the database user

propertyFile

The CoreMedia database configuration file (sql.properties) where the settings (driver, URL, password, user) are configured. The path must be relative to $COREM_HOME/properties. See ???? for details of the syntax of the configuration file.

You have to specify either driver, URL, user and password or the propertyFile attribute.

sql

The database statement that is used to check the database. Default is SELECT * FROM Resources WHERE id_ = 1.

Error codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respawning_too_fast)

21 (io_error)

61 (no_jdbc_driver)

62 (no_connection)

63 (sql_exception)

Table 4.14. Action DB


Http  
Description This action requests a URL and checks whether the response code is "200". If so configured, it also checks whether the response matches a given regular expression.
Attribute

url

Requested URL

user

User name to use for HTTP basic authentication, if given together with the password attribute

password

Password to use for HTTP basic authentication, if given together with the user attribute

pattern

Regular expression according to java.util.regex.Pattern to be used for verifying the response

encoding

Character encoding for parsing the response, if the pattern attribute is given

maxSize

Maximum permitted size of the response in characters (default 65536), if the pattern attribute is given

Error codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respawning_too_fast)

21 (io_error)

Table 4.15. Action HTTP


JMX  
Description

The JMX action retrieves an attribute from any application via JMX and converts the attribute's value into a watchdog code. This attribute conversion is done by one or more configured com.coremedia.watchdog.impl.CodeConverter instances. Each configured converter might either return a watchdog code or a special "not responsible" code. The JMX action iterates over each converter until a watchdog code is returned. In case that all converter return a "not responsible" code, a configured default code is used.

By default, a converter com.coremedia.watchdog.impl.NumberRangeConverter is provided which expects the JMX attribute to be a number (such as int or long) and which returns a configured watchdog code if the number is included in a configured range of numbers.

You might also implement a custom converter by extending com.coremedia.watchdog.impl.CodeConverter. See the Javadoc for more details.

Attribute

serviceUrl

A URL to connect to a JMX server

objectName

The qualified name of the MBean.

attributeName

The name of the MBean's attribute

defaultCode

The watchdog code to use if none of the converters is responsible

username

The user name for the JMX connection (optional).

password

The password for the JMX connection (optional).

Nested elements

Each converter needs to be specified as a <Converter> and has to provide its implementation class by "class" attribute. If the converter implementation provides additional configurable attributes ("setter methods"), these attributes might be specified as well.

Error codes The error codes depend on the configured converters or the default code is returned.

Table 4.16. JMX Action


Example
<Jmx name="myJmxAction"
          serviceUrl="service:jmx:jmxmp://localhost:5555/"
          objectName="com.coremedia:type=ProactiveEngine,application=caefeeder"
          attributeName="HeartBeat"
          defaultCode="ok">
    <Converter class="com.coremedia.watchdog.impl.NumberRangeConverter" 
                    min="10" max="29999" code="ok"/>
    <Converter class="com.coremedia.watchdog.impl.NumberRangeConverter" 
                    min="30000" code="error"/>
</Jmx>

The JMX action "myJmxAction" retrieves the attribute HeartBeat of the MBean com.coremedia:type=ProactiveEngine,application=caefeeder. If the attribute value is between 10 and 29999 then a watchdog code "ok" is returned. A value greater or equal "30000" results in a code "error". The default code "ok" is used if no converter applies, if the value is lower than 10, for instance.

ProcessStatus  
Description This action checks whether a specified number of instances of a process definition with a given name runs in the Workflow Server. It is also checked that these instances do not contain escalated tasks.
Attribute

url

URL where to get the IOR of the Workflow Server

user

CoreMedia user name to log on to the server

domain

Domain of the user

password

CoreMedia user password to log on to the server

processName

The name of the process definition. The predefined workflows have the following process names: GlobalSearchAndReplace, SimplePublication, ThreeStepPublication, TwoStepApproval, TwoStepPublication.

minCount

The minimum number of instances to expect, typically 1

maxCount

The maximum number of instances to expect

Error Codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respawning_too_fast)

21 (io_error)

32 (invalid_login)

91 (escalated)

92 (too_few_instances)

93 (too_many_instances)

Table 4.17. ProcessStatus


ServerMode  
Description This action checks the runlevel of the CoreMedia server. This ensures that the server has reached the specified runlevel and that certain clients can connect to the server.
Attribute

url

URL where to get the IOR of the server

user

CoreMedia user name to log on to the server.

domain

Domain of the user.

password

CoreMedia user password to log on to the server

mode

The expected server runlevel. Valid values are "maintenance", "administration" and "online".

Error codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respawning_too_fast)

21 (io_error)

31 (no_licenses)

32 (invalid_login)

33 (corba_error)

71 (insufficient_mode)

Table 4.18. Action ServerMode


ServerQuery

 

Description

This action executes a database query on the CoreMedia server over the CORBA API. In this way, all integral components of the server from ORB to the database connection are checked.

Attribute

url

URL where to get the IOR of the server

user

CoreMedia user name to log on to the server

domain

Domain of the user.

password

CoreMedia user password to log on to the server

Error Codes

0 (ok)

11 (timeout)

12 (error)

13 (respanwing_too_fast)

21 (io_error)

31 (no_licenses)

32 (invalid_login)

33 (corba_error)

41 (repository_error)

51 (query_malformed)

52 (query_failed)

Table 4.19. Server Query


ServiceStatus  
Description This action checks a certain service offered by the CoreMedia server, for example the replicator of a Replication Live Server.
Attribute

url

URL where to get the IOR of the server

user

CoreMedia user name to log on to the server

domain

Domain of the user.

password

CoreMedia user password to log on to the server

service

Name of the checked service. Possible values are:

  • replicator

  • adminlogin

  • userlogin

Error codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respawning_too_fast)

21 (io_error)

31 (no_licenses)

32 (invalid_login)

33 (corba_error)

81 (service_stopped)

82 (service_failed)

83 (service_disabled)

Table 4.20. Action ServiceStatus


Script  
Description

This action executes a shell command and checks whether the programs' return code is "0". If the command returns with a different value, an error is assumed.

Under the Windows operating system you cannot use non-executable commands like dir, copy or echo directly. They will result in a java.io.IOException. The reason is that these commands are part of the Windows command interpreter and not a separate executable. To run these commands use the Windows command interpreter by calling cmd.exe, for example: cmd.exe /C echo test.

Attribute

command

Name of the executable command

Error codes 0 (ok)

Table 4.21. Action Script


WorkflowServerQuery  
Description This action executes a database query on the CoreMedia workflow server over the CORBA API. In this way, all integral components of the server from ORB to the database connection are checked.
Attribute

url

URL where to get the IOR of the server

user

CoreMedia user name to log on to the server

domain

Domain of the user.

password

CoreMedia user password to log on to the server

Error Codes

0 (ok)

10 (unexpected_error)

11 (timeout)

12 (error)

13 (respanwing_too_fast)

21 (io_error)

32 (invalid_login)

41 (repository_error)

52 (query_failed)

Table 4.22. WorkflowServerQuery


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.