Documentation ¶
Index ¶
- func GetFederationHostsFromConfig(path string) ([]string, error)
- func GetGraph(pn *PrometheusNode) func(w http.ResponseWriter, r *http.Request)
- func GetNextProxyHeader(r *http.Request) ([]string, error)
- func MakePrometheusRequest(r *http.Request) (string, error)
- func MakeRequest(url string, header map[string]string) (string, error)
- func UpdateGraph(pn *PrometheusNode) func(w http.ResponseWriter, r *http.Request)
- type PrometheusNode
- func (pn *PrometheusNode) DeleteNodeByHost(host string) bool
- func (pn *PrometheusNode) InsertOrUpdate(newNode *PrometheusNode, search bool)
- func (pn *PrometheusNode) Ping()
- func (pn *PrometheusNode) PrintNodesTree(prefix string, depth int, withStatus bool) string
- func (pn *PrometheusNode) Search(host string, recursive bool) bool
- func (pn *PrometheusNode) SearchAndUpdateAgentStatus(host string, recursive bool, status bool) bool
- func (pn *PrometheusNode) SearchAndUpdatePrometheusStatus(host string, recursive bool, status bool) bool
- type PrometheusNodeList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFederationHostsFromConfig ¶
GetFederationHostsFromConfig read prometheus config file and return all target for federation, only static_config support
func GetGraph ¶
func GetGraph(pn *PrometheusNode) func(w http.ResponseWriter, r *http.Request)
GetGraph will return a http handler function which encode current node info to json response
func GetNextProxyHeader ¶
GetNextProxyHeader will parse the request header and send request to next agent based header infomation
func MakePrometheusRequest ¶
MakePrometheusRequest send http request
func MakeRequest ¶
MakeRequest make http request with headers
func UpdateGraph ¶
func UpdateGraph(pn *PrometheusNode) func(w http.ResponseWriter, r *http.Request)
UpdateGraph will insert or update a node from post data
Types ¶
type PrometheusNode ¶
type PrometheusNode struct { Children PrometheusNodeList `json:"children"` AgentStatus bool `json:"agent_status"` PrometheusStatus bool `json:"prometheus_status"` PrometheusHost string `json:"prometheus_host"` AgentHost string `json:"agent_host"` }
PrometheusNode will include current node infomations
func NewPrometheusNode ¶
func NewPrometheusNode(prometheusHost string) (*PrometheusNode, error)
NewPrometheusNode create a new node with children nodes
func (*PrometheusNode) DeleteNodeByHost ¶
func (pn *PrometheusNode) DeleteNodeByHost(host string) bool
DeleteNodeByHost will delete from graph by host name
func (*PrometheusNode) InsertOrUpdate ¶
func (pn *PrometheusNode) InsertOrUpdate(newNode *PrometheusNode, search bool)
InsertOrUpdate will insert new node if not exist or update exist if search exist in its tree
func (*PrometheusNode) Ping ¶
func (pn *PrometheusNode) Ping()
Ping will send request to each children and get back the response
func (*PrometheusNode) PrintNodesTree ¶
func (pn *PrometheusNode) PrintNodesTree(prefix string, depth int, withStatus bool) string
PrintNodesTree print out the struct of nodes
func (*PrometheusNode) Search ¶
func (pn *PrometheusNode) Search(host string, recursive bool) bool
Search will find the matched nodes and return true if exist
func (*PrometheusNode) SearchAndUpdateAgentStatus ¶
func (pn *PrometheusNode) SearchAndUpdateAgentStatus(host string, recursive bool, status bool) bool
SearchAndUpdateAgentStatus will find the matched nodes and update agent status
func (*PrometheusNode) SearchAndUpdatePrometheusStatus ¶
func (pn *PrometheusNode) SearchAndUpdatePrometheusStatus(host string, recursive bool, status bool) bool
SearchAndUpdatePrometheusStatus will find the matched nodes and update prometheus status
type PrometheusNodeList ¶
type PrometheusNodeList []*PrometheusNode
PrometheusNodeList list of many prometheus node
func NewPrometheusNodeList ¶
func NewPrometheusNodeList(feds []string) PrometheusNodeList
NewPrometheusNodeList create nodes list for management