/** * Sends metrics to influxdb host. This method supports both VM and Host metrics */ protected void sendMetricsToInfluxdb(Map<Object, Object> metrics) { InfluxDB influxDbConnection = createInfluxDbConnection(); Pong response = influxDbConnection.ping(); if (response.getVersion().equalsIgnoreCase("unknown")) { throw new CloudRuntimeException(String.format("Cannot ping influxdb host %s:%s.", externalStatsHost, externalStatsPort)); } Collection<Object> metricsObjects = metrics.values(); List<Point> points = new ArrayList<>(); s_logger.debug(String.format("Sending stats to %s host %s:%s", externalStatsType, externalStatsHost, externalStatsPort)); for (Object metricsObject : metricsObjects) { Point vmPoint = creteInfluxDbPoint(metricsObject); points.add(vmPoint); } writeBatches(influxDbConnection, databaseName, points); }