# Parameters in the sgagent.conf test section

You can use the parameters described in the following table to configure internal and external tests for Monitoring Agents.

## Parameters in the sgagent.conf test section

The second part of the sgagent.conf file specifies which tests the Monitoring Agents carry out on the servers they monitor. A test begins with the test definition, followed by optional parameter lines, and ends with the command definition. The `test` and `command` parameters are always required. The `interval`, `action`, `host`, `script`, and `recovery` parameters are optional and have their default values if not specified for the test.

Parameter | Description
--- | ---
`test name` | Begins the test definition. Specifies the name of the test. The name appears in the logs and alerts in the event of a failure. It should be descriptive to give the administrators enough information about what has happened. The test name can be any string. You must use quotation marks if the name contains spaces. This parameter is required and has no default value.
`interval time` | Defines how often the test is executed. Time is entered in the format [(hh:)mm:]ss. The minimum interval is 3 seconds and the maximum is 1 day. If no interval is defined, the default is 60 seconds.
`action alert|exclude` | Defines what to do if the test fails. `alert` creates an alert entry and runs the alert script if one is defined for the test. `exclude` sets the server status to Excluded and creates an alert. No new connections are directed to the excluded server and the current connections are moved to the other members of the Server Pool. If no action is set for the test, `alert` is the default action.
`host server` | Defines the server to be tested. If the name of the server is specified in the host field of sgagent.local.conf, that name must be used here. Otherwise, the default host name of the server must be used. You can also list multiple server names, separated by spaces. If no specific server is defined, the test is performed on all Server Pool members by default.
`script [always|repeat] path` | Specifies how many times the script is executed after the test fails, and the path to the script file. You must use quotation marks if the path contains spaces. There are two options for how many times to execute the script after the test fails: repeat defines the number of failures after which the script is no longer run. The counter is reset each time the server status changes, or the test succeeds. `always` runs the script without restrictions on the number of failures. If no argument is given, the script is run only after the first failure by default.
`recovery always|time` | Determines how long the tester reruns a failed test to see if it succeeds on the next attempt. There are two options for specifying the time period: `always` : There are no time limits on how long the tester waits for the test to succeed again. The server state is changed from Excluded to OK when the test succeeds. time : If the test succeeds in the defined time period after a failure, the server state is changed from Excluded to OK. Time is entered in the format [(hh:)mm:]ss. If no recovery options are specified, the test is never rerun after a failure, and the server state remains Excluded.
`command external| test_expression [ retry ] [ timeout ] [ path ] [ parameters ]` | Specifies which test script to use, and the options for running the test. This parameter is required and has no default value. There are two options for specifying the test script: `external` : Indicates that an external test is used. External tests can be created by combining predefined tests with AND, OR, and NOT operators, or you can write your own script. External tests must return an exit code of 0 (zero) to indicate success. Any non-zero return value is interpreted as a failure. test_expression : Specifies the internal test to run. For more information about the internal tests, see Internal tests for Monitoring Agents. The other options are used as follows: retry : Specifies how many times the script is run before the test is considered failed. timeout : Specifies how long (in milliseconds) the tester waits for the test result. path : Specifies the path to the external test script. You must use quotation marks if the path contains spaces. The path is required for external tests, and is not used for internal tests. parameters : Specifies any possible parameters that a specific test might need.