Caucho maker of Resin Server | Application Server (Java EE Certified) and Web Server


 

Resin Documentation

home company blog docs 
app server 
 Resin Server | Application Server (Java EE Certified) and Web Server
 

health checking


Resin Professional includes a powerful and configurable system for monitoring application server health. The system is intentionally similar to the Resin's "URL Rewrite" rules, based on a configurable set of checks, conditions, and actions. The health checking system runs internal to Resin on a periodic basis. Checks are generally always performed on the local Resin node, and if actions are to be taken, they are performed against the local Resin node as well.

Configuration

Health configuration is an extension of the standard Resin configuration file resin.xml. Because Resin uses CanDI to create and update Java objects, each XML tag exactly matches either a Java class or a Java property. As a result, the HealthSystem JavaDoc and the JavaDoc of the various checks, actions, and predicates help to supplement the documentation as much as this reference.

health.xml

Resin version 4.0.16 and later includes health.xml as a standard Resin configuration file alongside resin.xml and app-default.xml.

health.xml is imported into resin.xml as a child of <cluster> or <cluster-default>.

Example: importing health.xml into resin.xml
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin">
  <cluster-default>  
    ...
    <!--
       - Admin services
      -->
    <resin:DeployService/>
    
    <resin:if test="${resin.professional}">
      <resin:AdminServices/>
    </resin:if>

    <!--
       - Configuration for the health monitoring system
      -->
    <resin:if test="${resin.professional}">
      <resin:import path="${__DIR__}/health.xml" optional="true"/>
    </resin:if>
    ...
  </cluster-default>
</resin>
Example: simple health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthFatal/>
  </health:Restart>
  
</cluster>

health: namespace

health.xml introduces a new XML namespace, health:, defined by xmlns:health="urn:java:com.caucho.health". health: separates health objects from standard resin: elements for clarity and performance. The packages references by health: are:

Health check naming

ee: namespace

The ee: namespace is used for naming objects, for example ee:Named="someName", so that they may be referred to by name later in the configuration. This is sometimes necessary as some health conditions permit referencing a specific health check, as demonstrated in the following example.

Example: referencing named objects
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck ee:Named="pingJspCheck">
    <url>http://localhost:8080/test-ping.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:Restart>
    <health:IfHealthCritical healthCheck="${pingJspCheck}"/>
    <health:IfRechecked/>
  </health:Restart>
  
</cluster>

In this example, an instance of HttpStatusHealthCheck is named 'pingJspCheck' and referred to by name in the IfHealthCritical criteria using an EL expression. The Restart action will only trigger if the health status is CRITICAL for this specific health check and no others.

Default names

All health checks classes are annotated with @Named, and therefore have a default name that corresponds to their bean name. For example <health:CpuHealthCheck/> can be referred to by ${cpuHealthCheck} without the use of ee:Named.

Example: default health check name
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:CpuHealthCheck>
    <warning-threshold>95</warning-threshold>
  </health:CpuHealthCheck>
  
  <health:DumpThreads>
    <health:IfHealthWarning healthCheck="${cpuHealthCheck}"/>
  </health:DumpThreads>  
  
</cluster>

Duplicate names

Duplicate health check names are not permitted. Resin will fail to startup due to invalid configuration in this case. This can be caused by configuring duplicate checks without using ee:Named, or by configuring more than one check with the same name. The following examples demonstrate both illegal cases.

Example: illegal unnamed duplicate checks
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck">
    <url>http://localhost:8080/test1.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:HttpStatusHealthCheck">
    <url>http://localhost:8080/test2.jsp</url>
  </health:HttpStatusHealthCheck>
  
</cluster>

In the preceding example, use of ee:Named is required.

Example: illegal duplicate names
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck" ee:Named="healthCheck">
    <url>http://localhost:8080/test1.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:CpuHealthCheck ee:Named="healthCheck">
    <warning-threshold>95</warning-threshold>
  </health:CpuHealthCheck>
  
</cluster>

In the preceding example, the health check names must be different, regardless of the type of check.

Default health configuration

If for any reason you are missing health.xml, for example you are upgrading from an older version of Resin and don't have the health.xml import in resin.xml, there's no need to worry. Resin creates some checks by default regardless of the presence of health.xml. Furthermore, Resin will detect if no checks are configured and setup default actions and conditions.

Standard health checks

The following health checks are considered critical to standard operation and thus will be created by Resin regardless of the presence of health.xml. If you wish to disabled any of these standard health checks, configure the check in health.xml and set the attribute enabled="false".

Default actions

If any health checks are configured besides the standard checks mentioned above, Resin will assume the user is using health.xml and will not setup any health actions. If however health.xml is missing or empty, the following basic actions will be created.

  <health:Restart>
    <health:IfHealthFatal/>
  </health:Restart>

<health:HealthSystem>

child of <cluster>

Configures overall health checking frequency and recheck rules. This element is present in health.xml for clarity, but is not strictly required since it will be created upon startup with default values.

<health:HealthSystem> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledAll health checking enabled or disabledbooleantrue
startup-delayThe time after startup before actions are triggered (checks still execute).Period15m
periodThe time between checksPeriod5m
recheck-periodThe time between rechecksPeriod30s
recheck-maxThe number of rechecks before returning to the normal checking periodint10
Example: <health:HealthSystem> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:HealthSystem>
    <enabled>true</enabled>
    <startup-delay>15m</startup-delay>
    <period>5m</period>
    <recheck-period>30s</recheck-period>
    <recheck-max>10</recheck-max>
  </health:HealthSystem>

</cluster>

Health checks

Health checks are status monitors which are executed on a periodic basis by the health system to determine an individual health status. Health checks are designed to be simple; repeatedly evaluating the same data. The health system determines an overall Resin health status by aggregating the results of all the configured health checks.

Health status

Every time a health check executes it produces a HealthStatus and a message. The following is a list of all health statuses and their generally implied meaning.

HealthStatus
NAMEORDINAL VALUEDESCRIPTION
UNKNOWN0Health check has not yet executed or failed to execute properly; status is inconclusive.
OK1Health check reported healthy status. This does not imply recovery.
WARNING2Health check reported warning threshold reached or critical is possible.
CRITICAL3Health check reported critical status; action should be taken.
FATAL4Health check reported fatal; restart expected.

The descriptions above should be understood to be entirely dependent on health action and predicate configuration. For example, a FATAL status does not imply a restart will occur unless health:Restart is configured with the health:IfHealthFatal predicate, as it is in the default health.xml.

System checks

System checks are health checks that can only exist once per JVM due to the nature of the data they sample. Most system checks are pre-configured in the default health.xml.

Note: System checks are singletons. Configuring duplicate system checks with different names will not result in the creation of duplicate system checks. The following is technically valid configuration, but results in configuring the same system check twice.

Example: duplicate system checks
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:CpuHealthCheck ee:Named="cpuCheck1">
    <warning-threshold>95</warning-threshold>
  </health:CpuHealthCheck>
  
  <health:CpuHealthCheck ee:Named="cpuCheck2">
    <warning-threshold>99</warning-threshold>
  </health:CpuHealthCheck>

</cluster>

In this example, warning-threshold will be set to 95 and then overrided to 99.

<health:ConnectionPoolHealthCheck>

child of <cluster>

Monitors the health of Resin database connection pools. See <database> for additional information.

<health:ConnectionPoolHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
<health:ConnectionPoolHealthCheck> Conditions
HEALTHSTATUSCONDITION
WARNINGUpon exceeding max-connections.
CRITICALUpon exceeding max-overflow-connections.
Example: <health:ConnectionPoolHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:ConnectionPoolHealthCheck/>

</cluster>

<health:CpuHealthCheck>

child of <cluster>

Monitors CPU usage. On multi-core machines, each CPU is checked individually.

<health:CpuHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
warning-thresholdCPU usage warning thresholdint (percentage 0-100)95
critical-thresholdCPU usage critical thresholdint (percentage 0-100)200 (disabled)
<health:CpuHealthCheck> Conditions
HEALTHSTATUSCONDITION
WARNINGUpon exceeding warning-threshold on any CPU.
CRITICALUpon exceeding critical-threshold on any CPU.
Example: <health:CpuHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:CpuHealthCheck>
    <warning-threshold>95</warning-threshold>
    <critical-threshold>99</critical-threshold>
  </health:CpuHealthCheck>
  
</cluster>

<health:HealthSystemHealthCheck>

child of <cluster>

Monitors the health system itself by using a separate thread to detect if health checking is frozen or taking too long.

<health:HealthSystemHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
thread-check-periodThe polling frequency of the independent thread.Period1m
freeze-timeoutThe max time for no health checks to occur to declare the health system frozenPeriod15m
<health:HealthSystemHealthCheck> Conditions
HEALTHSTATUSCONDITION
FATALIf health checking has not occurred within freeze-timeout.
FATALIf health checking has not completed within an acceptable time, calculated using <health:HealthSystem>startup-delay, period, and recheck-period.
Example: <health:HealthSystemHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HealthSystemHealthCheck>
    <thread-check-period>1m</thread-check-period>
    <freeze-timeout>15m</freeze-timeout>
  </health:HealthSystemHealthCheck>
  
</cluster>

<health:HeartbeatHealthCheck>

child of <cluster>

Monitors for heartbeats from other members of the cluster.

<health:HeartbeatHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
<health:HeartbeatHealthCheck> Conditions
HEALTHSTATUSCONDITION
WARNINGIf no heartbeat has been received from a know member of the cluster.
WARNINGIf a heartbeat has not been received in the last 180 seconds from a known member of the cluster.
Example: <health:HeartbeatHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HeartbeatHealthCheck/>
  
</cluster>

<health:JvmDeadlockHealthCheck>

child of <cluster>

Monitors for deadlocked threads, as determined by the JVM.

<health:JvmDeadlockHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
<health:JvmDeadlockHealthCheck> Conditions
HEALTHSTATUSCONDITION
FATALIf deadlocked threads are detected.
Example: <health:JvmDeadlockHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:JvmDeadlockHealthCheck/>

</cluster>

<health:LicenseHealthCheck>

child of <cluster>

Checks for expiring Resin Pro license.

<health:LicenseHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
warning-periodLicense check warning periodPeriod30D
<health:LicenseHealthCheck> Conditions
HEALTHSTATUSCONDITION
WARNINGIf license expires in less than warning-period.
Example: <health:LicenseHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:LicenseHealthCheck>
    <warning-period>30D</warning-period>
  </health:LicenseHealthCheck>

</cluster>

<health:MemoryPermGenHealthCheck>

child of <cluster>

Monitors the amount of free memory in the JVM PermGen memory pool. Requests a garbage collection if memory falls too low.

Note: This check does not apply to all JVM vendor implementations, and will report UNKNOWN if there is no PermGen pool.

<health:MemoryPermGenHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
memory-free-minThe critical minimum amount of free memory.Bytes1m
free-warningThe warning threshold percentage.double (percentage 0.0 - 100.0)0.01
objectNameExplicitly set the MBean name to query for memory stats. When left unset the health check will search available MBeans for the appropriate memory stats MBean.javax.management.ObjectNameN/A
<health:MemoryPermGenHealthCheck> Conditions
HEALTHSTATUSCONDITION
UNKNOWNIf there is no PermGen pool (JVM vendor dependent) or the appropriate MBean could not be determined.
WARNINGIf free memory is below free-warning percentage after a GC.
CRITICALIf free memory is below memory-free-min after a GC.
Example: <health:MemoryPermGenHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:MemoryPermGenHealthCheck>
    <memory-free-min>1m</memory-free-min>
    <free-warning>0.01</free-warning>
  </health:MemoryPermGenHealthCheck>

</cluster>

<health:MemoryTenuredHealthCheck>

child of <cluster>

Monitors the amount of free memory in the JVM Tenured memory pool. Requests a garbage collection if memory falls too low. This check will monitor heap memory on JVMs where there is no tenured pool.

Note: memory-free-min will default to the value of <server> <memory-free-min> if present in resin.xml.

<health:MemoryTenuredHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
memory-free-minThe critical minimum amount of free memory.Bytes1m
free-warningThe warning threshold percentage.double (percentage 0.0 - 100.0)0.01
objectNameExplicitly set the MBean name to query for memory stats. When left unset the health check will search available MBeans for the appropriate memory stats MBean.javax.management.ObjectNameN/A
<health:MemoryTenuredHealthCheck> Conditions
HEALTHSTATUSCONDITION
UNKNOWNIf there is no PermGen pool (JVM vendor dependent) or the appropriate MBean could not be determined.
WARNINGIf free memory is below free-warning percentage after a GC.
CRITICALIf free memory is below memory-free-min after a GC.
Example: <health:MemoryTenuredHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:MemoryTenuredHealthCheck>
    <memory-free-min>1m</memory-free-min>
    <free-warning>0.01</free-warning>
  </health:MemoryTenuredHealthCheck>

</cluster>

<health:TransactionHealthCheck>

child of <cluster>

Monitors the Resin transaction manager for commit failures.

<health:TransactionHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
<health:TransactionHealthCheck> Conditions
HEALTHSTATUSCONDITION
WARNINGIf there were commit failures since the last check.
Example: <health:TransactionHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:TransactionHealthCheck/>

</cluster>

User checks

User checks are not pre-defined in health.xml; an administrator must configure them in health.xml as appropriate for an application. User checks are not singletons; the same check type can be configured in health.xml more than once provided they have different names.

Example: duplicate user checks
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <!-- Http status check 1 for database with email to database admin -->
  
  <health:HttpStatusHealthCheck ee:Named="databaseCheck">
    <url>http://localhost:8080/databaseCheck.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:SendMail>
    <to>[email protected]</to>
    <health:IfHealthCritical healthCheck="${databaseCheck}"/>
    <health:IfRechecked/>
  </health:SendMail>
  
  <!-- Http status check 2 for application with email to application admin -->

  <health:HttpStatusHealthCheck" ee:Named="appCheck">
    <url>http://localhost:8080/applicationTest.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:SendMail>
    <to>[email protected]</to>
    <health:IfHealthCritical healthCheck="${appCheck}"/>
    <health:IfRechecked/>
  </health:SendMail>

</cluster>

<health:HttpStatusHealthCheck>

child of <cluster>

Monitors one or more URLs on the current Resin instance by making an HTTP GET request and comparing the returned HTTP status code to a pattern.

<health:HttpStatusHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
ping-hostThe server's ping host (for use where url is a URI)StringN/A
ping-portThe server's ping port (for use where url is a URI)int80
urlA URL or URI to be testedStringN/A
socket-timeoutThe socket connection timeoutPeriod10s
regexpThe HTTP status regular expressionjava.util.regex.Pattern200
<health:HttpStatusHealthCheck> Conditions
HEALTHSTATUSCONDITION
CRITICALIf the HTTP GET request failed to connect or the status code does not match the regexp.
Example: <health:HttpStatusHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck>
    <ping-host>localhost</ping-host>
    <ping-port>8080</ping-port>
    <url>/custom-test-1.jsp</url>
    <url>/custom-test-2.jsp</url>
    <socket-timeout>2s</socket-timeout>
    <regexp>^2|^3</regexp>
  </health:HttpStatusHealthCheck>

</cluster>

In some clustered configurations it may be simpler to use the <server-default> <ping-url> element rather than specifying the host and port in the health check itself. <ping-url> will dynamically construct a URL using the current server host. To enabled this, configure HttpStatusHealthCheck with no <url> elements and add <ping-url>to <server> or <server-default>.

Example: <health:HttpStatusHealthCheck> using ping-url
<!-- resin.xml -->
<resin xmlns="http://caucho.com/ns/resin">

  <cluster id="web-tier">
    <server-default>
      <ping-url>/ping-test.jsp<ping-url>
    </server-default>
    ...
  </cluster>
</resin>

<!-- health.xml -->
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck ee:Named="serverHttpPingCheck">
    <socket-timeout>5s</socket-timeout>
    <regexp>200</regexp>
  </health:HttpStatusHealthCheck>

</cluster>

<health:ExprHealthCheck>

child of <cluster>

Evaluates user supplied EL expressions to a boolean.

<health:ExprHealthCheck> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enabledCheck is enabled or disabledbooleantrue
fatal-testEL expression that will trigger FATAL if it evaluates to trueExprN/A
critical-testEL expression that will trigger CRITICAL if it evaluates to trueExprN/A
warning-testEL expression that will trigger WARNING if it evaluates to trueExprN/A
<health:ExprHealthCheck> Conditions
HEALTHSTATUSCONDITION
FATALIf any fatal-test expression evaluates to true
CRITICALIf any critical-test expression evaluates to true
WARNINGIf any warning-test expression evaluates to true
Example: <health:ExprHealthCheck> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ExprHealthCheck>
    <critical-test>${mbean('java.lang:type=Threading').ThreadCount > 100}</critical-test>
  </health:ExprHealthCheck>

</cluster>

Health actions

Health actions perform a task, usually in response to specific conditions, or as remediation for a health check status. Like health checks, health actions are configured in health.xml and executed by the health system on a periodic basis. Health actions are usually accompanied by one or more conditions, or predicates, but this is not required. All actions have the potential to be executed once per period, determined by evaluation of associated conditions. A health action with no conditions will execute once per period.

<health:ActionSequence>

child of <cluster>

Executes a sequence of child health actions in order.

<health:ActionSequence> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:ActionSequence> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ActionSequence>
    <health:DumpThreads/>
    <health:DumpHeap/>
    <health:IfHealthCritical time="5m"/>
  </health:ActionSequence>

</cluster>

<health:CallJmxOperation>

child of <cluster>

Executes a JMX MBean operation with parameters.

Note: Calling a JMX operation can also be performed on-demand using the jmx-call command line.

<health:CallJmxOperation> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
objectNameThe JMX MBean nameStringN/A
operationThe method nameStringN/A
operationIndexUnique method index in case multiple methods match operationint-1
paramMethod parameters that will be converted to the appropriate type.StringN/A
Example: <health:CallJmxOperation> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:CallJmxOperation>
    <objectName>java.lang:type=Threading</objectName>
    <operation>resetPeakThreadCount</operation>
    <health:IfNotRecent time='5m'/>
  </health:CallJmxOperation>

</cluster>

<health:DumpHeap>

child of <cluster>

Create a memory heap dump. The heap dump will be logged to the internal log database and to the resin log file using com.caucho.health.action.DumpHeap as the class at info level.

Note: Creating a heap dump can also be performed on-demand using the heap-dump command line, and from /resin-admin.

<health:DumpHeap> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
hprofCreates an HPROF format dump instead of human readable type.booleanfalse
hprof-pathOutput path write HPROF files, if hprof = trueStringlog/heap.hprof
hprof-path-formatSelects a format for generating dynamic path names using timestamp tokens.String
logIf true, JMX dump is written to the server log in addition to being stored in the internal Resin databasebooleantrue
Example: <health:DumpHeap> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:DumpHeap/>

</cluster>
Example: <health:DumpHeap> in health.xml with hprof-path-format
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:DumpHeap>
    <hprof>true</hprof>
    <hprof-path-format>${resin.home}/log/dump-%H:%M:%S.%s.hprof</hprof-path-format>
    <health:OnAbnormalStop/>
  </health:DumpHeap>

</cluster>

<health:DumpHprofHeap>

child of <cluster>

Shortcut for <health:DumpHeap hprof='true'/>

<health:DumpJmx>

child of <cluster>

Health action to create a dump of all JMX attributes and values. The JMX dump will be logged to the internal log database and to the resin log file using com.caucho.health.action.DumpJmx as the class at info level.

Note: Creating a JMX dump can also be performed on-demand using the jmx-dump command line.

<health:DumpJmx> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
logIf true, JMX dump is written to the server log in addition to being stored in the internal Resin databasebooleanfalse
Example: <health:DumpJmx> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:DumpJmx/>

</cluster>

<health:DumpThreads>

child of <cluster>

Create a thread dump. The thread dump will be logged to the internal log database and log file using com.caucho.health.action.DumpThreads as the class at info level.

Note: Creating a thread dump can also be performed on-demand using the thread-dump command line.

<health:DumpThreads> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
only-activeOutput only currently active threads (RUNNABLE state)booleanfalse
logIf true, JMX dump is written to the server log in addition to being stored in the internal Resin databasebooleantrue
Example: <health:DumpThreads> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:DumpThreads>
    <only-active>false</only-active>
  </health:DumpThreads>

</cluster>

<health:ExecCommand>

child of <cluster>

Execute an operating system shell command.

<health:ExecCommand> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
commandThe command to execute, relative to dir if setStringN/A
dirThe directory to execute fromjava.io.FileN/A
timeoutTimeout on execution of the command, after which it will be killed if not completePeriod2s
envA custom env variable, available to the command.Name/Value PairN/A (System variables are available by default)
Example: <health:ExecCommand> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ExecCommand>
    <dir>/tmp</dir>
    <command>remediation.sh</command>
    <timeout>2s</timeout>
    <env>
      <name>resin_home</name>
      <value>${resin.home}</value>
    </env>
    <env>
      <name>password</name>
      <value>foo</value>
    </env>
  </health:ExecCommand>

</cluster>

<health:FailSafeRestart>

child of <cluster>

A timed restart of Resin, normally used in conjunction with an ActionSequence to gather shutdown information

<health:FailSafeRestart> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
timeoutTime to force a restart if one has not yet occurred.PeriodN/A
Example: <health:FailSafeRestart> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ActionSequence>
    <health:FailSafeRestart timeout="10m"/>
    <health:DumpThreads/>
    <health:DumpHeap/>
    <health:StartProfiler active-time="5m"/>
    <health:Restart/>
    
    <health:IfHealthCritical time="5m"/>
  </health:ActionSequence>

</cluster>

<health:PdfReport>

child of <cluster>

Health action to generate a PDF report from a PHP script.

<health:PdfReport> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
pathPath to a PDF generating .php fileString${resin.home}/doc/admin/pdf-gen.php
reportReport type keyStringSummary
periodReport look back period of timePeriod7D
log-pathPDF output directoryString${resin.logDirectory}
Example: <health:PdfReport> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:PdfReport>
    <path>${resin.home}/doc/admin/pdf-gen.php</path>
    <report>Summary</report>
    <period>7D</report>
    <health:IfCron value="0 0 * * 0"/>
  </health:PdfReport>

</cluster>

<health:Restart>

child of <cluster>

Restart Resin. Resin will exit with the reason HEALTH.

<health:Restart> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:Restart> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:Restart/>

</cluster>

<health:ScoreboardReport>

child of <cluster>

Produces a concise thread activity report for groups of related threads.

Note: A scoreboard report can also be produced using the scoreboard command line.

<health:ScoreboardReport> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
logOutput to server log in addition to pdf reportBooleanfalse
typeScoreboard report typeStringresin
greedyIf false threads can be categoried into more than one groupBooleantrue
Example: <health:ScoreboardReport> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ScoreboardReport>
    <health:OnAbnormalStop/>
  </health:ScoreboardReport>

</cluster>

<health:SendMail>

child of <cluster>

Send an email containing a summary of the current Resin health status.

<health:SendMail> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
toA "TO:" address; a mail recipientStringN/A
fromThe "FROM:" addressStringresin@localhost
mailA <mail> resource to use, see examplejavax.mail.SessionN/A

Without the mail parameter, the default behaviour for sending mail is to contact an SMTP server at host 127.0.0.1 (the localhost) on port 25. System properties can be used to configure a different SMTP server.

resin.xml - smtp server configuration
  <system-property mail.smtp.host="127.0.0.1"/>
  <system-property mail.smtp.port="25"/>
Example: <health:SendMail> in health.xml using system properties
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:SendMail>
    <to>[email protected]</to>
    <to>[email protected]</to>
    <from>[email protected]</from>
  <health:SendMail>

</cluster>

Much more advanced SMTP options can be set by configuring a <mail> resource to use for sending health alerts.

Example: <health:SendMail> in health.xml referencing a <mail> resource
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <mail name="healthMailer">
    <smtp-host>mail.yourdomain.com</smtp-host>
    <smtp-port>25</smtp-port>
    <from>[email protected]</from>
  </mail>
  
  <health:SendMail mail="${healthMailer}">
    <to>[email protected]</to>
  <health:SendMail>

</cluster>

<health:Snapshot>

child of <cluster>

A specific sequence of health actions: thread dump, heap dump, jmx dump, and pdf report. This is intended to generate a permanent representation, or "snapshot" of the system at a point in time that includes all the information necessary to debug server issues. It is usually intended to run in response to a unexpected issue.

<health:Snapshot> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
logOutput to server log in addition to pdf reportBooleanfalse
pathPath to a PDF generating .php fileString${resin.home}/doc/admin/pdf-gen.php
reportReport type keyStringSummary
periodReport look back period of timePeriod7D
Example: <health:Snapshot> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:Snapshot>
    <health:OnAbnormalStop/>
  </health:Snapshot>
  
</cluster>

<health:StartProfiler>

child of <cluster>

Starts a profiler session. Results are logged to the internal database and the Resin log file at INFO level.

Note: Starting the profiler can also be performed on-demand using the profile command line, and from /resin-admin.

<health:StartProfiler> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
active-timeThe amount of time to run the profilerPeriod5s
sampling-rateThe sampling ratePeriod10ms
depthThe stack trace depth (use smaller number (8) for smaller impact, larger for more information.)int16
Example: <health:StartProfiler> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:ActionSequence>
    <health:FailSafeRestart timeout="10m"/>
    <health:DumpThreads/>
    <health:DumpHeap/>
    <health:StartProfiler active-time="5m"/>
    <health:Restart/>
    
    <health:IfHealthCritical time="5m"/>
  </health:ActionSequence>

</cluster>

Health conditions

Health condition, or predicates, qualify an action to execute based on a set of criteria. The action/condition pattern is intentionally similar to Resin's rewrite dispatch/condition pattern, so it should be familiar to some users. Health actions are evaluated every period. Conditions prevent the execution of an action unless all condition evaluate to true. A health action with no conditions will execute once per period. When more than one condition is present for an action, the default combining condion is <health;And>.

Basic conditions

Basic conditions evaluate some general criteria and return true if the condition matches. Basic conditions do not evaluate the status of a health check. Instead they evaluate some general criteria like the time of day.

<health:IfCron>

child of <cluster>

Qualify an action to execute if the current time is in an active range configured by cron-style times. This can be used both to schedule regular actions or to prevent restarts or other actions during critical times.

<health:IfCron> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
enable-atThe cron enable timesCronTypeN/A
disable-at-atThe cron diable timesCronTypeN/A
Example: <health:IfCron> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfCron>
      <enable-at>0 0 * * *</enable-at>
      <disable-at>5 0 * * *</disable-at>
    </health:IfCron>
  </health:Restart> 

</cluster>

<health:IfExpr>

child of <cluster>

Qualifies an action to execute based on the evaluation of an JSP EL expression. Expression can include references to system properties, config properties, and JMX mbean attributes.

<health:IfExpr> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
testthe JSP-EL expression valueExprN/A
Example: <health:IfExpr> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfExpr>
      <test>${mbean('java.lang:type=Threading').ThreadCount > 100}</test>
    </health:IfExpr>
  </health:Restart> 

</cluster>

<health:IfNotRecent>

child of <cluster>

Qualifies an action to match at most an amount of time after the last execution. This is usefull to prevent unecessary frequent execution of an action.

<health:IfNotRecent> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
timeThe time before the action can execute again.PeriodN/A
Example: <health:IfNotRecent> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:HttpStatusHealthCheck ee:Named="httpStatusCheck">
    <url>http://localhost:8080/test-ping.jsp</url>
  </health:HttpStatusHealthCheck>
  
  <health:DumpHeap>
    <health:IfHealthCritical healthCheck="${httpStatusCheck}"/>
    <health:IfNotRecent time='5m'/>
  </health:DumpHeap>

</cluster>

<health:IfRechecked>

child of <cluster>

Qualifies an action to match only after the required number of rechecks have been performed. Since rechecking is not a health check specific condition, this predicate simply matches when recheck cycle count matches the HealthSystem parameter recheck-max.

<health:IfRechecked> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:IfRechecked> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthFatal/>
    <health:IfRechecked/>
  </health:Restart> 

</cluster>

<health:IfUptime>

child of <cluster>

Qualifies an action to match an amount of time after startup.

<health:IfUptime> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
limitThe time after startup (at least)PeriodN/A
Example: <health:IfUptime> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfUptime limit="12h"/>
  </health:Restart> 

</cluster>

Combining conditions

General condition or health check conditions can be combined or negated using these conditions.

<health:And>

child of <cluster>
javadoc <health:And>

Qualifies an action to match if all of the child predicates match.

Note: <health:And> is implied and thus not strictly necessary except when used in conjunction with more complex combining conditions.

<health:And> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:And> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:And>
      <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
      <health:IfHealthCritical health-check="${memoryPermGenHealthCheck}"/>      
    </health:And>
  </health:Restart> 

</cluster>

<health:Nand>

child of <cluster>

Qualifies an action to match if all of the child predicates fail.

<health:Nand> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:Nand> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:Nand>
      <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
      <health:IfHealthCritical health-check="${memoryPermGenHealthCheck}"/>      
    </health:Nand>
  </health:Restart> 

</cluster>

<health:Nor>

child of <cluster>
javadoc <health:Nor>

Qualifies an action to match if none of the child predicates match.

<health:Nor> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:Nor> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:Nor>
      <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
      <health:IfHealthCritical health-check="${memoryPermGenHealthCheck}"/>      
    </health:Nor>
  </health:Restart> 

</cluster>

<health:Not>

child of <cluster>
javadoc <health:Not>

Qualifies an action to match if the child predicate is false.

<health:Not> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:Not> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
    <health:Not>
      <health:IfCron>
        <enable-at>0 7 * * *</enable-at>
        <disable-at>0 11 * * *</disable-at>
      </health:IfCron>
    </health:Not>
  </health:Restart> 

</cluster>

<health:Or>

child of <cluster>
javadoc <health:Or>

Qualifies an action to match if any of the child predicates match.

<health:Or> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:Or> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:Or>
      <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
      <health:IfHealthCritical health-check="${memoryPermGenHealthCheck}"/>      
    </health:Or>
  </health:Restart> 

</cluster>

Health check conditions

All health check conditions evaluate some aspect of the results of a health check. All optionally accept the parameter health-check, which can reference a specific named health check. In absence of this parameter, overall aggregated Resin health will be used.

<health:IfHealthOk>

child of <cluster>

Qualifies an action to match if health status is OK.

<health:IfHealthOk> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
timeThe minimum amount of time since the status startedPeriodN/A
Example: <health:IfHealthOk> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:Not>
      <health:IfHealthOk health-check="${memoryTenuredHealthCheck}"/>
    </health:Not>
  </health:Restart> 

</cluster>

<health:IfHealthWarning>

child of <cluster>

Qualifies an action to match if health status is WARNING.

<health:IfHealthWarning> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
timeThe minimum amount of time since the status startedPeriodN/A
Example: <health:IfHealthWarning> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthWarning health-check="${memoryTenuredHealthCheck}"/>
  </health:Restart> 

</cluster>

<health:IfHealthCritical>

child of <cluster>

Qualifies an action to match if health status is CRITICAL.

<health:IfHealthCritical> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
timeThe minimum amount of time since the status startedPeriodN/A
Example: <health:IfHealthCritical> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthCritical health-check="${memoryTenuredHealthCheck}"/>
  </health:Restart> 

</cluster>

<health:IfHealthFatal>

child of <cluster>

Qualifies an action to match if health status is FATAL.

<health:IfHealthFatal> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
timeThe minimum amount of time since the status startedPeriodN/A
Example: <health:IfHealthFatal> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthFatal health-check="${memoryTenuredHealthCheck}"/>
  </health:Restart> 

</cluster>

<health:IfHealthUnknown>

child of <cluster>

Qualifies an action to match if health status is UNKNOWN.

<health:IfHealthUnknown> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
timeThe minimum amount of time since the status startedPeriodN/A
Example: <health:IfHealthUnknown> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthUnknown health-check="${memoryTenuredHealthCheck}"/>
  </health:Restart> 

</cluster>

<health:IfMessage>

child of <cluster>

Qualifies an action to match the health result message to a regular expression.

<health:IfMessage> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
regexpThe health message match regular expressionjava.util.regex.PatternN/A
Example: <health:IfMessage> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:Restart>
    <health:IfHealthCritical/>
    <health:IfMessage health-check="${httpStatusCheck}" regexp="Not Found"/>
  </health:Restart> 

</cluster>

<health:IfRecovered>

child of <cluster>

Qualifies an action to match upon recovery. Recovery is defined as the state change from FATAL, CRITICAL, or WARNING to OK.

<health:IfRecovered> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
health-checkThe target health checkHealthCheckN/A (Overall Resin health will be used if absent)
Example: <health:IfRecovered> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:SendMail>
    <to>admin@yourdomain</to>
    <health:IfRecovered health-check="${cpuHealthCheck}"/>
  </health:SendMail> 

</cluster>

<health:IfHealthEvent>

child of <cluster>

Causes an action to fire in response to a matching health event. This is usually used in combination with <AnomalyAnalyzer> with a <health-event> attribute.

<health:IfHealthEvent> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
regexpA regular expression the event must match.java.util.regex.Patternrequired
Example: <health:IfHealthEvent> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">
         
  <health:JmxMeter>
    <name>JVM|Thread|JVM Blocked Count</name>
    <objectName>resin:type=JvmThreads</objectName>
    <attribute>BlockedCount</attribute>
  </health:JmxMeter>

  <health:AnomalyAnalyzer>
    <meter>JVM|Thread|JVM Blocked Count</meter>
    <health-event>caucho.thread.anomaly.jvm-blocked</health-event>
  </health:AnomalyAnalyzer>

  <health:DumpThreads>
    <health:IfHealthEvent regexp="caucho.thread"/>
    <health:IfNotRecent time="15m"/>
  </health:DumpThreads>
  
</cluster>

Lifecycle conditions

Lifecycle conditions evaluate the current state of Resin, qualifying actions to execute only during a Resin lifecycle state change.

<health:OnStart>

child of <cluster>

Qualifies an action to match only when Resin is starting.

<health:OnStart> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:OnStart> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:SendMail>
    <to>[email protected]</to>
    <health:OnStart/>
  </health:SendMail> 

</cluster>

<health:OnStop>

child of <cluster>

Qualifies an action to match only when Resin is stopping.

<health:OnStop> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:OnStop> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:SendMail>
    <to>[email protected]</to>
    <health:OnStop/>
  </health:SendMail> 

</cluster>

<health:OnAbnormalStop>

child of <cluster>

Qualifies an action to match only when Resin is stopping with an non-OK exit code.

<health:OnAbnormalStop> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
normal-exit-codeAdd an OK exit code; one that will not trigger this condition.com.caucho.env.shutdown.ExitCode[OK,MODIFIED,WATCHDOG_EXIT]
Example: <health:OnAbnormalStop> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:PdfReport snapshot='true'>
    <health:OnAbnormalStop/>
  </health:PdfReport 

</cluster>

<health:OnRestart>

child of <cluster>

Qualifies an action to match only when Resin is restarted by the watchdog. This generally only occurs during an error condition. OnStart will fire during this event also.

<health:OnRestart> Attributes
ATTRIBUTEDESCRIPTIONTYPEDEFAULT
None
Example: <health:OnRestart> in health.xml
<cluster xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin"
         xmlns:health="urn:java:com.caucho.health"
         xmlns:ee="urn:java:ee">

  <health:SendMail>
    <to>[email protected]</to>
    <health:OnRestart/>
  </health:SendMail> 

</cluster>

Copyright © 1998-2015 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology.