Monitoring and Healthcheck

EJBCA contains a health check service that can be used for health monitoring remotely. This should be considered essential if running EJBCA in a clustered installation, as it can be used to determine whether a node is able to remain in the cluster or needs to be taken out. 

Note that it is up to the client and not the server to terminate the connection once the response has been sent, as it's not possible to do so from within the application server. Failing to do so will lead to all available ports in the application server being used up and EJBCA eventually freezing.

Servlet URL

The servlet is located in the URL: http://localhost:8080/ejbca/publicweb/healthcheck/ejbcahealth.

Configuration

Which CAs that are checked by the health check service can be configured in the Admin Web on the CA Activation page as well as in the Edit CA page.

Common Criteria Compliance

To be fully Common Criteria compliant, a different key for signature tests than certificate signing should be used in the CA's HSM token configuration (the "testKey" alias should point to a key with no other uses).
The behavior of the servlet can be modified by configuring the below values in conf/ejbca.properties.

General Configuration

The following configuration parameters may be set to configure authorization and what the service checks:

KeyDefaultDescription
healthcheck.amountfreemem1The amount of memory that must be free on the server, in megabytes.
healthcheck.dbqueryselect 1Parameter indicating the string that should be used to do a minimal check that the database is working.
healthcheck.authorizedips127.0.0.1Specifies which remote IPs that may call this healthcheck servlet. Multiple IPs may be separated by a semicolon.
healthcheck.catokensigntestfalseSet to true to perform a test signature on each CA token during the check. Otherwise just checks that the token status is active.
healthcheck.publisherconnectionsfalseSet to true to perform a health test on all active publisher connections.

Maintenance File Properties

KeyDefaultDescription
healthcheck.maintenancefile
Location of file containing information about maintenance.
healthcheck.maintenancepropertynameDOWN_FOR_MAINTENANCEThe key of the property value in the maintenance, should be in the following format: DOWN_FOR_MAINTENANCE=true.

Servlet Configuration

The following parameters configure what message or HTTP error code the health service returns.

KeyDefaultDescription
healthcheck.okmessageALLOKText string used to say that everything is ok with this node. Any properties defined properties value can be used here by inserting it in as a property, e.g:
ALLOK ${httpsserver.hostname} Version ${app.version.number}
healthcheck.sendservererrortrueSet to true of the HTTP error code 500 should be sent in case of error.
healthcheck.customerrormessagenullAllows for a custom error message to be configured.

Error Messages

If an error is detected one or several of the following error messages is reported. All errors will be sent with a response code of 500

ErrorDescription
MEM: Error Virtual Memory is about to run out, currently free memory : numberThe JVM is about to run out of memory
DB: Error creating connection to databaseJDBC Connection to the database failed, this might occur if DB crashes or network is down.
CA: Error CA Token is disconnected: CANameThis is a sign of hardware problems with one or several of the hard ca tokens in the node.
MAINT: DOWN_FOR_MAINTENANCEThis is reported when the healthcheck.maintenancefile is used and the node is set to be offline.
Error when testing the connection with publisher: PublisherNameThis is reported when a test connection to one of the publishers failed.
Could not perform a test signature on the audit log.Reported when the audit log failed to sign (if database protection is enabled)