Exemplo n.º 1
0
// RegisterRequests makes for the de-facto list of known API calls
func (this *HttpAgentsAPI) RegisterRequests(m *martini.ClassicMartini) {
	m.Get("/api/submit-agent/:host/:port/:token", this.SubmitAgent)
	m.Get("/api/host-attribute/:host/:attrVame/:attrValue", this.SetHostAttribute)
	m.Get("/api/host-attribute/attr/:attr/", this.GetHostAttributeByAttributeName)
	m.Get("/api/agents-hosts", this.AgentsHosts)
	m.Get("/api/agents-instances", this.AgentsInstances)
	m.Get("/api/agent-ping", this.AgentPing)
}
Exemplo n.º 2
0
// RegisterDebug adds handlers for /debug/vars (expvar) and /debug/pprof (net/http/pprof) support
func (this *HttpWeb) RegisterDebug(m *martini.ClassicMartini) {

	m.Get("/debug/vars", func(w http.ResponseWriter, r *http.Request) {
		// from expvar.go, since the expvarHandler isn't exported :(
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		fmt.Fprintf(w, "{\n")
		first := true
		expvar.Do(func(kv expvar.KeyValue) {
			if !first {
				fmt.Fprintf(w, ",\n")
			}
			first = false
			fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
		})
		fmt.Fprintf(w, "\n}\n")
	})

	// list all the /debug/ endpoints we want
	m.Get("/debug/pprof", pprof.Index)
	m.Get("/debug/pprof/cmdline", pprof.Cmdline)
	m.Get("/debug/pprof/profile", pprof.Profile)
	m.Get("/debug/pprof/symbol", pprof.Symbol)
	m.Post("/debug/pprof/symbol", pprof.Symbol)
	m.Get("/debug/pprof/block", pprof.Handler("block").ServeHTTP)
	m.Get("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
	m.Get("/debug/pprof/goroutine", pprof.Handler("goroutine").ServeHTTP)
	m.Get("/debug/pprof/threadcreate", pprof.Handler("threadcreate").ServeHTTP)
}
Exemplo n.º 3
0
// RegisterRequests makes for the de-facto list of known Web calls
func (this *HttpWeb) RegisterRequests(m *martini.ClassicMartini) {
	m.Get("/", this.Clusters)
	m.Get("/web", this.Clusters)
	m.Get("/web/home", this.About)
	m.Get("/web/about", this.About)
	m.Get("/web/keep-calm", this.KeepCalm)
	m.Get("/web/faq", this.FAQ)
	m.Get("/web/status", this.Status)
	m.Get("/web/clusters", this.Clusters)
	m.Get("/web/clusters-analysis", this.ClustersAnalysis)
	m.Get("/web/cluster/:clusterName", this.Cluster)
	m.Get("/web/cluster/alias/:clusterAlias", this.ClusterByAlias)
	m.Get("/web/cluster/instance/:host/:port", this.ClusterByInstance)
	m.Get("/web/cluster-pools/:clusterName", this.ClusterPools)
	m.Get("/web/search/:searchString", this.Search)
	m.Get("/web/search", this.Search)
	m.Get("/web/discover", this.Discover)
	m.Get("/web/long-queries", this.LongQueries)
	m.Get("/web/audit", this.Audit)
	m.Get("/web/audit/:page", this.Audit)
	m.Get("/web/audit/instance/:host/:port", this.Audit)
	m.Get("/web/audit/instance/:host/:port/:page", this.Audit)
	m.Get("/web/audit-recovery", this.AuditRecovery)
	m.Get("/web/audit-recovery/:page", this.AuditRecovery)
	m.Get("/web/audit-recovery/id/:id", this.AuditRecovery)
	m.Get("/web/audit-recovery/cluster/:clusterName", this.AuditRecovery)
	m.Get("/web/audit-recovery/cluster/:clusterName/:page", this.AuditRecovery)
	m.Get("/web/audit-failure-detection", this.AuditFailureDetection)
	m.Get("/web/audit-failure-detection/:page", this.AuditFailureDetection)
	m.Get("/web/audit-failure-detection/id/:id", this.AuditFailureDetection)
	m.Get("/web/agents", this.Agents)
	m.Get("/web/agent/:host", this.Agent)
	m.Get("/web/seed-details/:seedId", this.AgentSeedDetails)
	m.Get("/web/seeds", this.Seeds)

	this.RegisterDebug(m)
}