示例#1
0
// getDeploymentInfo returns the information about a deployment.
func getDeploymentInfo(depId string, consolidate bool) {
	client, _ := ClientFromConfig()
	stats, err := client.PollDeployment(depId,
		func(stats *api.DeploymentStats) bool {
			return false
		})
	if err != nil {
		log.Debug(err.Error())
		log.Error("Could not get deployment results")
		return
	}
	log.Info("")
	log.Alert(depId)
	log.Info("")
	log.Infof("Total messages: %d", stats.MessageCount)
	log.Infof("Pending messages: %d", stats.PendingCount)
	log.Infof("Total responses: %d", stats.ResponseCount)
	if len(stats.Responses) > 0 {
		log.Alert("\nResponses:")
	}
	stats.Responses.Sort()
	displayResponses(stats.Responses, consolidate)
	log.Info("")
}
示例#2
0
	"conduit/log"
	"github.com/spf13/cobra"
	"postmaster/mailbox"
)

// acessListCmd represents the acessList command
var accessListCmd = &cobra.Command{
	Use:   "list",
	Short: "List all administrative access keys",
	Long: `Display a list of all administrative access keys that have been
generated using 'conduit server access'. The server must be stopped when
running this command.`,
	Run: func(cmd *cobra.Command, args []string) {
		mailbox.OpenDB()
		keys, err := mailbox.AdminKeys()
		if err != nil {
			log.Debug(err.Error())
			log.Fatal("Could not list keys")
		}
		log.Alert("Access keys:")
		for _, k := range keys {
			log.Info(k.Name)
		}
		mailbox.CloseDB()
	},
}

func init() {
	accessCmd.AddCommand(accessListCmd)
}
示例#3
0
文件: info.go 项目: 5Sigma/Conduit
	Short:   "Retrieve system statistics from the server",
	Aliases: []string{"stats"},
	Long: `Gathers system statistics such as connected clients, and pending
message count from the remote server.`,
	Run: func(cmd *cobra.Command, args []string) {
		client, err := ClientFromConfig()
		if err != nil {
			log.Debug(err.Error())
			log.Fatal("Could not configure client")
		}
		stats, err := client.Stats()
		if err != nil {
			log.Debug(err.Error())
			log.Fatal("Could not retrieve statistics")
		}
		log.Alert("\nSystem Statistics\n")
		log.Stats("Host", client.Host)
		log.Stats("Version", stats.Version)
		if cmd.Flag("verbose").Value.String() == "true" {
			log.Stats("Total messages", stats.MessageCount)
		}
		log.Stats("Pending messages", stats.PendingMessages)
		log.Stats("Connected clients",
			fmt.Sprintf("%d / %d", stats.ConnectedClients, stats.TotalMailboxes))
		if cmd.Flag("verbose").Value.String() == "true" {
			log.Stats("Database version", stats.DBVersion)
			log.Stats("CPU's in use", stats.CPUCount)
			log.Stats("Active threads", stats.Threads)
			log.Stats("Memory in use", bytefmt.ByteSize(stats.MemoryAllocated))
			log.Stats("Lookups", fmt.Sprintf("%d", stats.Lookups))
			log.Stats("Next GC at", bytefmt.ByteSize(stats.NextGC))
示例#4
0
文件: deploy.go 项目: 5Sigma/Conduit
					return false
				}
				if stats.PendingCount == 0 {
					return false
				} else {
					return true
				}
			})
		uiprogress.Stop()
		if err != nil {
			log.Debug(err.Error())
			log.Error("Could not get deployment results")
			return
		}
		if len(stats.Responses) > 0 {
			log.Alert("\nResponses:")
		}
		stats.Responses.Sort()
		displayResponses(stats.Responses,
			cmd.Flag("expand").Value.String() != "true")
	},
}

func init() {
	RootCmd.AddCommand(deployCmd)
	deployCmd.Flags().StringP("pattern", "p", "",
		"Wildcard search for mailboxes.")
	deployCmd.Flags().StringP("name", "n", "",
		"A custom name for this deployment.")
	deployCmd.Flags().BoolP("no-results", "x", false,
		"Dont poll for responses.")