Documentation ¶
Index ¶
- Constants
- Variables
- func AggrCalcDel(id int64) error
- func AlertUpgradeMarshal(alterUpgrade AlertUpgrade) (string, error)
- func AuthConfigSet(config *AuthConfig) error
- func CancelTask(id int64) error
- func CancelWaitingHosts(id int64) error
- func CleanDoneTask(id int64) error
- func CleanExpireMask(now int64) error
- func ConfigsGet(ckey string) (string, error)
- func ConfigsGets(ckeys []string) (map[string]string, error)
- func ConfigsSet(ckey, cval string) error
- func CreateCollect(collectType, creator string, collect interface{}, dryRun bool) (err error)
- func CryptoPass(raw string) (string, error)
- func DeadTaskSchedulers() ([]string, error)
- func DelById(id int64) error
- func DelDeadTaskScheduler(scheduler string) error
- func DelEventCurOlder(ts int64, batch int) error
- func DelEventOlder(ts int64, batch int) error
- func DeleteCollectById(collectType, creator string, cid int64) error
- func DeleteCollectRule(sid int64) error
- func DoingHostCount(where string, args ...interface{}) (int64, error)
- func EventAlertUpgradeMarshal(alertUpgrade AlertUpgrade) (string, error)
- func EventCnt(hashid uint64, stime, etime int64, isUpgrade bool) (int64, error)
- func EventCurDel(hashid uint64) error
- func EventCurDelById(id interface{}) error
- func EventCurTotal(stime, etime int64, nodePath, query string, priorities, sendTypes []string) (int64, error)
- func EventDelById(id interface{}) error
- func EventTotal(stime, etime int64, nodePath, query, eventType string, ...) (int64, error)
- func GenUUIDForUser(username string) string
- func GetFlagsByStatus(ss []string) []uint16
- func GetRelatedNidsForMon(nid int64, exclNid []int64) ([]int64, error)
- func GetStatus(status string) int
- func GetStatusByFlag(flag uint16) []string
- func GetTeamsNameByIds(ids string) ([]string, error)
- func GetUsernameByToken(token string) (string, error)
- func HostFieldNew(objPtr *HostField) error
- func HostFieldValuePuts(hostId int64, objs []HostFieldValue) error
- func HostIdsByIps(ips []string) (ids []int64, err error)
- func HostRegister(f HostRegisterForm) error
- func HostTotalForAdmin(tenant, query, batch, field string) (int64, error)
- func HostUpdateCate(ids []int64, cate string) error
- func HostUpdateNote(ids []int64, note string) error
- func HostUpdateTenant(ids []int64, tenant string) error
- func IngStatusHostCount(id int64) (int64, error)
- func InitLDAP(conf LDAPSection)
- func InitMySQL(names ...string)
- func InitRooter()
- func InitSalt()
- func InviteNew(token, creator string) error
- func KillTask(id int64) error
- func LeafIdsByNodes(nodes []Node) ([]int64, error)
- func LoginLogNew(username, client, inout string, err error) error
- func LoginLogTotal(username string, btime, etime int64) (int64, error)
- func LongTaskIds() ([]int64, error)
- func MapKeyClear(src map[string]interface{}, save map[string]struct{})
- func MarkDoneStatus(id, clock int64, host, status, stdout, stderr string) error
- func MaskconfDel(id int64) error
- func MibDel(id int64) error
- func MibTotal(query string) (int64, error)
- func NetworkHardwareCount(where string, args ...interface{}) (int64, error)
- func NetworkHardwareDel(id int64) error
- func NetworkHardwareNew(objPtr *NetworkHardware) error
- func NetworkHardwareResourceRegister(hws []*NetworkHardware, tenant string) error
- func NetworkHardwareTotal(query string) (int64, error)
- func NodeAdminExists(session *xorm.Session, nodeId, userId int64) (bool, error)
- func NodeAdminNew(session *xorm.Session, nodeId, userId int64) error
- func NodeCateFieldNew(objPtr *NodeCateField) error
- func NodeCateNew(objPtr *NodeCate) error
- func NodeClearAdmins(session *xorm.Session, nodeId int64) error
- func NodeFieldValuePuts(nodeId int64, objs []NodeFieldValue) error
- func NodeIdsBindingUsername(username string) ([]int64, error)
- func NodeIdsBindingUsernameWithOp(username, op string) ([]int64, error)
- func NodeIdsBindingUsernameWithRoles(username string, roleIds []int64) ([]int64, error)
- func NodeIdsByPaths(paths []string) ([]int64, error)
- func NodeIdsGetByResIds(rids []int64) ([]int64, error)
- func NodeIdsIamAdmin(userId int64) ([]int64, error)
- func NodeNew(objPtr *Node, adminIds []int64) error
- func NodeResourceBind(nid, rid int64) error
- func NodeResourceUnbind(nid, rid int64) error
- func NodeResourceUnbindByRids(rids []int64) error
- func NodeRoleDel(nodeId, roleId int64, username string) error
- func NodeRoleExists(nodeIds, roleIds []int64, username string) (bool, error)
- func NodeTrashRecycle(ids []int64) error
- func NodeTrashTotal(query string) (int64, error)
- func NodesAdminExists(nodeIds []int64, userId int64) (bool, error)
- func NwTotalForAdmin(tenant, query, batch, field string) (int64, error)
- func OperationLogNew(username, rescl string, resid interface{}, detail string) error
- func OperationLogTotal(query string, btime, etime int64) (int64, error)
- func OperationLogTotalByRes(rescl, resid string, btime, etime int64) (int64, error)
- func OperationsOfRoles(rids []int64) ([]string, error)
- func OrphanTaskIds() ([]int64, error)
- func ParseEtime(etime int64) string
- func Paths(longPath string) []string
- func ReportHeartBeat(rev Instance) error
- func ResCountGetByNodeIdsAndCate(nids []int64, cate string) (int, error)
- func ResIdsGetByNodeIds(nids []int64) ([]int64, error)
- func ResourceBindingsForMon(idents []string) ([]string, error)
- func ResourceIdentsByIds(ids []int64) ([]string, error)
- func ResourceIdsByIdents(idents []string) ([]int64, error)
- func ResourceIdsByUUIDs(uuids []string) ([]int64, error)
- func ResourceOrphanTotal(tenant, query, batch, field string) (int64, error)
- func ResourceRegister(hosts []Host, tenant string) error
- func ResourceRegisterFor3rd(item ResourceRegisterItem) (errCode int, err error)
- func ResourceUnderNodeTotal(leafIds []int64, query, batch, field string) (int64, error)
- func ResourceUnregister(uuids []string) error
- func RoleBiggerThan(roleid int64) ([]int64, error)
- func RoleIdsBindingUsername(username string, nids []int64) ([]int64, error)
- func RoleIdsGetByUserId(userId int64) ([]int64, error)
- func RoleIdsHasOp(op string) ([]int64, error)
- func RoleMap(cate string) (map[int64]string, error)
- func RunWaitingHosts(hosts []TaskHost) error
- func SaveEvent(event *Event) error
- func SaveEventCur(eventCur *EventCur) error
- func SaveEventCurStatus(hashid uint64, status string) error
- func SaveEventStatus(id int64, status string) error
- func SaveStraCommit(id int64, action, username, body string, session *xorm.Session) error
- func SessionAll() (int64, error)
- func SessionCleanupByCreatedAt(ts int64) error
- func SessionCleanupByUpdatedAt(ts int64) error
- func SessionDelete(sid string) error
- func SessionTotal(where string, args ...interface{}) (int64, error)
- func SessionUpdate(in *Session) error
- func SessionUserAll(username string) (int64, error)
- func SetDoingCache(v map[string][]TaskHostDoing)
- func StartTask(id int64) error
- func StatusConvert(s []string) []string
- func StraDel(id int64) error
- func StraDelByNid(nid int64) error
- func TakeOverTask(id int64, pre, current string) (bool, error)
- func TaskActionExistsIds(ids []int64) ([]int64, error)
- func TaskMetaTotal(creator, query string, before time.Time) (int64, error)
- func TaskSchedulerHeartbeat(endpoint string) error
- func TaskTplTotal(nodeId int64, query string) (int64, error)
- func TasksOfScheduler(scheduler string) ([]int64, error)
- func TeamAdd(ident, name, note string, mgmt int, creator int64) (int64, error)
- func TeamHasMember(tid, uid int64, isAdmin ...int) (bool, error)
- func TeamIdentByIds(ids []int64) ([]string, error)
- func TeamIdsByUserId(uid int64, isAdmin ...int) ([]int64, error)
- func TeamTotal(query string) (int64, error)
- func TeamTotalInIds(ids []int64, query string) (int64, error)
- func TokenAll() (int64, error)
- func TokenDelete(token string) error
- func UnexpectedHostCount(id int64) (int64, error)
- func UpdateClaimantsById(userId, id int64) error
- func UpdateClaimantsByNodePath(userId int64, nodePath string) error
- func UpdateEventCurPriority(hashid uint64, priority int) error
- func UpdateEventPriority(id int64, priority int) error
- func UpdateIconColor(newColor, cate string) error
- func UserFillUUIDs() error
- func UserHasGlobalRole(userId int64, roleIds []int64) (bool, error)
- func UserIdsByTeamIds(tids []int64, isAdmin ...int) ([]int64, error)
- func UserIdsGetByRoleIds(roleIds []int64) ([]int64, error)
- func UserSearchTotalInIds(ids []int64, query string) (int64, error)
- func UserTotal(ids []int64, where string, args ...interface{}) (int64, error)
- func UsernameByUUID(uuid string) string
- func UsernameCandoGlobalOp(username, operation string) (bool, error)
- func UsernameCandoNodeOp(username, operation string, nodeId int64) (bool, error)
- func WaitingHostCount(id int64) (int64, error)
- func WarningStr(s string) bool
- func WhiteListAccess(addr string) error
- func WhiteListTotal(query string) (int64, error)
- type AggrCalc
- type AggrTagsFilter
- type AlertUpgrade
- type ApiCollect
- type ApiCollectRpcResp
- type Auth
- type AuthConfig
- type AuthState
- type Captcha
- type Chart
- type Collect
- type CollectHist
- type CollectRule
- type CollectRuleRpcResp
- type Configs
- type Event
- type EventAlertUpgrade
- type EventCur
- type EventDetail
- type EventDetailPoint
- type EventSlice
- type Exp
- type Host
- func HostByIds(ids []int64) (hosts []Host, err error)
- func HostGet(where string, args ...interface{}) (*Host, error)
- func HostGets(where string, args ...interface{}) (hosts []Host, err error)
- func HostGetsForAdmin(tenant, query, batch, field string, limit, offset int) ([]Host, error)
- func HostNew(sn, ip, ident, name, cate string, fields map[string]interface{}) (*Host, error)
- func HostSearch(batch, field string) ([]Host, error)
- type HostField
- type HostFieldValue
- type HostRegisterForm
- type Index
- type Instance
- type InstancesResp
- type Invite
- type LDAPSection
- type LogCollect
- type LoginCode
- type LoginLog
- type Lookup
- type Maskconf
- func (mc *Maskconf) AddEndpoints(endpoints []string) error
- func (mc *Maskconf) AddNids(nidPaths map[string]string) error
- func (mc *Maskconf) FillEndpoints() error
- func (mc *Maskconf) FillNids() error
- func (mc *Maskconf) UpdateEndpoints(endpoints []string, cols ...string) error
- func (mc *Maskconf) UpdateNids(nidPaths map[string]string, cols ...string) error
- type MaskconfEndpoints
- type MaskconfNids
- type Metric
- type Mib
- func MibGet(where string, args ...interface{}) (*Mib, error)
- func MibGets(where string, args ...interface{}) ([]Mib, error)
- func MibGetsByQuery(query string, limit, offset int) ([]Mib, error)
- func MibGetsGroupBy(group string, where string, args ...interface{}) ([]Mib, error)
- func NewMib(module string, m *Metric) *Mib
- type Module
- type MySQLConf
- type NetworkHardware
- func GetHardwareInfoBy(ips []string) []*NetworkHardware
- func MakeNetworkHardware(ip, cate, version, auth, region, note string) *NetworkHardware
- func NetworkHardwareGet(where string, args ...interface{}) (*NetworkHardware, error)
- func NetworkHardwareList(query string, limit, offset int) ([]NetworkHardware, error)
- func NwGetsForAdmin(tenant, query, batch, field string, limit, offset int) ([]NetworkHardware, error)
- func NwSearch(batch, field string) ([]NetworkHardware, error)
- type NetworkHardwareRpcResp
- type Node
- func NodeByIds(ids []int64) ([]Node, error)
- func NodeByPaths(paths []string) ([]Node, error)
- func NodeGet(where string, args ...interface{}) (*Node, error)
- func NodeGetById(id int64) (*Node, error)
- func NodeGets(where string, args ...interface{}) (nodes []Node, err error)
- func PermNodes(myNodes []Node) ([]Node, error)
- func TenantsGetByUserId(id int64, withAdmins ...bool) (tenants []Node, err error)
- func TreeUntilProjectsGetByNid(nid int64) ([]Node, error)
- func TreeUntilProjectsGetByUser(user *User) ([]Node, error)
- func TreeUntilTypGetByUser(user *User, typ string) ([]Node, error)
- func UserPermNodes(me *User) ([]Node, error)
- func (n *Node) Bind(resIds []int64) error
- func (n *Node) CreateChild(ident, name, note, cate, creator string, leaf, proxy int, adminIds []int64) (*Node, error)
- func (n *Node) Del() error
- func (n *Node) FillAdmins() error
- func (n *Node) FilterMyChildren(nodes []Node) []Node
- func (n *Node) LeafIds() ([]int64, error)
- func (n *Node) Modify(name, cate, note string, adminIds []int64) error
- func (n *Node) Move(tnode *Node) error
- func (n *Node) RelatedNodes() ([]Node, error)
- func (n *Node) RoleList(username string, limit, offset int) ([]NodeRole, error)
- func (n *Node) RoleTotal(username string) (int64, error)
- func (n *Node) Tenant() string
- func (n *Node) Unbind(resIds []int64) error
- type NodeAdmin
- type NodeCate
- type NodeCateField
- type NodeFieldValue
- type NodeResource
- type NodeRole
- type NodeTrash
- type OperationLog
- type PluginCollect
- type PortCollect
- type ProcCollect
- type Regexp
- type RegexpExtract
- type Resource
- func ResourceGet(where string, args ...interface{}) (*Resource, error)
- func ResourceGets(where string, args ...interface{}) ([]Resource, error)
- func ResourceOrphanList(tenant, query, batch, field string, limit, offset int) ([]Resource, error)
- func ResourceSearch(batch, field string) ([]Resource, error)
- func ResourceUnderNodeGets(leafIds []int64, query, batch, field string, limit, offset int) ([]Resource, error)
- func ResourcesByIdents(idents []string) ([]Resource, error)
- type ResourceBinding
- type ResourceRegisterItem
- type Role
- func (r *Role) BindUsers(userIds []int64) error
- func (r *Role) CheckFields() error
- func (r *Role) Del() error
- func (r *Role) GlobalUserIds() ([]int64, error)
- func (r *Role) Modify(name, note, cate string, ops []string) error
- func (r *Role) Save(ops []string) error
- func (r *Role) UnbindUsers(ids []int64) error
- type RoleGlobalUser
- type RoleOperation
- type Screen
- type ScreenSubclass
- type Secret
- type Session
- func SessionAndTotalGets(query string, limit, offset int) ([]Session, int64, error)
- func SessionGet(sid string) (*Session, error)
- func SessionGetByToken(token string) (*Session, error)
- func SessionGetWithCache(sid string) (*Session, error)
- func SessionGets(limit, offset int, where string, args ...interface{}) ([]Session, error)
- func TokenGetWithCache(accessToken string) (*Session, error)
- type SnmpCollect
- type Stats
- type Stra
- type StraLog
- type Tag
- type TaskAction
- type TaskHost
- type TaskHostDoing
- type TaskMeta
- func (m *TaskMeta) Action() (*TaskAction, error)
- func (m *TaskMeta) CleanFields() error
- func (m *TaskMeta) HandleFH(fh string)
- func (m *TaskMeta) HostStrs() ([]string, error)
- func (m *TaskMeta) Hosts() ([]TaskHost, error)
- func (m *TaskMeta) IgnoreHost(host string) error
- func (m *TaskMeta) KillHost(host string) error
- func (m *TaskMeta) RedoHost(host string) error
- func (m *TaskMeta) Save(hosts []string, action string) error
- func (m *TaskMeta) Stderrs() ([]TaskHost, error)
- func (m *TaskMeta) Stdouts() ([]TaskHost, error)
- type TaskScheduler
- type TaskSchedulerHealth
- type TaskTpl
- func (t *TaskTpl) BindTags(tags []string) error
- func (t *TaskTpl) CleanFields() error
- func (t *TaskTpl) Del() error
- func (t *TaskTpl) Hosts() ([]string, error)
- func (t *TaskTpl) Save(hosts []string) error
- func (t *TaskTpl) UnbindTags(tags []string) error
- func (t *TaskTpl) Update(hosts []string) error
- func (t *TaskTpl) UpdateGroup(nodeId int64) error
- type Team
- func (t *Team) BindUser(ids []int64, isadmin int) error
- func (t *Team) CheckFields() error
- func (t *Team) Del() error
- func (t *Team) Modify(name, note string, mgmt int) error
- func (t *Team) UnbindUser(ids []int64) error
- func (t *Team) Update(cols ...string) error
- func (t *Team) UsersGet(query string, limit, offset int) ([]TeamMember, error)
- func (t *Team) UsersTotal(query string) (int64, error)
- type TeamMember
- type TeamUser
- type TmpChart
- type Token
- type User
- func AllUsers() ([]User, error)
- func EmailCodeLogin(email, code string) (*User, error)
- func LdapLogin(username, pass string) (*User, error)
- func PassLogin(username, pass string) (*User, error)
- func SessionGetUserWithCache(sid string) (*User, error)
- func SmsCodeLogin(phone, code string) (*User, error)
- func TeamMembers(tid int64, isAdmin int) ([]User, error)
- func UserAndTotalGets(query, org string, conditions string, limit, offset int, ids []int64) ([]User, int64, error)
- func UserGet(where string, args ...interface{}) (*User, error)
- func UserGetByIds(ids []int64) ([]User, error)
- func UserGetByNames(names []string) ([]User, error)
- func UserGetByUUIDs(uuids []string) ([]User, error)
- func UserGets(ids []int64, limit, offset int, where string, args ...interface{}) ([]User, error)
- func UserGetsByIds(ids []int64) ([]User, error)
- func UserMustGet(where string, args ...interface{}) (*User, error)
- func UserSearchListInIds(ids []int64, query string, limit, offset int) ([]User, error)
- func UsersGet(where string, args ...interface{}) ([]User, error)
- func UsersGetByGlobalRoleIds(ids []int64) (users []User, err error)
- func (u *User) CanModifyTeam(t *Team) (bool, error)
- func (u *User) CheckPermByNode(node *Node, operation string)
- func (u *User) CheckPermGlobal(operation string)
- func (u *User) CopyLdapAttr(sr *ldap.SearchResult)
- func (u *User) Del() error
- func (u *User) HasPermByNode(node *Node, operation string) (bool, error)
- func (u *User) HasPermGlobal(operation string) (bool, error)
- func (u *User) IsRooter() bool
- func (u *User) NopriResIdents(resIds []int64, op string) ([]string, error)
- func (u *User) PermByNode(node *Node, localOpsList []string) ([]string, error)
- func (u *User) PermResIds(operation string) ([]int64, error)
- func (u *User) Save() error
- func (u *User) Update(cols ...string) error
- func (u *User) Validate() error
- type UserToken
- type WalkParams
- type WhiteList
Constants ¶
const ( FLAG_SEND = iota FLAG_CALLBACK FLAG_MASK FLAG_CONVERGE FLAG_NONEUSER FLAG_UPGRADE )
0 0 0 0 0 0 处理中 0 0 0 0 x 1 已发送 0 0 0 0 1 x 已回调 0 0 0 1 0 0 已屏蔽 0 0 1 0 0 0 被收敛 0 1 0 0 x 0 无接收人 1 0 0 0 x 0 升级发送
const ( STATUS_DOING = "doing" // 处理中 STATUS_SEND = "send" // 已发送 STATUS_NONEUSER = "none-user" // 无接收人 STATUS_CALLBACK = "callback" // 已回调 STATUS_MASK = "mask" // 已屏蔽 STATUS_CONVERGE = "converge" // 频率限制 STATUS_UPGRADE = "upgrade" // 升级报警 )
const ( PWD_INCLUDE_UPPER = 1 << iota PWD_INCLUDE_LOWER PWD_INCLUDE_NUMBER PWD_INCLUDE_SPEC_CHAR )
const ( LOGIN_T_SMS = "sms-code" LOGIN_T_EMAIL = "email-code" LOGIN_T_PWD = "password" LOGIN_T_LDAP = "ldap" LOGIN_T_RST = "rst-code" LOGIN_T_LOGIN = "login-code" LOGIN_EXPIRES_IN = 300 )
const ( USER_S_ACTIVE = iota USER_S_INACTIVE USER_S_LOCKED USER_S_FROZEN USER_S_WRITEN_OFF )
const ( USER_T_NATIVE = iota USER_T_TEMP )
const ALERT = "alert"
const InnerTenantIdent = "inner"
const RECOVERY = "recovery"
Variables ¶
var DB = map[string]*xorm.Engine{}
var DefaultAuthConfig = AuthConfig{ MaxConnIdleTime: 30, PwdMustInclude: []string{}, }
var (
EventTypeMap = map[string]string{RECOVERY: "恢复", ALERT: "报警"}
)
Functions ¶
func AggrCalcDel ¶
func AlertUpgradeMarshal ¶
func AlertUpgradeMarshal(alterUpgrade AlertUpgrade) (string, error)
func AuthConfigSet ¶
func AuthConfigSet(config *AuthConfig) error
func CancelTask ¶
func CancelWaitingHosts ¶
func CleanDoneTask ¶
func CleanExpireMask ¶
func ConfigsGet ¶
func ConfigsSet ¶
func CreateCollect ¶
func DeadTaskSchedulers ¶
func DelDeadTaskScheduler ¶
func DelEventCurOlder ¶
func DelEventOlder ¶
func DeleteCollectById ¶
func DeleteCollectRule ¶
func DoingHostCount ¶
func EventAlertUpgradeMarshal ¶
func EventAlertUpgradeMarshal(alertUpgrade AlertUpgrade) (string, error)
func EventCurDel ¶
func EventCurDelById ¶
func EventCurDelById(id interface{}) error
func EventCurTotal ¶
func EventDelById ¶
func EventDelById(id interface{}) error
func EventTotal ¶
func GenUUIDForUser ¶
func GetFlagsByStatus ¶
func GetStatusByFlag ¶
func GetTeamsNameByIds ¶
func GetUsernameByToken ¶
GetUsernameByToken 使用方:rbac-proxy
func HostFieldNew ¶
func HostFieldValuePuts ¶
func HostFieldValuePuts(hostId int64, objs []HostFieldValue) error
func HostIdsByIps ¶
func HostRegister ¶
func HostRegister(f HostRegisterForm) error
func HostTotalForAdmin ¶
func HostUpdateCate ¶
func HostUpdateNote ¶
func HostUpdateTenant ¶
func IngStatusHostCount ¶
func InitLDAP ¶
func InitLDAP(conf LDAPSection)
func InitRooter ¶
func InitRooter()
func LoginLogNew ¶
func MapKeyClear ¶
mapKeyClear map key clear
func MarkDoneStatus ¶
func MaskconfDel ¶
func NetworkHardwareCount ¶
func NetworkHardwareDel ¶
func NetworkHardwareNew ¶
func NetworkHardwareNew(objPtr *NetworkHardware) error
func NetworkHardwareResourceRegister ¶
func NetworkHardwareResourceRegister(hws []*NetworkHardware, tenant string) error
ResourceRegister 资源分配给某个租户的时候调用
func NetworkHardwareTotal ¶
func NodeAdminExists ¶
func NodeCateFieldNew ¶
func NodeCateFieldNew(objPtr *NodeCateField) error
func NodeCateNew ¶
func NodeFieldValuePuts ¶
func NodeFieldValuePuts(nodeId int64, objs []NodeFieldValue) error
func NodeIdsBindingUsername ¶
NodeIdsBindingUsername 某人在哪些节点配置过权限
func NodeIdsBindingUsernameWithOp ¶
NodeIdsBindingUsernameWithOp 我在哪些节点上有这个操作权限
func NodeIdsBindingUsernameWithRoles ¶
NodeIdsBindingUsernameWithRoles 我以某些角色的名义绑定在哪些节点
func NodeIdsByPaths ¶
func NodeIdsGetByResIds ¶
func NodeIdsIamAdmin ¶
NodeIdsIamAdmin 我是管理员的节点ID列表
func NodeResourceBind ¶
func NodeResourceUnbind ¶
func NodeRoleDel ¶
func NodeTrashRecycle ¶
从node_trash表回收部分node,前端一个一个操作,也可以同一层级同时操作 之前的父节点可能已经挪动过,所以回收的时候要注意重新更新path信息
func NodeTrashTotal ¶
func NwTotalForAdmin ¶
func OperationLogNew ¶
func OperationLogTotalByRes ¶
func OperationsOfRoles ¶
func OrphanTaskIds ¶
func ParseEtime ¶
func Paths ¶
Paths 把长路径切成多个path,比如: cop.sre.falcon.judge.hna被切成: cop、cop.sre、cop.sre.falcon、cop.sre.falcon.judge、cop.sre.falcon.judge.hna
func ReportHeartBeat ¶
func ResCountGetByNodeIdsAndCate ¶
ResCountGetByNodeIdsAndWhere 根据叶子节点和Where条件获取资源数量表
func ResIdsGetByNodeIds ¶
ResIdsGetByNodeIds 根据叶子节点获取资源ID列表
func ResourceBindingsForMon ¶
ResourceBindingsForMon 告警消息里要看到资源挂载的节点信息
func ResourceIdentsByIds ¶
func ResourceIdsByIdents ¶
func ResourceIdsByUUIDs ¶
func ResourceOrphanTotal ¶
func ResourceRegister ¶
ResourceRegister 资源分配给某个租户的时候调用
func ResourceRegisterFor3rd ¶
func ResourceRegisterFor3rd(item ResourceRegisterItem) (errCode int, err error)
ResourceRegisterFor3rd 用于第三方资源注册 errCode=400: 表示传入的参数有问题 errCode=500: 表示DB出了问题 之所以要通过errCode对错误做区分,是因为这个方法同时被同步和异步两种方式调用,上层需要依托这个信息做判断
func ResourceUnderNodeTotal ¶
func ResourceUnregister ¶
func RoleBiggerThan ¶
func RoleIdsBindingUsername ¶
func RoleIdsGetByUserId ¶
func RunWaitingHosts ¶
func SaveEventCur ¶
func SaveEventCurStatus ¶
func SaveEventStatus ¶
func SaveStraCommit ¶
func SessionAll ¶
func SessionDelete ¶
func SessionTotal ¶
func SessionUpdate ¶
func SessionUserAll ¶
func SetDoingCache ¶
func SetDoingCache(v map[string][]TaskHostDoing)
func StatusConvert ¶
func StraDelByNid ¶
func TaskActionExistsIds ¶
func TaskSchedulerHeartbeat ¶
func TasksOfScheduler ¶
func TeamIdentByIds ¶
func TokenDelete ¶
func UnexpectedHostCount ¶
func UpdateClaimantsById ¶
func UpdateEventCurPriority ¶
func UpdateEventPriority ¶
func UpdateIconColor ¶
func UserFillUUIDs ¶
func UserFillUUIDs() error
func UserHasGlobalRole ¶
UserHasGlobalRole 查看某个用户是否有某个全局角色
func UserIdsGetByRoleIds ¶
func UsernameCandoGlobalOp ¶
UsernameCandoGlobalOp 使用方:RDB、rbac-proxy
func UsernameCandoNodeOp ¶
func WaitingHostCount ¶
func WarningStr ¶
func WhiteListAccess ¶
func WhiteListTotal ¶
Types ¶
type AggrCalc ¶
type AggrCalc struct { Id int64 `xorm:"id pk autoincr" json:"id"` Nid int64 `xorm:"nid" json:"nid"` Category int `xorm:"category" json:"category"` NewMetric string `xorm:"new_metric" json:"new_metric"` NewStep int `xorm:"new_step" json:"new_step"` GroupByString string `xorm:"groupby" json:"-"` RawMetricsString string `xorm:"raw_metrics" json:"-"` GlobalOperator string `xorm:"global_operator"json:"global_operator"` //指标聚合方式 Expression string `xorm:"expression" json:"expression"` RPN string `xorm:"rpn" json:"rpn"` //用途? Status int `xorm:"status" json:"-"` //审核状态 Quota int `xorm:"quota" json:"quota"` //用途? Comment string `xorm:"comment" json:"comment"` Creator string `xorm:"creator" json:"creator"` Created time.Time `xorm:"created" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"<-" json:"last_updated"` RawMetrics []*dataobj.RawMetric `xorm:"-" json:"raw_metrics"` GroupBy []string `xorm:"-" json:"groupby"` VarNum int `xorm:"-" json:"var_num"` }
func AggrCalcGet ¶
type AggrTagsFilter ¶
type AlertUpgrade ¶
type AlertUpgrade struct { Users []int64 `json:"users"` Groups []int64 `json:"groups"` Duration int `json:"duration"` Level int `json:"level"` }
func AlertUpgradeUnMarshal ¶
func AlertUpgradeUnMarshal(str string) (AlertUpgrade, error)
type ApiCollect ¶
type ApiCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` Name string `json:"name"` Domain string `json:"domain"` Path string `json:"path"` HeaderStr string `xorm:"header" json:"-"` Step int `json:"step"` Timeout int `json:"timeout"` Protocol string `json:"protocol"` PortStr string `xorm:"port" json:"-"` Method string `json:"method"` MaxRedirect int `json:"max_redirect"` PostBody string `json:"post_body"` ExpectedCodeStr string `xorm:"expected_code" json:"-"` ExpectedString string `json:"expected_string"` UnexpectedString string `json:"unexpected_string"` Region string `json:"region"` Comment string `json:"comment"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` Header map[string]string `xorm:"-" json:"header"` ExpectedCode []string `xorm:"-" json:"expected_code"` Port int `xorm:"-" json:"port"` }
func GetApiCollects ¶
func GetApiCollects() ([]*ApiCollect, error)
func (*ApiCollect) Decode ¶
func (a *ApiCollect) Decode() error
func (*ApiCollect) Encode ¶
func (a *ApiCollect) Encode() error
func (*ApiCollect) Update ¶
func (a *ApiCollect) Update() error
type ApiCollectRpcResp ¶
type ApiCollectRpcResp struct { Data []*ApiCollect Msg string }
type Auth ¶
type Auth struct { Community Secret `json:"community,omitempty"` SecurityLevel string `json:"security_level,omitempty"` Username string `json:"username,omitempty"` Password Secret `json:"password,omitempty"` AuthProtocol string `json:"auth_protocol,omitempty"` PrivProtocol string `json:"priv_protocol,omitempty"` PrivPassword Secret `json:"priv_password,omitempty"` ContextName string `json:"context_name,omitempty"` }
type AuthConfig ¶
type AuthConfig struct { MaxNumErr int `json:"maxNumErr"` MaxSessionNumber int64 `json:"maxSessionNumber"` MaxConnIdleTime int64 `json:"maxConnIdleTime" description:"minute"` LockTime int64 `json:"lockTime" description:"minute"` PwdHistorySize int `json:"pwdHistorySize"` PwdMinLenght int `json:"pwdMinLenght"` PwdExpiresIn int64 `json:"pwdExpiresIn" description:"month"` PwdMustInclude []string `json:"pwdMustInclude" description:"upper,lower,number,specChar"` PwdMustIncludeFlag int `json:"pwdMustIncludeFlag"` }
func AuthConfigGet ¶
func AuthConfigGet() (*AuthConfig, error)
func (AuthConfig) MustInclude ¶
func (p AuthConfig) MustInclude() string
func (AuthConfig) PwdRules ¶
func (p AuthConfig) PwdRules() []string
func (*AuthConfig) Validate ¶
func (p *AuthConfig) Validate() error
type AuthState ¶
type AuthState struct { State string `json:"state"` Typ string `json:"typ"` Redirect string `json:"redirect"` ExpiresAt int64 `json:"expiresAt"` }
func AuthStateGet ¶
type Captcha ¶
type Captcha struct { CaptchaId string `json:"captchaId"` Answer string `json:"-"` Image string `xorm:"-" json:"image"` CreatedAt int64 `json:"createdAt"` }
func CaptchaGet ¶
type Chart ¶
type Collect ¶
type Collect struct { sync.RWMutex Ports map[int]*PortCollect `json:"ports"` Procs map[string]*ProcCollect `json:"procs"` Logs map[string]*LogCollect `json:"logs"` Plugins map[string]*PluginCollect `json:"plugins"` }
func NewCollect ¶
func NewCollect() *Collect
func (*Collect) GetLogConfig ¶
func (c *Collect) GetLogConfig() map[string]*LogCollect
func (*Collect) GetPlugin ¶
func (c *Collect) GetPlugin() map[string]*PluginCollect
func (*Collect) GetPorts ¶
func (c *Collect) GetPorts() map[int]*PortCollect
func (*Collect) GetProcs ¶
func (c *Collect) GetProcs() map[string]*ProcCollect
type CollectHist ¶
type CollectRule ¶
type CollectRule struct { Id int64 `json:"id"` Nid int64 `json:"nid"` Step int64 `json:"step" description:"interval"` Timeout int `json:"timeout"` CollectType string `json:"collect_type" description:"plugin name"` Name string `json:"name" describes:"customize name"` Region string `json:"region"` Comment string `json:"comment"` DryRun bool `json:"dryrun" xorm:"-"` Data json.RawMessage `json:"data"` Tags string `json:"tags" description:"k1=v1,k2=v2,k3=v3,..."` Creator string `json:"creator" description:"just for output"` Updater string `json:"updater" description:"just for output"` CreatedAt int64 `json:"created_at" description:"just for output"` UpdatedAt int64 `json:"updated_at" description:"just for output"` }
func DumpCollectRules ¶
func DumpCollectRules() ([]*CollectRule, error)
func GetCollectRules ¶
func (CollectRule) PluginName ¶
func (p CollectRule) PluginName() string
func (*CollectRule) String ¶
func (p *CollectRule) String() string
func (*CollectRule) Update ¶
func (p *CollectRule) Update() (err error)
func (*CollectRule) Validate ¶
func (p *CollectRule) Validate(v ...interface{}) error
type CollectRuleRpcResp ¶
type CollectRuleRpcResp struct { Data []*CollectRule Msg string }
type Event ¶
type Event struct { Id int64 `json:"id"` Sid int64 `json:"sid"` Sname string `json:"sname"` Nid int64 `json:"nid"` NodePath string `json:"node_path"` CurNodePath string `json:"cur_node_path"` Endpoint string `json:"endpoint"` Priority int `json:"priority"` EventType string `json:"event_type"` // alert|recovery Category int `json:"category"` Status uint16 `json:"status"` HashId uint64 `json:"hashid" xorm:"hashid"` Etime int64 `json:"etime"` Value string `json:"value"` Info string `json:"info"` Created time.Time `json:"created" xorm:"created"` Detail string `json:"detail"` Users string `json:"users"` Groups string `json:"groups"` Runbook string `json:"runbook"` NeedUpgrade int `json:"need_upgrade"` AlertUpgrade string `json:"alert_upgrade"` RecvUserIDs []int64 `json:"recv_user_ids" xorm:"-"` RealUpgrade bool `json:"real_upgrade" xorm:"-"` WorkGroups []int `json:"work_groups" xorm:"-"` CurNid string `json:"cur_nid"` }
func (*Event) GetEventDetail ¶
func (e *Event) GetEventDetail() ([]EventDetail, error)
type EventAlertUpgrade ¶
type EventAlertUpgrade struct { Users string `json:"users"` Groups string `json:"groups"` Duration int `json:"duration"` Level int `json:"level"` }
func EventAlertUpgradeUnMarshal ¶
func EventAlertUpgradeUnMarshal(str string) (EventAlertUpgrade, error)
type EventCur ¶
type EventCur struct { Id int64 `json:"id"` Sid int64 `json:"sid"` Sname string `json:"sname"` NodePath string `json:"node_path"` CurNodePath string `json:"cur_node_path"` Endpoint string `json:"endpoint"` Priority int `json:"priority"` EventType string `json:"event_type"` // alert|recovery Category int `json:"category"` Status uint16 `json:"status"` HashId uint64 `json:"hashid" xorm:"hashid"` Etime int64 `json:"etime"` Value string `json:"value"` Info string `json:"info"` Created time.Time `json:"created" xorm:"created"` Detail string `json:"detail"` Users string `json:"users"` Groups string `json:"groups"` Runbook string `json:"runbook"` Nid int64 `json:"nid"` IgnoreAlert int `json:"ignore_alert"` Claimants string `json:"claimants"` NeedUpgrade int `json:"need_upgrade"` AlertUpgrade string `json:"alert_upgrade"` CurNid string `json:"cur_nid"` WorkGroups []int `json:"work_groups" xorm:"-"` }
func AllEventCurGet ¶ added in v4.0.4
func EventCurGet ¶
func EventCurGets ¶
func (*EventCur) EventIgnore ¶
type EventDetail ¶
type EventDetail struct { Metric string `json:"metric"` Tags map[string]string `json:"tags"` Points []*EventDetailPoint `json:"points"` PredPoints []*EventDetailPoint `json:"pred_points,omitempty"` // 预测值, 预测值不为空时, 现场值对应的是实际值 }
type EventDetailPoint ¶
type EventSlice ¶
type EventSlice []*Event
func (EventSlice) Len ¶
func (e EventSlice) Len() int
func (EventSlice) Less ¶
func (e EventSlice) Less(i, j int) bool
func (EventSlice) Swap ¶
func (e EventSlice) Swap(i, j int)
type Host ¶
type Host struct { Id int64 `json:"id"` SN string `json:"sn" xorm:"'sn'"` IP string `json:"ip" xorm:"'ip'"` Ident string `json:"ident"` Name string `json:"name"` Note string `json:"note"` CPU string `json:"cpu" xorm:"'cpu'"` Mem string `json:"mem"` Disk string `json:"disk"` Cate string `json:"cate"` Clock int64 `json:"clock"` Tenant string `json:"tenant"` }
func HostGetsForAdmin ¶
func HostSearch ¶
type HostField ¶
type HostField struct { Id int64 `json:"id"` FieldIdent string `json:"field_ident"` FieldName string `json:"field_name"` FieldType string `json:"field_type"` FieldRequired int `json:"field_required"` FieldExtra string `json:"field_extra"` FieldCate string `json:"field_cate"` }
func HostFieldGet ¶
type HostFieldValue ¶
type HostFieldValue struct { Id int64 `json:"id"` HostId int64 `json:"host_id"` FieldIdent string `json:"field_ident"` FieldValue string `json:"field_value"` }
func HostFieldValueGets ¶
func HostFieldValueGets(hostId int64) ([]HostFieldValue, error)
HostFieldValueGets 条数非常少,全部返回
func (*HostFieldValue) Validate ¶
func (hfv *HostFieldValue) Validate() error
type HostRegisterForm ¶
type HostRegisterForm struct { SN string `json:"sn"` IP string `json:"ip"` Ident string `json:"ident"` Name string `json:"name"` Cate string `json:"cate"` UniqKey string `json:"uniqkey"` Fields map[string]interface{} `json:"fields"` Digest string `json:"digest"` }
func (HostRegisterForm) Validate ¶
func (f HostRegisterForm) Validate() error
type Instance ¶
type Instance struct { Id int64 `json:"id"` Module string `json:"module"` Identity string `json:"identity"` //ip 或者 机器名 RPCPort string `json:"rpc_port" xorm:"rpc_port"` HTTPPort string `json:"http_port" xorm:"http_port"` TS int64 `json:"ts" xorm:"ts"` Remark string `json:"remark"` Region string `json:"region"` Active bool `xorm:"-" json:"active"` }
func GetInstanceBy ¶
type Invite ¶
func InviteMustGet ¶
type LDAPSection ¶
type LDAPSection struct { DefaultUse bool `yaml:"defaultUse"` Host string `yaml:"host"` Port int `yaml:"port"` BaseDn string `yaml:"baseDn"` BindUser string `yaml:"bindUser"` BindPass string `yaml:"bindPass"` AuthFilter string `yaml:"authFilter"` Attributes ldapAttributes `yaml:"attributes"` CoverAttributes bool `yaml:"coverAttributes"` TLS bool `yaml:"tls"` StartTLS bool `yaml:"startTLS"` }
var LDAPConfig LDAPSection
type LogCollect ¶
type LogCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` Name string `json:"name"` TagsStr string `xorm:"tags" json:"-"` Step int `json:"step"` Comment string `json:"comment"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` Tags map[string]string `xorm:"-" json:"tags"` FilePath string `json:"file_path"` TimeFormat string `json:"time_format"` Pattern string `json:"pattern"` Func string `json:"func"` FuncType string `json:"func_type"` Unit string `json:"unit"` Degree int `json:"degree"` Zerofill int `xorm:"zero_fill" json:"zerofill"` Aggregate string `json:"aggregate"` LocalUpdated int64 `xorm:"-" json:"-"` TimeReg *regexp.Regexp `xorm:"-" json:"-"` PatternReg *regexp.Regexp `xorm:"-" json:"-"` ExcludeReg *regexp.Regexp `xorm:"-" json:"-"` TagRegs map[string]*regexp.Regexp `xorm:"-" json:"-"` ParseSucc bool `xorm:"-" json:"-"` WhetherAttachOneLogLine int `json:"whether_attach_one_log_line" xorm:"'whether_attach_one_log_line'"` }
func GetLogCollects ¶
func GetLogCollects() ([]*LogCollect, error)
func (*LogCollect) Decode ¶
func (l *LogCollect) Decode() error
func (*LogCollect) Encode ¶
func (l *LogCollect) Encode() error
func (*LogCollect) Update ¶
func (p *LogCollect) Update() error
type LoginCode ¶
type LoginCode struct { Username string `json:"username"` Code string `json:"code"` LoginType string `json:"login_type"` CreatedAt int64 `json:"created_at"` }
func LoginCodeGet ¶
type LoginLog ¶
type Maskconf ¶
type Maskconf struct { Id int64 `json:"id"` Category int `json:"category"` Nid int64 `json:"nid"` NodePath string `json:"node_path" xorm:"-"` Metric string `json:"metric"` Tags string `json:"tags"` Cause string `json:"cause"` User string `json:"user"` Btime int64 `json:"btime"` Etime int64 `json:"etime"` Endpoints []string `json:"endpoints" xorm:"-"` Nids []string `json:"nids" xorm:"-"` CurNidPaths map[string]string `json:"cur_nid_paths" xorm:"-"` }
func MaskconfGet ¶
func MaskconfGetAll ¶
func MaskconfGets ¶
func (*Maskconf) AddEndpoints ¶
func (*Maskconf) FillEndpoints ¶
func (*Maskconf) UpdateEndpoints ¶
type MaskconfEndpoints ¶
type MaskconfNids ¶
type Metric ¶
type Metric struct { Name string `yaml:"name"` Oid string `yaml:"oid"` Type string `yaml:"type"` Help string `yaml:"help"` Indexes []*Index `yaml:"indexes,omitempty"` Lookups []*Lookup `yaml:"lookups,omitempty"` RegexpExtracts map[string][]RegexpExtract `yaml:"regex_extracts,omitempty"` EnumValues map[int]string `yaml:"enum_values,omitempty"` }
type Mib ¶
type Mib struct { Id int64 `json:"id"` Module string `json:"module"` Metric string `json:"metric"` Oid string `json:"oid"` Mtype string `json:"mtype"` //gauge,counter EnumValues string `json:"enum_values"` Indexes string `json:"indexes"` Note string `json:"note"` }
func MibGetsGroupBy ¶
type Module ¶
type Module struct { // A list of OIDs. Walk []string `yaml:"walk,omitempty"` Get []string `yaml:"get,omitempty"` Metrics []*Metric `yaml:"metrics"` WalkParams WalkParams `yaml:",inline"` }
type NetworkHardware ¶
type NetworkHardware struct { Id int64 `json:"id"` SN string `json:"sn" xorm:"sn"` IP string `json:"ip" xorm:"ip"` Name string `json:"name"` Note string `json:"note"` Cate string `json:"cate"` SnmpVersion string `json:"snmp_version"` Auth string `json:"auth"` Region string `json:"region"` Info string `json:"info"` Tenant string `json:"tenant"` Uptime int64 `json:"uptime"` }
func GetHardwareInfoBy ¶
func GetHardwareInfoBy(ips []string) []*NetworkHardware
func MakeNetworkHardware ¶
func MakeNetworkHardware(ip, cate, version, auth, region, note string) *NetworkHardware
func NetworkHardwareGet ¶
func NetworkHardwareGet(where string, args ...interface{}) (*NetworkHardware, error)
func NetworkHardwareList ¶
func NetworkHardwareList(query string, limit, offset int) ([]NetworkHardware, error)
func NwGetsForAdmin ¶
func NwGetsForAdmin(tenant, query, batch, field string, limit, offset int) ([]NetworkHardware, error)
func (*NetworkHardware) Del ¶
func (n *NetworkHardware) Del() error
func (*NetworkHardware) Update ¶
func (n *NetworkHardware) Update(cols ...string) error
type NetworkHardwareRpcResp ¶
type NetworkHardwareRpcResp struct { Data []*NetworkHardware Msg string }
type Node ¶
type Node struct { Id int64 `json:"id"` Pid int64 `json:"pid"` Ident string `json:"ident"` Name string `json:"name"` Note string `json:"note"` Path string `json:"path"` Leaf int `json:"leaf"` Cate string `json:"cate"` IconColor string `json:"icon_color"` IconChar string `json:"icon_char"` Proxy int `json:"proxy"` Creator string `json:"creator"` LastUpdated time.Time `json:"last_updated" xorm:"<-"` Admins []User `json:"admins" xorm:"-"` LeafNids []int64 `json:"leafNids" xorm:"-"` }
func NodeByPaths ¶
func NodeGetById ¶
func TenantsGetByUserId ¶
TenantsGetByUserId 使用方:工单
func TreeUntilProjectsGetByUser ¶
暂时保留,不知道外部其他组件是否有调用
func UserPermNodes ¶
func (*Node) CreateChild ¶
func (n *Node) CreateChild(ident, name, note, cate, creator string, leaf, proxy int, adminIds []int64) (*Node, error)
CreateChild 返回创建的子节点
func (*Node) FillAdmins ¶
func (*Node) FilterMyChildren ¶
type NodeCate ¶
type NodeCate struct { Id int64 `json:"id"` Ident string `json:"ident"` Name string `json:"name"` IconColor string `json:"icon_color"` Protected int `json:"protected"` }
func NodeCateGet ¶
type NodeCateField ¶
type NodeCateField struct { Id int64 `json:"id"` Cate string `json:"cate"` FieldIdent string `json:"field_ident"` FieldName string `json:"field_name"` FieldType string `json:"field_type"` FieldRequired int `json:"field_required"` FieldExtra string `json:"field_extra"` LastUpdated time.Time `json:"last_updated" xorm:"<-"` }
func NodeCateFieldGet ¶
func NodeCateFieldGet(where string, args ...interface{}) (*NodeCateField, error)
func NodeCateFieldGets ¶
func NodeCateFieldGets(where string, args ...interface{}) ([]NodeCateField, error)
NodeCateFieldGets 条数非常少,全部返回
func (*NodeCateField) Del ¶
func (ncf *NodeCateField) Del() error
func (*NodeCateField) Update ¶
func (ncf *NodeCateField) Update(cols ...string) error
func (*NodeCateField) Validate ¶
func (ncf *NodeCateField) Validate() error
type NodeFieldValue ¶
type NodeFieldValue struct { Id int64 `json:"id"` NodeId int64 `json:"node_id"` FieldIdent string `json:"field_ident"` FieldValue string `json:"field_value"` }
func NodeFieldValueGets ¶
func NodeFieldValueGets(nodeId int64) ([]NodeFieldValue, error)
NodeFieldValueGets 条数非常少,全部返回
func (*NodeFieldValue) Validate ¶
func (nfv *NodeFieldValue) Validate() error
type NodeResource ¶
func NodeResourceGetAll ¶ added in v4.0.4
func NodeResourceGetAll() ([]*NodeResource, error)
type NodeRole ¶
type NodeTrash ¶
type NodeTrash struct { Id int64 `json:"id"` Pid int64 `json:"pid"` Ident string `json:"ident"` Name string `json:"name"` Note string `json:"note"` Path string `json:"path"` Leaf int `json:"leaf"` Cate string `json:"cate"` IconColor string `json:"icon_color"` IconChar string `json:"icon_char"` Proxy int `json:"proxy"` Creator string `json:"creator"` LastUpdated time.Time `json:"last_updated" xorm:"<-"` }
func NodeTrashGetByIds ¶
type OperationLog ¶
type OperationLog struct { Id int64 `json:"id"` Username string `json:"username"` Clock int64 `json:"clock"` ResCl string `json:"res_cl"` ResId string `json:"res_id"` Detail string `json:"detail"` }
func OperationLogGetsByRes ¶
func OperationLogGetsByRes(rescl, resid string, btime, etime int64, limit, offset int) ([]OperationLog, error)
func OperationLogQuery ¶
func OperationLogQuery(query string, btime, etime int64, limit, offset int) ([]OperationLog, error)
func (*OperationLog) New ¶
func (ol *OperationLog) New() error
type PluginCollect ¶
type PluginCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` Name string `json:"name"` Step int `json:"step"` FilePath string `json:"file_path"` Params string `json:"params"` Stdin string `json:"stdin"` Env string `json:"env"` Comment string `json:"comment"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` }
func GetPluginCollects ¶
func GetPluginCollects() ([]*PluginCollect, error)
func (*PluginCollect) Update ¶
func (p *PluginCollect) Update() error
type PortCollect ¶
type PortCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` Name string `json:"name"` Tags string `json:"tags"` Step int `json:"step"` Comment string `json:"comment"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` Port int `json:"port"` Timeout int `json:"timeout"` }
func GetPortCollects ¶
func GetPortCollects() ([]*PortCollect, error)
func (*PortCollect) Update ¶
func (p *PortCollect) Update() error
type ProcCollect ¶
type ProcCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` Name string `json:"name"` Tags string `json:"tags"` Step int `json:"step"` Comment string `json:"comment"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` Target string `json:"target"` CollectMethod string `json:"collect_method"` ProcJiffy map[int]uint64 `xorm:"-" json:"-"` Jiffy uint64 `xorm:"-" json:"-"` RBytes map[int]uint64 `xorm:"-" json:"-"` WBytes map[int]uint64 `xorm:"-" json:"-"` }
func GetProcCollects ¶
func GetProcCollects() ([]*ProcCollect, error)
func (*ProcCollect) Update ¶
func (p *ProcCollect) Update() error
type RegexpExtract ¶
type Resource ¶
type Resource struct { Id int64 `json:"id"` UUID string `json:"uuid" xorm:"'uuid'"` Ident string `json:"ident"` Name string `json:"name"` Labels string `json:"labels"` Note string `json:"note"` Extend string `json:"extend"` Cate string `json:"cate"` Tenant string `json:"tenant"` LastUpdated time.Time `json:"last_updated" xorm:"<-"` }
func ResourceGet ¶
func ResourceGets ¶
func ResourceOrphanList ¶
func ResourceSearch ¶
func ResourceUnderNodeGets ¶
func ResourcesByIdents ¶
type ResourceBinding ¶
type ResourceBinding struct { Id int64 `json:"id"` UUID string `json:"uuid"` Ident string `json:"ident"` Name string `json:"name"` Nodes []Node `json:"nodes"` }
func ResourceBindings ¶
func ResourceBindings(resIds []int64) ([]ResourceBinding, error)
ResourceBindings 资源与节点的绑定关系,一个资源对应多个节点
type ResourceRegisterItem ¶
type ResourceRegisterItem struct { UUID string `json:"uuid"` Ident string `json:"ident"` Name string `json:"name"` Labels string `json:"labels"` Extend string `json:"extend"` Cate string `json:"cate"` NID int64 `json:"nid"` }
func (ResourceRegisterItem) Validate ¶
func (i ResourceRegisterItem) Validate() error
type Role ¶
type Role struct { Id int64 `json:"id"` Name string `json:"name"` Note string `json:"note"` Cate string `json:"cate"` }
func GlobalRolesGetByUserId ¶
GlobalRolesGetByUserId 使用方:工单
func RoleGetByIds ¶
func (*Role) CheckFields ¶
func (*Role) GlobalUserIds ¶
func (*Role) UnbindUsers ¶
type RoleGlobalUser ¶
type RoleGlobalUser struct { RoleId int64 `json:"role_id" xorm:"'role_id'"` UserId int64 `json:"user_id" xorm:"'user_id'"` }
func RoleGlobalUserAll ¶
func RoleGlobalUserAll() ([]RoleGlobalUser, error)
type RoleOperation ¶
type RoleOperation struct { Id int64 `json:"id"` RoleId int64 `json:"role_id"` Operation string `json:"operation"` }
func RoleOperationAll ¶
func RoleOperationAll() ([]RoleOperation, error)
type Screen ¶
type Screen struct { Id int64 `json:"id"` NodeId int64 `json:"node_id"` Name string `json:"name"` LastUpdator string `json:"last_updator"` LastUpdated time.Time `xorm:"<-" json:"last_updated"` NodePath string `json:"node_path" xorm:"-"` }
func ScreenGets ¶
type ScreenSubclass ¶
type ScreenSubclass struct { Id int64 `json:"id"` ScreenId int64 `json:"screen_id"` Name string `json:"name"` Weight int `json:"weight"` }
func ScreenSubclassGet ¶
func ScreenSubclassGet(col string, val interface{}) (*ScreenSubclass, error)
func ScreenSubclassGets ¶
func ScreenSubclassGets(screenId int64) ([]ScreenSubclass, error)
func (*ScreenSubclass) Add ¶
func (s *ScreenSubclass) Add() error
func (*ScreenSubclass) Del ¶
func (s *ScreenSubclass) Del() error
func (*ScreenSubclass) Update ¶
func (s *ScreenSubclass) Update(cols ...string) error
type Session ¶
type Session struct { Sid string `json:"sid"` AccessToken string `json:"-"` Username string `json:"username"` RemoteAddr string `json:"remote_addr"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` }
func SessionAndTotalGets ¶
func SessionGet ¶
func SessionGetByToken ¶
func SessionGetWithCache ¶
SessionGetWithCache will update session.UpdatedAt && token.LastAt
func SessionGets ¶
func TokenGetWithCache ¶
TokenGetWithCache will update token.LastAt
type SnmpCollect ¶
type SnmpCollect struct { Id int64 `json:"id"` Nid int64 `json:"nid"` CollectType string `json:"collect_type"` OidType int `json:"oid_type"` //1 通用指标 2 私有指标 3 自定义指标 Module string `json:"module"` Metric string `json:"metric"` MetricType string `json:"metric_type"` Oid string `json:"oid"` Step int `json:"step"` Timeout int `json:"timeout"` Port int `json:"port"` IndexesStr string `xorm:"indexes" json:"-"` Comment string `json:"comment"` Creator string `json:"creator"` Created time.Time `xorm:"updated" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"updated" json:"last_updated"` Indexes []*Index `xorm:"-" json:"indexes"` Region string `xorm:"-" json:"region"` Version string `xorm:"-" json:"version"` Auth string `xorm:"-" json:"auth"` }
func GetSnmpCollects ¶
func GetSnmpCollects(nid int64) ([]*SnmpCollect, error)
func (*SnmpCollect) Decode ¶
func (s *SnmpCollect) Decode() error
func (*SnmpCollect) Encode ¶
func (s *SnmpCollect) Encode() error
func (*SnmpCollect) GetByOidAndModule ¶
func (s *SnmpCollect) GetByOidAndModule() (*SnmpCollect, error)
func (*SnmpCollect) Update ¶
func (s *SnmpCollect) Update() error
type Stats ¶
func MustNewStats ¶
type Stra ¶
type Stra struct { Id int64 `json:"id"` Name string `json:"name"` Category int `json:"category"` //机器,非机器 Nid int64 `json:"nid"` ExclNidStr string `xorm:"excl_nid" json:"-"` //排除的叶子节点 AlertDur int `json:"alert_dur"` //单位秒,持续异常10分钟则产生异常event RecoveryDur int `json:"recovery_dur"` //单位秒,持续正常2分钟则产生恢复event,0表示立即产生恢复event RecoveryNotify int `json:"recovery_notify"` //1 发送恢复通知 0不发送恢复通知 ExprsStr string `xorm:"exprs" json:"-"` //多个条件的监控实例需要相同,并且同时满足才产生event TagsStr string `xorm:"tags" json:"-"` //tag过滤条件 EnableStime string `json:"enable_stime"` //策略生效开始时间 EnableEtime string `json:"enable_etime"` //策略生效终止时间 支持23:00-02:00 EnableDaysOfWeekStr string `xorm:"enable_days_of_week" json:"-"` //策略生效日期 ConvergeStr string `xorm:"converge" json:"-"` //告警通知收敛,第1个值表示收敛周期,单位秒,第2个值表示周期内允许发送告警次数 Priority int `json:"priority"` Callback string `json:"callback"` NotifyGroupStr string `xorm:"notify_group" json:"-"` NotifyUserStr string `xorm:"notify_user" json:"-"` Creator string `json:"creator"` Created time.Time `xorm:"created" json:"created"` LastUpdator string `xorm:"last_updator" json:"last_updator"` LastUpdated time.Time `xorm:"<-" json:"last_updated"` NeedUpgrade int `xorm:"need_upgrade" json:"need_upgrade"` AlertUpgradeStr string `xorm:"alert_upgrade" json:"-"` WorkGroupsStr string `xorm:"work_groups" json:"-"` Runbook string `xorm:"runbook" json:"runbook"` ExclNid []int64 `xorm:"-" json:"excl_nid"` Nids []string `xorm:"-" json:"nids"` Exprs []Exp `xorm:"-" json:"exprs"` Tags []Tag `xorm:"-" json:"tags"` EnableDaysOfWeek []int `xorm:"-" json:"enable_days_of_week"` Converge []int `xorm:"-" json:"converge"` NotifyGroup []int64 `xorm:"-" json:"notify_group"` NotifyGroupDetail []Team `xorm:"-" json:"notify_group_detail"` NotifyUser []int64 `xorm:"-" json:"notify_user"` NotifyUserDetail []User `xorm:"-" json:"notify_user_detail"` LeafNids []int64 `xorm:"-" json:"leaf_nids"` //叶子节点id Endpoints []string `xorm:"-" json:"endpoints"` AlertUpgrade AlertUpgrade `xorm:"-" json:"alert_upgrade"` JudgeInstance string `xorm:"-" json:"judge_instance"` WorkGroups []int `xorm:"-" json:"work_groups"` }
func EffectiveStrasList ¶
func StraFindOne ¶
func (*Stra) HasPermssion ¶
type TaskAction ¶
func TaskActionGet ¶
func TaskActionGet(where string, args ...interface{}) (*TaskAction, error)
func (*TaskAction) Update ¶
func (a *TaskAction) Update(action string) error
type TaskHost ¶
type TaskHost struct { Id int64 `json:"id"` Host string `json:"host"` Status string `json:"status"` Stdout string `json:"stdout"` Stderr string `json:"stderr"` }
func TaskHostGets ¶
func TaskHostStatus ¶
type TaskHostDoing ¶
func DoingHostList ¶
func DoingHostList(where string, args ...interface{}) ([]TaskHostDoing, error)
func GetDoingCache ¶
func GetDoingCache(k string) []TaskHostDoing
type TaskMeta ¶
type TaskMeta struct { Id int64 `json:"id"` Title string `json:"title"` Account string `json:"account"` Batch int `json:"batch"` Tolerance int `json:"tolerance"` Timeout int `json:"timeout"` Pause string `json:"pause"` Script string `json:"script"` Args string `json:"args"` Creator string `json:"creator"` Created time.Time `xorm:"created" json:"created"` Done bool `xorm:"-" json:"done"` }
func TaskMetaGet ¶
func TaskMetaGetByID ¶
TaskMetaGet 根据ID获取任务元信息,会用到内存缓存
func TaskMetaGets ¶
func (*TaskMeta) Action ¶
func (m *TaskMeta) Action() (*TaskAction, error)
func (*TaskMeta) CleanFields ¶
func (*TaskMeta) IgnoreHost ¶
type TaskScheduler ¶
type TaskSchedulerHealth ¶
type TaskTpl ¶
type TaskTpl struct { Id int64 `json:"id"` NodeId int64 `json:"node_id"` Title string `json:"title"` Batch int `json:"batch"` Tolerance int `json:"tolerance"` Timeout int `json:"timeout"` Pause string `json:"pause"` Script string `json:"script"` Args string `json:"args"` Tags string `json:"tags"` Account string `json:"account"` Creator string `json:"creator"` LastUpdated time.Time `xorm:"<-" json:"last_updated"` }
func TaskTplGet ¶
func TaskTplGets ¶
func (*TaskTpl) CleanFields ¶
func (*TaskTpl) UnbindTags ¶
func (*TaskTpl) UpdateGroup ¶
type Team ¶
type Team struct { Id int64 `json:"id"` Ident string `json:"ident"` Name string `json:"name"` Note string `json:"note"` Mgmt int `json:"mgmt"` Creator int64 `json:"creator"` LastUpdated time.Time `json:"last_updated" xorm:"<-"` }
func TeamGetByIds ¶
func TeamGetsInIds ¶
func (*Team) CheckFields ¶
func (*Team) UnbindUser ¶
type TeamMember ¶
type TeamUser ¶
type TmpChart ¶
type TmpChart struct { Id int64 `json:"id"` Configs string `json:"configs"` Creator string `json:"creator"` }
func TmpChartGet ¶
type Token ¶
type Token struct { Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty" description:"access token name"` AccessToken string `json:"accessToken,omitempty"` RefreshToken string `json:"refreshToken,omitempty"` ClientId string `json:"clientId,omitempty"` Authorize string `json:"authorize,omitempty"` Previous string `json:"previous,omitempty"` ExpiresIn int64 `json:"expiresIn,omitempty" description:"max 3 year, default:0, max time"` Scope string `json:"scope,omitempty" description:"scope split by ' '"` RedirectUri string `json:"redirectUri,omitempty"` UserName string `json:"userName,omitempty"` CreatedAt int64 `json:"createdAt,omitempty" out:",date"` LastAt int64 `json:"lastAt,omitempty" out:",date"` }
type User ¶
type User struct { Id int64 `json:"id"` UUID string `json:"uuid" xorm:"'uuid'"` Username string `json:"username"` Password string `json:"-"` Passwords string `json:"-"` Dispname string `json:"dispname"` Phone string `json:"phone"` Email string `json:"email"` Im string `json:"im"` Portrait string `json:"portrait"` Intro string `json:"intro"` Organization string `json:"organization"` Type int `json:"type" xorm:"'typ'" description:"0: long-term account; 1: temporary account"` Status int `json:"status" description:"0: active, 1: inactive, 2: locked, 3: frozen, 4: writen-off"` IsRoot int `json:"is_root"` LeaderId int64 `json:"leader_id"` LeaderName string `json:"leader_name"` LoginErrNum int `json:"login_err_num"` ActiveBegin int64 `json:"active_begin" description:"for temporary account"` ActiveEnd int64 `json:"active_end" description:"for temporary account"` LockedAt int64 `json:"locked_at" description:"locked time"` UpdatedAt int64 `json:"updated_at" description:"user info change time"` PwdUpdatedAt int64 `json:"pwd_updated_at" description:"password change time"` PwdExpiresAt int64 `xorm:"-" json:"pwd_expires_at" description:"password expires time"` LoggedAt int64 `json:"logged_at" description:"last logged time"` CreateAt time.Time `json:"create_at" xorm:"<-"` }
func EmailCodeLogin ¶
func SessionGetUserWithCache ¶
func SmsCodeLogin ¶
func UserAndTotalGets ¶
func UserGetByIds ¶
func UserGetByNames ¶
func UserGetByUUIDs ¶
func UserGetsByIds ¶
func UserMustGet ¶
func UserSearchListInIds ¶
func UsersGetByGlobalRoleIds ¶
UsersGetByGlobalRoleIds 使用方:工单
func (*User) CheckPermByNode ¶
func (*User) CheckPermGlobal ¶
func (*User) CopyLdapAttr ¶
func (u *User) CopyLdapAttr(sr *ldap.SearchResult)
func (*User) HasPermByNode ¶
func (*User) NopriResIdents ¶
NopriResIdents 我没有权限的资源ident列表
func (*User) PermByNode ¶
func (*User) PermResIds ¶
PermResIds 我在某些节点是管理员,或者我在某些节点有此权限点,获取下面的叶子节点挂载的资源列表
type UserToken ¶
type UserToken struct { UserId int64 `json:"user_id"` Username string `json:"username"` Token string `json:"token"` }
func UserTokenGet ¶
func UserTokenGets ¶
type WalkParams ¶
type WhiteList ¶
type WhiteList struct { Id int64 `json:"id"` StartIp string `json:"startIp"` StartIpInt int64 `json:"-"` EndIp string `json:"endIp"` EndIpInt int64 `json:"-"` StartTime int64 `json:"startTime"` EndTime int64 `json:"endTime"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updateAt"` Creator string `json:"creator"` Updater string `json:"updater"` }
func WhiteListGet ¶
Source Files ¶
- auth_state.go
- const.go
- host.go
- host_field.go
- host_field_value.go
- host_register.go
- init.go
- instance.go
- invite.go
- ldap.go
- login_code.go
- login_log.go
- mon_aggr.go
- mon_chart.go
- mon_collect.go
- mon_collect_rule.go
- mon_event.go
- mon_event_cur.go
- mon_event_status_convert.go
- mon_maskconf.go
- mon_screen.go
- mon_screen_subclass.go
- mon_stra.go
- mon_tmp_chart.go
- mysql.go
- nems_mib.go
- nems_nethw.go
- node.go
- node_admin.go
- node_cate.go
- node_cate_field.go
- node_cate_field_value.go
- node_resource.go
- node_role.go
- node_service.go
- node_trash.go
- operation_log.go
- rdb_captcha.go
- rdb_configs.go
- rdb_session.go
- resource.go
- resource_service.go
- role.go
- role_global_user.go
- role_opration.go
- sso_token.go
- task_action.go
- task_host.go
- task_host_doing.go
- task_meta.go
- task_scheduler.go
- task_scheduler_health.go
- task_tpl.go
- team.go
- team_user.go
- tools.go
- user.go
- user_service.go
- user_stats.go
- user_token.go
- white_list.go