Documentation ¶
Index ¶
- func GenAlarmFromTemplate(ns string, data map[string]string, ID string) (model.Resource, error)
- type DashboardInf
- type PanelInf
- type ReportInfo
- type Tree
- func (t *Tree) AddDashboard(ns string, dashboardData model.Dashboard) error
- func (t *Tree) AddPanel(ns string, dIndex int, panel model.Panel) error
- func (t *Tree) AgentReport(info model.Report) error
- func (t *Tree) AllNodes() (n *node.Node, err error)
- func (t *Tree) AppendResource(ns, resType string, appendRes ...model.Resource) error
- func (t *Tree) AppendTarget(ns string, dIndex int, panelIndex int, target model.Target) error
- func (t *Tree) CheckMachineStatusByReport(reports map[string]model.Report) error
- func (t *Tree) CopyResource(fromNs, toNs, resType string, resourceIDs ...string) error
- func (t *Tree) GetDashboard(ns string) (model.DashboardData, error)
- func (t *Tree) GetNodeByNS(ns string) (n *node.Node, err error)
- func (t *Tree) GetReportInfo() map[string]model.Report
- func (t *Tree) GetResource(ns, resourceType string, stringresID ...string) ([]model.Resource, error)
- func (t *Tree) GetResourceList(ns, resourceType string) (*model.ResourceList, error)
- func (t *Tree) LeafChildIDs(ns string) (l []string, err error)
- func (t *Tree) MachineUpdate(oldName string, updateMap map[string]string) error
- func (mj *Tree) MarshalJSON() ([]byte, error)
- func (mj *Tree) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (t *Tree) MoveResource(oldNs, newNs, resType string, resourceIDs ...string) error
- func (t *Tree) NewNode(name, comment, parentNs string, nodeType int, machineRegistRule ...string) (string, error)
- func (t *Tree) RegisterMachine(newMachine model.Resource) (map[string]string, error)
- func (t *Tree) RemoveDashboard(ns string, dIndex int) error
- func (t *Tree) RemoveNode(ns string) error
- func (t *Tree) RemovePanel(ns string, dIndex int, panelIndex int) error
- func (t *Tree) RemoveResource(ns, resourceType string, resID ...string) error
- func (t *Tree) RemoveStatusByHostname(hostname string) error
- func (t *Tree) RemoveTarget(ns string, dIndex int, panelIndex, targetIndex int) error
- func (t *Tree) ReorderPanel(ns string, dIndex int, newOrder []int) error
- func (t *Tree) SearchMachine(hostname string) (map[string]string, error)
- func (t *Tree) SearchResource(ns, resType string, search model.ResourceSearch) (map[string]*model.ResourceList, error)
- func (t *Tree) SetDashboard(ns string, dashboards model.DashboardData) error
- func (t *Tree) SetResource(ns, resType string, l model.ResourceList) error
- func (uj *Tree) UnmarshalJSON(input []byte) error
- func (uj *Tree) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (t *Tree) UpdateDashboard(ns string, dIndex int, title string) error
- func (t *Tree) UpdateNode(ns, name, comment, machineMatchStrategy string) error
- func (t *Tree) UpdatePanel(ns string, dIndex int, panelIndex int, title, graphType string) error
- func (t *Tree) UpdateResource(ns, resType, resID string, updateMap map[string]string) error
- func (t *Tree) UpdateStatusByHostname(hostname string, updateMap map[string]string) error
- func (t *Tree) UpdateTarget(ns string, dIndex int, panelIndex, targetIndex int, target model.Target) error
- type TreeMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DashboardInf ¶
type DashboardInf interface { // GetDashboard return dashboard map of the ns. GetDashboard(ns string) (model.DashboardData, error) // SetDashboard set the dashboard map to the ns. SetDashboard(ns string, dashboardData model.DashboardData) error // AddDashboard add the dashboard to the ns. AddDashboard(ns string, dashboardData model.Dashboard) error // RemoveDashboard update the dashboard of the ns. RemoveDashboard(ns string, dIndex int) error // UpdateDashboard update the title of dashboard. UpdateDashboard(ns string, dIndex int, title string) error PanelInf }
DashboardInf is interface the dashboard resource have.
type PanelInf ¶
type PanelInf interface { // ReorderPanel update the panel order of a dashboard. ReorderPanel(ns string, dIndex int, newOrder []int) error // AddPanel add the panel to the dashboard. AddPanel(ns string, dIndex int, panel model.Panel) error // RemovePanel delete the panel of the dashboard. RemovePanel(ns string, dIndex int, panelIndex int) error // UpdatePanel update the panel of the dashboard. UpdatePanel(ns string, dIndex int, panelIndex int, title, graphType string) error // AppendTarget append a target to panel. AppendTarget(ns string, dIndex int, panelIndex int, target model.Target) error // UpdateTarget update a target. UpdateTarget(ns string, dIndex int, panelIndex, targetIndex int, target model.Target) error // RemoveTarget delete a target. RemoveTarget(ns string, dIndex int, panelIndex, targetIndex int) error }
PanelInf is the panel method. Panel is picture a dashboard have.
type ReportInfo ¶
ReportInfo save the agent report infomation.
type Tree ¶
Tree manage the node/resource/machine.
func (*Tree) AddDashboard ¶
AddDashboard add a dashboard to a ns.
func (*Tree) AgentReport ¶
AgentReport handle and save the agent report message.
func (*Tree) AppendResource ¶
AppendResource append resources to a ns.
func (*Tree) AppendTarget ¶
AppendTarget append a target to panel.
func (*Tree) CheckMachineStatusByReport ¶
CheckMachineStatusByReport check the machine is online or dead by its report, update the machine status.
func (*Tree) CopyResource ¶
CopyResource copy one resource from one ns to the other ns, the resource will still exist in the old ns.
func (*Tree) GetDashboard ¶
func (t *Tree) GetDashboard(ns string) (model.DashboardData, error)
GetDashboard return the dashboard under the ns.
func (*Tree) GetNodeByNS ¶
GetNodeByNS return node by ns.
func (*Tree) GetReportInfo ¶
GetReportInfo return all report information.
func (*Tree) GetResource ¶
func (t *Tree) GetResource(ns, resourceType string, stringresID ...string) ([]model.Resource, error)
GetResource return the one resource of the ns.
func (*Tree) GetResourceList ¶
func (t *Tree) GetResourceList(ns, resourceType string) (*model.ResourceList, error)
GetResourceList return a type resource list of a node.
func (*Tree) LeafChildIDs ¶
LeafChildIDs return leaf node of the ns.
func (*Tree) MachineUpdate ¶
MachineUpdate search the hostname and update the machine resource by updateMap.
func (*Tree) MarshalJSON ¶
func (*Tree) MarshalJSONBuf ¶
func (mj *Tree) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Tree) MoveResource ¶
MoveResource move one resource fo an other ns, the resouce will be removed from the old ns.
func (*Tree) NewNode ¶
func (t *Tree) NewNode(name, comment, parentNs string, nodeType int, machineRegistRule ...string) (string, error)
NewNode create a node, return a pointer which point to node, and it bucketId. Property is preserved. First property argument is used as the machineReg.
func (*Tree) RegisterMachine ¶
RegisterMachine search and register the machine to the node which match the hostname.
func (*Tree) RemoveDashboard ¶
RemoveDashboard one dashboard of ns.
func (*Tree) RemoveNode ¶
RemoveNode remove node from tree, remove bucket which save the resource.
func (*Tree) RemovePanel ¶
RemovePanel remove a panel from a dashboard.
func (*Tree) RemoveResource ¶
RemoveResource remove one resource from a node.
func (*Tree) RemoveStatusByHostname ¶
RemoveStatusByHostname search and remove the machine by hostname.
func (*Tree) RemoveTarget ¶
RemoveTarget remove update a target.
func (*Tree) ReorderPanel ¶
ReorderPanel update the order of panel by newOrder.
func (*Tree) SearchMachine ¶
SearchMachine search the hostname in all node.
func (*Tree) SearchResource ¶
func (t *Tree) SearchResource(ns, resType string, search model.ResourceSearch) (map[string]*model.ResourceList, error)
SearchResource search any preperty resource in the ns and its child ns.
func (*Tree) SetDashboard ¶
func (t *Tree) SetDashboard(ns string, dashboards model.DashboardData) error
SetDashboard set the dashboard to a node.
func (*Tree) SetResource ¶
func (t *Tree) SetResource(ns, resType string, l model.ResourceList) error
SetResource set the resource list to the ns.
func (*Tree) UnmarshalJSON ¶
func (*Tree) UnmarshalJSONFFLexer ¶
func (*Tree) UpdateDashboard ¶
UpdateDashboard update one dashboard title of ns.
func (*Tree) UpdateNode ¶
UpdateNode update the node name or machineMatchStrategy.
func (*Tree) UpdatePanel ¶
UpdatePanel update a panel.
func (*Tree) UpdateResource ¶
UpdateResource update one resource by updateMap.
func (*Tree) UpdateStatusByHostname ¶
UpdateStatusByHostname search the machine and update the status. updateMap is map[string]string{HostStatusProp: status}
type TreeMethod ¶
type TreeMethod interface { DashboardInf // NewNode create node. NewNode(name, comment, parentNs string, nodeType int, property ...string) (string, error) // Update the node property. UpdateNode(ns string, name, comment, machineReg string) error // RemoveNode remove the node with delID from parentNs. RemoveNode(ns string) error // contains filtered or unexported methods }
TreeMethod is the interface tree must implement.