code: private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException {
          Metric metric = null;
          try {
              Map<String, Integer> status = getSlaveStatus(conn);
              if (status.isEmpty()) {
                  mysql.closeConnection(conn);
                  throw new MetricGatheringException("CHECK_MYSQL - WARNING: No slaves defined. ", Status.CRITICAL, null);
              }
  
              // check if slave is running
              int slaveIoRunning = status.get("Slave_IO_Running");
              int slaveSqlRunning = status.get("Slave_SQL_Running");
              int secondsBehindMaster = status.get("Seconds_Behind_Master");
  
              if (slaveIoRunning == 0 || slaveSqlRunning == 0) {
                  mysql.closeConnection(conn);
                  throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Slave status unavailable. ", Status.CRITICAL, null);
              }
              String slaveResult = "Slave IO: " + slaveIoRunning + " Slave SQL: " + slaveSqlRunning + " Seconds Behind Master: " + secondsBehindMaster;
  
              metric = new Metric("secondsBehindMaster", slaveResult, new BigDecimal(secondsBehindMaster), null, null);
          } catch (SQLException e) {
              String message = e.getMessage();
              LOG.warn(getContext(), "Error executing the CheckMysql plugin: " + message, e);
              throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Unable to check slave status:  - " + message, Status.CRITICAL, e);
          }
  
          return metric;
  
      }
docs: Check the status of mysql slave thread.
  
  @param cl
  The command line
  @param mysql
  MySQL connection mgr object
  @param conn
  The SQL connection
  @return ReturnValue -
  @throws MetricGatheringException
  -