@Override protected Point creteInfluxDbPoint(Object metricsObject) { return createInfluxDbPointForHostMetrics(metricsObject); } }
@Override protected Point creteInfluxDbPoint(Object metricsObject) { return createInfluxDbPointForVmMetrics(metricsObject); } }
public static HostStats getHostStatistics(long hostId) { return s_statsCollector.getHostStats(hostId); }
@Override public DataStore getImageStore(List<DataStore> imageStores) { if (imageStores.size() > 1) { Collections.shuffle(imageStores); // Randomize image store list. Iterator<DataStore> i = imageStores.iterator(); DataStore imageStore = null; while(i.hasNext()) { imageStore = i.next(); // Return image store if used percentage is less then threshold value i.e. 90%. if (_statsCollector.imageStoreHasEnoughCapacity(imageStore)) { return imageStore; } } } return imageStores.get(0); } }
StatsCollector sc = StatsCollector.getInstance(); double storageUsedThreshold = CapacityManager.StorageCapacityDisableThreshold.valueIn(pool.getDataCenterId()); if (sc != null) { long totalSize = pool.getCapacityBytes(); StorageStats stats = sc.getStoragePoolStats(pool.getId()); if (stats == null) { stats = sc.getStorageStats(pool.getId());
/** * 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); }
externalStatsPort = retrieveExternalStatsPortFromUri(uri); databaseName = configureDatabaseName(uri);
VmDiskStatisticsVO vmDiskStat_lock = _vmDiskStatsDao.lock(userVm.getAccountId(), userVm.getDataCenterId(), vmId, volume.getId()); if (areAllDiskStatsZero(vmDiskStat)) { s_logger.debug("IO/bytes read and write are all 0. Not updating vm_disk_statistics"); continue; if (isCurrentVmDiskStatsDifferentFromPrevious(previousVmDiskStats, vmDiskStat_lock)) { s_logger.debug("vm disk stats changed from the time GetVmDiskStatsCommand was sent. " + "Ignoring current answer. Host: " + host.getName() + " . VM: " + vmDiskStat.getVmName() + " Read(Bytes): " + vmDiskStat.getBytesRead() + " write(Bytes): " + vmDiskStat.getBytesWrite()
public static StorageStats getStoragePoolStatistics(long id) { return s_statsCollector.getStoragePoolStats(id); }
s_gslbService = gslbService; s_statsCollector = StatsCollector.getInstance(); s_networkACLDao = networkACLDao; s_roleService = roleService;
@Override public DataStore getCacheStore(DataObject data, Scope scope) { if (scope.getScopeType() != ScopeType.ZONE) { s_logger.debug("Can only support zone wide cache storage"); return null; } List<DataStore> cacheStores = dataStoreMgr.getImageCacheStores(scope); if (cacheStores.size() <= 0) { s_logger.debug("Can't find staging storage in zone: " + scope.getScopeId()); return null; } // if there are multiple cache stores, we give priority to the one where data is already there if (cacheStores.size() > 1) { for (DataStore store : cacheStores) { DataObjectInStore obj = objectInStoreMgr.findObject(data, store); if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready && statsCollector.imageStoreHasEnoughCapacity(store)) { s_logger.debug("pick the cache store " + store.getId() + " where data is already there"); return store; } } } return imageStoreMgr.getImageStore(cacheStores); } }
if (!_statsCollector.imageStoreHasEnoughCapacity(imageStore)) { s_logger.info("Image store doesn't have enough capacity. Skip downloading template to this image store " + imageStore.getId()); continue;