Exemplo n.º 1
0
func UpdateObjectCountToSummaries(ctxt string, cluster models.Cluster) {
	objCnt, err := ComputeObjectCount(bson.M{"clusterid": cluster.ClusterId})
	if err != nil {
		logger.Get().Error("%s - Failed to get object count from cluster %v. Error %v", ctxt, cluster.Name)
	} else {
		skyring_utils.UpdateDb(bson.M{"clusterid": cluster.ClusterId}, bson.M{"objectcount": objCnt}, models.COLL_NAME_CLUSTER_SUMMARY, ctxt)
		objCnt, err := ComputeObjectCount(nil)
		if err != nil {
			logger.Get().Error("%s - Failed to update object count for system summary. Error %v", ctxt)
		} else {
			skyring_utils.UpdateDb(bson.M{"name": skyring_monitoring.SYSTEM}, bson.M{"objectcount": objCnt}, models.COLL_NAME_SKYRING_UTILIZATION, ctxt)
		}
	}
}
Exemplo n.º 2
0
func UpdateMonCountToSummaries(ctxt string, cluster models.Cluster) {
	monCnt, monErr := ComputeMonCount(bson.M{"clusterid": cluster.ClusterId})
	if monErr != nil {
		logger.Get().Error("%s - Failed to get mon count for cluster %v.Error %v", ctxt, cluster.Name, monErr)
	} else {
		updateField := fmt.Sprintf("providermonitoringdetails.%s.monitor", cluster.Type)
		skyring_utils.UpdateDb(bson.M{"clusterid": cluster.ClusterId}, bson.M{updateField: monCnt}, models.COLL_NAME_CLUSTER_SUMMARY, ctxt)
		monCnt, monErr := ComputeMonCount(nil)
		if monErr != nil {
			logger.Get().Error("%s - Failed to upadte system mon count.Error %v", ctxt, monErr)
		}
		skyring_utils.UpdateDb(bson.M{"name": skyring_monitoring.SYSTEM}, bson.M{updateField: monCnt}, models.COLL_NAME_SKYRING_UTILIZATION, ctxt)
	}
}
Exemplo n.º 3
0
func UpdatePgNumToSummaries(cluster models.Cluster, ctxt string) {
	cPgNum, err := ComputeClusterPGNum(cluster, ctxt)
	if err != nil {
		logger.Get().Error("%s - Failed to fetch pg summary for cluster %v. Error %v", ctxt, cluster.Name, err)
		return
	} else {
		updateField := fmt.Sprintf("providermonitoringdetails.%s.pgnum", cluster.Type)
		skyring_utils.UpdateDb(bson.M{"clusterid": cluster.ClusterId}, bson.M{updateField: cPgNum}, models.COLL_NAME_CLUSTER_SUMMARY, ctxt)
		sPgNum, err := ComputeSystemPGNum()
		if err != nil {
			logger.Get().Error("%s - Failed to update pg summary to system summary.Error %v", ctxt, err)
		} else {
			skyring_utils.UpdateDb(bson.M{"name": skyring_monitoring.SYSTEM}, bson.M{updateField: sPgNum}, models.COLL_NAME_SKYRING_UTILIZATION, ctxt)
		}
	}
}