예제 #1
0
func (a SaltNodeManager) SetUpMonitoring(node string, master string, ctxt string) (map[string]interface{}, error) {
	// The plugins to be setup includes the editable plugins and also the write plugin
	return a.EnforceMonitoring(
		append(monitoring.SupportedMonitoringPlugins, monitoring.MonitoringWritePlugin),
		[]string{node},
		master,
		monitoring.GetDefaultThresholdValues(),
		ctxt)
}
예제 #2
0
func setupMonitoring(bootstrapNode string) error {
	sessionCopy := db.GetDatastore().Copy()
	defer sessionCopy.Close()
	coll := sessionCopy.DB(conf.SystemConfig.DBConfig.Database).C(models.COLL_NAME_STORAGE_NODES)
	var node models.Node
	if err := coll.Find(bson.M{"hostname": bootstrapNode}).One(&node); err != nil {
		return err
	}
	collCluster := sessionCopy.DB(conf.SystemConfig.DBConfig.Database).C(models.COLL_NAME_STORAGE_CLUSTERS)
	var cluster models.Cluster
	if err := collCluster.Find(bson.M{"clusterid": node.ClusterId}).One(&cluster); err != nil {
		return err
	}

	var monitoringState models.MonitoringState
	monitoringState.Plugins = append(cluster.Monitoring.Plugins, monitoring.GetDefaultThresholdValues()...)
	if err := updatePluginsInDb(bson.M{"name": cluster.Name}, monitoringState); err != nil {
		return err
	}

	ScheduleCluster(cluster.ClusterId, cluster.MonitoringInterval)

	return nil
}