ocf_heartbeat_nginx — Manages an Nginx web/proxy server instance


nginx [ start | stop | status | monitor | meta-data | validate-all ]


This is the resource agent for the Nginx web/proxy server. This resource agent does not monitor POP or IMAP servers, as we don't know how to determine meaningful status for them.

The start operation ends with a loop in which monitor is repeatedly called to make sure that the server started and that it is operational. Hence, if the monitor operation does not succeed within the start operation timeout, the nginx resource will end with an error status.

The default monitor operation will verify that nginx is running.

The level 10 monitor operation by default will try and fetch the /nginx_status page - which is commented out in sample nginx configurations. Make sure that the /nginx_status page works and that the access is restricted to localhost (address plus whatever places _outside the cluster_ you want to monitor the server from. See the status10url and status10regex attributes for more details.

The level 20 monitor operation will perform a more complex set of tests from a configuration file.

The level 30 monitor operation will run an external command to perform an arbitrary monitoring operation.

Supported Parameters


The full pathname of the Nginx configuration file. This file is parsed to provide defaults for various other resource agent parameters. (optional, string, no default)


The full pathname of the httpd binary (optional). (optional, string, default /usr/sbin/httpd)


A port number that we can probe for status information using the statusurl. This will default to the port number found in the configuration file, or 80, if none can be found in the configuration file. (optional, integer, no default)


The URL to monitor (the nginx server status page by default) when given a level 10 monitor operation. If left unspecified, it will be inferred from the nginx configuration file, or defaulted to /nginx_status. If you set this, make sure that it succeeds *only* from the localhost ( and no other cluster nodes. Otherwise, the cluster software may complain about it being active on multiple nodes. (optional, string, no default)


Regular expression to match in the output of status10url. Case insensitive. (optional, string, default Reading: [0-9]+ Writing: [0-9]+ Waiting: [0-9]+)


Client to use to query to Nginx for level 10 and level 20 tests. If not specified, the RA will try to find one on the system. Currently, wget and curl are supported, with curl being preferred. For example, you can set this paramter to "wget" if you prefer that to curl. (optional, string, no default)


URL to test. If it does not start with "http", then it's considered to be relative to the document root address. (optional, string, no default)


Regular expression to match in the output of testurl. Case insensitive. (optional, string, no default)


A file which contains a more complex test configuration. Could be useful if you have to check more than one web application or in case sensitive info should be passed as arguments (passwords). Furthermore, using a config file is the only way to specify certain parameters. Please see README.webapps for examples and file description. (optional, string, no default)


Name of the test within the test configuration file. (optional, string, no default)


Command string to run which implements level 30 monitoring. (optional, string, no default)


Extra options to apply when starting nginx. (optional, string, no default)

Supported Actions

This resource agent supports the following actions (operations):


Starts the resource. Suggested minimum timeout: 40s.


Stops the resource. Suggested minimum timeout: 60s.


Suggested minimum timeout: 40s.


Performs a status check. Suggested minimum timeout: 30s.


Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 10s.


Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 30s.


Performs a detailed status check. Suggested minimum timeout: 45s.


Performs a detailed status check. Suggested minimum timeout: 60s.


Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5.


Performs a validation of the resource configuration. Suggested minimum timeout: 5.


The following is an example configuration for a nginx resource using the crm(8) shell:

primitive example_nginx ocf:heartbeat:nginx \

  op monitor timeout="30s" depth="0" interval="10s" 
  op monitor timeout="30s" depth="10" interval="30s" 
  op monitor timeout="45s" depth="20" 
  op monitor timeout="60s" depth="30" 

See also