code: @Override
      public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
          List<Metric> metrics = new ArrayList<Metric>();
          Mysql mysql = new Mysql(cl);
          long start = System.currentTimeMillis();
          long elapsed = 0L;
          Connection conn = null;
          try {
              conn = mysql.getConnection();
              elapsed = (System.currentTimeMillis() - start) / 1000L;
          } catch (ClassNotFoundException e) {
              LOG.error(getContext(), "Mysql driver library not found into the classpath: " + "download and put it in the same directory " + "of this plugin");
              throw new MetricGatheringException("Error accessing the MySQL server " + "- JDBC driver not installed", Status.CRITICAL, e);
          } catch (Exception e) {
              LOG.error(getContext(), "Error accessing the MySQL server", e);
              throw new MetricGatheringException("Error accessing the MySQL server - " + e.getMessage(), Status.CRITICAL, e);
          }
  
          if (cl.hasOption("check-slave")) {
              metrics.add(checkSlave(cl, mysql, conn));
          } else {
              metrics.add(new Metric("time", "Connection took " + elapsed + " secs. ", new BigDecimal(elapsed), new BigDecimal(0), null));
          }
          mysql.closeConnection(conn);
          return metrics;
      }
docs: Execute and gather metrics.
  
  @param cl
  - The command line parameters
  @throws MetricGatheringException
  - If any error occurs during metric gathering process
  @return the gathered metrics