visor-reporting-kairos/src/main/java/de/uniulm/omi/cloudiator/visor/reporting/kairos/KairosDb.java
protected void sendMetric(MetricBuilder metricBuilder) throws ReportingException {
    try {
      HttpClient client = new HttpClient("http://" + this.server + ":" + this.port);
      Response response = client.pushMetrics(metricBuilder);

      //check if response is ok
      if (response.getStatusCode() / 100 != 2) {
        LOGGER.error("Kairos DB reported error. Status code: " + response.getStatusCode());
        LOGGER.error("Error message: " + response.getErrors());
        throw new ReportingException();
      } else {
        LOGGER.debug("Kairos DB returned OK. Status code: " + response.getStatusCode());
      }
      client.shutdown();
    } catch (MalformedURLException | URISyntaxException e) {
      throw new ConfigurationException(e);
    } catch (IOException e) {
      LOGGER.error("Could not request KairosDB.", e);
      throw new ReportingException(e);
    }
  }
protected void sendMetric(MetricBuilder metricBuilder) throws ReportingException {
    try {
      HttpClient client = new HttpClient("http://" + this.server + ":" + this.port);
      Response response = client.pushMetrics(metricBuilder);

      //check if response is ok
      if (response.getStatusCode() / 100 != 2) {
        LOGGER.error("Kairos DB reported error. Status code: " + response.getStatusCode());
        LOGGER.error("Error message: " + response.getErrors());
        throw new ReportingException();
      } else {
        LOGGER.debug("Kairos DB returned OK. Status code: " + response.getStatusCode());
      }
      client.shutdown();
    } catch (MalformedURLException | URISyntaxException e) {
      throw new ConfigurationException(e);
    } catch (IOException e) {
      LOGGER.error("Could not request KairosDB.", e);
      throw new ReportingException(e);
    }
  }
protected void sendMetric ( MetricBuilder metricBuilder ) throws ReportingException { try { HttpClient client = new HttpClient ( "http://" + this . server + ":" + this . port ) ; Response response = client . pushMetrics ( metricBuilder ) ; //check if response is ok if ( response . getStatusCode ( ) / 100 != 2 ) { LOGGER . error ( "Kairos DB reported error. Status code: " + response . getStatusCode ( ) ) ; LOGGER . error ( "Error message: " + response . getErrors ( ) ) ; throw new ReportingException ( ) ; } else { LOGGER . debug ( "Kairos DB returned OK. Status code: " + response . getStatusCode ( ) ) ; } client . shutdown ( ) ; } catch ( MalformedURLException | URISyntaxException e ) { throw new ConfigurationException ( e ) ; } catch ( IOException e ) { LOGGER . error ( "Could not request KairosDB." , e ) ; throw new ReportingException ( e ) ; } }
Sends a metric to the kairos server.

@param metricBuilder the metricbuilder containing the metrics.
@throws de.uniulm.omi.cloudiator.visor.reporting.ReportingException If the kairos server could
not be reached.
Sends a metric to the kairos server .