Product Documentation

Configuring Monitors for DataStream

To track the state of each load balanced database server in real time, you need to bind a monitor to each service. The monitor is configured to test the service by sending periodic probes to the service. (This is sometimes referred to as performing a health check.) If the monitor receives a timely response to its probes, it marks the service as UP. If it does not receive a timely response to the designated number of probes, it marks the service as DOWN.

For DataStream, you need to use the built-in monitors, MYSQL-ECV and MSSQL-ECV. This monitor provides the ability to send an SQL request and parse the response for a string.

Before configuring monitors for DataStream, you must add database user credentials to your Citrix ADC appliance. For information about configuring monitors, see Monitors.

When you create a monitor, a TCP connection is established with the database server, and the connection is authenticated by using the user name provided while creating the monitor. You can then run an SQL query to the database server and evaluate the server response to check whether it matches the configured rule.

The following examples are for MYSQL servers.

Examples:

In the following example, the value of the error message is evaluated to determine the state of the server.

add lb monitor lb_mon1 MYSQL-ECV -sqlQuery "select * from
table2;" -evalrule "mysql.res.error.message.contains("Invalid
User")"-database "NS" -userName "user1"

In the following example, the number of rows in the response is evaluated to determine the state of the server.

add lb monitor lb_mon4 MYSQL-ECV -sqlQuery "select * from
table4;" -evalrule "mysql.res.atleast_rows_count(7)" -database "NS" -userName "user2"

In the following example, the value of a particular column is evaluated to determine the state of the server.

``` pre codeblock add lb monitor lb_mon3 MYSQL-ECV -sqlQuery “select * from ABC;” -evalrule “mysql.res.row(1).double_elem(2) == 345.12” -database “NS” -userName “user3”


The following examples are for MSSQL servers.

**Examples**:

In the following example, the value of the error message is evaluated to determine the state of the server.

add lb monitor lb_mon1 MSSQL-ECV -sqlQuery “select * from table2;” -evalrule “mssql.res.error.message.contains(“Invalid User”)”-database “NS” -userName “user1”


In the following example, the number of rows in the response is evaluated to determine the state of the server.

add lb monitor lb_mon4 MSSQL-ECV -sqlQuery “select * from table4;” -evalrule “mssql.res.atleast_rows_count(7)” -database “NS” -userName “user2”


In the following example, the value of a particular column is evaluated to determine the state of the server.

add lb monitor lb_mon3 MSSQL-ECV -sqlQuery “select * from ABC;” -evalrule “mssql.res.row(1).double_elem(2) == 345.12” -database “NS” -userName “user3” ```

Configuring Monitors for DataStream

In this article