Please enter a valid email address. The download links will be emailed to you.
The download links for
MONyog have been sent to
Back to Topics

Custom SQL Objects (CSOs)

The CSO feature is to utilize information available in Information_Schema (as well as Performance_Schema of MySQL 5.5+) that are not exposed in the basic SHOW statements we have been using till now in the monitors/advisors. In addition to the Performance_Schema SELECT queries any query which returns a result set can be monitored.

CSOs not only lets you monitor server metrics but also lets you monitor server data.

A CSC is based on any user-defined SQL query returning a result set. The array returned by MySQL from the SQL query populates a Monyog Object (a ”Custom SQL Object” (CSO) in this case). This is exposed as a javascript array that may be referenced in Monyog counter definitions like any Monyog object.

Enabling pre-defined CSCs and CSOs:

In order to monitor CSOs you would need to create a Custom SQL Counter(CSC). Monyog comes shipped with a bunch of pre-defined CSCs with their respective CSOs. By default all pre-defined CSOs and CSCs are disabled. To enable some of these samples follow these steps-

  1. Click on the drop-down icon beside the title 'Monitors' -> Manage CSO. You will see the 28 pre-defined CSOs display in the left menu. As an example select the ‘DiskInfo’ item. The User Defined SQL-query displays in the ‘SQL’ box. Sample interval and retention timeframe specific for this CSO may be changed as per your preference and you may specify for which MySQL server(s) this particular CSO should be collected. Also note that one or more ‘Key columns’ are defined. This/they must be a column or a set of columns returning (a) unique (set of) value(s) (similar to a UNIQUE KEY in MySQL). Without defining a Key Column, the result monitors might now show proper values.


  2. Go to Monitors page -> Manage Monitor Groups and enable the ‘Disk Info’ Group and save the changes. This pre-defined group contains pre-defined CSC’s using the CSO’s you enabled in the previous step.

  3. Now go to Monitors page, select the ‘Disk Info’ group that now displays at the bottom. You will see 5 new counters in that group that in various ways reference the CSO’s that we just enabled (click the counter name and next ‘Customize’ as usually to see the javascript code). You may customize those further as you would do with any counter in Monyog.