- Go to Customize -> "Manage Changes" tab
- Select the drop down menu in the right top corner
- Click "Add/Edit New Custom SQL Object"
- Click "Add New CSO"
- In "Name" enter
Multisource_1
- In "SQL Query" enter
SHOW SLAVE 'db1' STATUS
- In "Key columns" enter
Seconds_Behind_Master,Slave_SQL_Running
- In "Servers" enter the server list to which this multisource connection applies, or leave empty if it applies to all servers
- Click on "Save" at the bottom
- Go to Monitors -> Replication
- Select the drop down menu in the right top corner
- Click on "Add monitor". A new window will open.
- Click the "View advanced" Right top link in the new window
- In "Type of counter" select "Custom SQL"
- In "Group" box enter
Replication
- In "Name" box enter
Multisource Seconds Behind Master Connection 1
- In "Value" enter the following formula:
/* Sample Custom SQL Counter template */
function() {
var sqlObject = MONyog.UserObject('Multisource_1');
if (!sqlObject || !sqlObject.isEnabled() || !MONyog.MySQL.Custom.Available)
return '(n/a)';
/* You will have to call select here to fetch the resultset. */
var resultSet = sqlObject.select();
var results = ''; /* results holds the resultset in the form of array of row(s). */
/*Get column(s) for each row from the result set */
for (i in resultSet) {
if (resultSet.length > 0)
results += resultSet[i].Seconds_Behind_Master ;
}
if (results.length == 0)
results = 'None';
return results;
}
-
In "Advice Text", enter the following text:
A multi-source replication channel has stopped. Please check SHOW ALL SLAVES STATUS on the affected server and take corrective actions as required.
-
In the "Alert condition" text box, enter the following code:
function()
{
if (this.Value == "(null)" )
return "Critical";
else {
return GetWarnStatusInt(this.Value, this.Critical, this.Warning, true);
}
}
- In the "Warning" box enter
300
- In the "Critical" box enter
600
- In "Notify" select "Yes" radio button
- Scroll down and click "Submit"