cmd

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Init cli
	Init = &cli.Command{
		Name:   "init",
		Usage:  "Init config file",
		Action: AppInit,
	}
	API = &zabbix.API{}
	Cfg = &ini.File{}
)
View Source
var (
	MSName   = "ms-agent"
	MSUser   = "ms-agent"
	MSGroup  = "MS-Agent Group"
	MSMedia  = "MS-Agent Media"
	MSAction = "MS-Agent Action"
)

ms-aget const

View Source
var (
	// Install cli
	Install = &cli.Command{
		Name:   "install",
		Usage:  "Install ms-agent tools to Zabbix Server",
		Action: installAagent,
	}
)
View Source
var (
	// Install cli
	Ua = &cli.Command{
		Name:   "ua",
		Usage:  "Update action",
		Action: UpdateAction,
	}
)
View Source
var (
	//config update
	Uc = &cli.Command{
		Name:   "uc",
		Usage:  "Update config file",
		Action: updateconfig,
	}
)
View Source
var (
	// Install cli
	Un = &cli.Command{
		Name:   "un",
		Usage:  "Uninstall action",
		Action: UninstallAction,
	}
)
View Source
var (
	//Web 配置
	Web = &cli.Command{
		Name:   "web",
		Usage:  "Start web server",
		Action: runWeb,
	}
)

Functions

func AppInit added in v1.1.0

func AppInit(*cli.Context) error

AppInit

func CheckConfExist added in v1.1.2

func CheckConfExist()

CheckConfExist config

func CheckDb added in v1.1.0

func CheckDb(dbdriver, dbhost, dbuser, dbpass, dbname string, dbport string) error

CheckDb

func CheckZabbixAPI added in v1.1.2

func CheckZabbixAPI(address, user, pass string) (string, error)

LoginZabbixAPI Check

func CreateEventTpl added in v1.1.0

func CreateEventTpl() string

func GetActionID added in v1.1.0

func GetActionID(ActionName string) (string, error)

GetActionID by actionname

func GetMediaTypeID added in v1.1.0

func GetMediaTypeID(MediaName string) (string, error)

GetMediaTypeID by medianame

func InitConfig added in v1.1.2

func InitConfig(v string) string

init config files

func PreCheckConf added in v1.1.0

func PreCheckConf(zabbix_web, zabbix_user, zabbix_pass,
	dbtype, dbhost, dbuser, dbpass, dbname, dbport string) error

check conf

func RandStringRunes

func RandStringRunes() string

RandStringRunes 随机密码生成

func UninstallAction added in v1.1.2

func UninstallAction(*cli.Context) error

func UpdateAction added in v1.1.0

func UpdateAction(*cli.Context) error

func WriteConf added in v1.1.0

func WriteConf(zabbix_web, zabbix_user, zabbix_pass,
	dbtype, dbhost, dbuser, dbpass, dbname, dbport,
	httpport, runmode, timeout, token string) error

Write config files

Types

type EventTpl added in v1.1.0

type EventTpl struct {
	HostsID      string `json:"host_id"`
	HostHost     string `json:"host_host"`
	Hostname     string `json:"hostname"`
	HostsIP      string `json:"host_ip"`
	HostGroup    string `json:"host_group"`
	EventTime    string `json:"event_time"`
	Severity     string `json:"severity"`
	TriggerID    string `json:"trigger_id"`
	TriggerName  string `json:"trigger_name"`
	TriggerKey   string `json:"trigger_key"`
	TriggerValue string `json:"trigger_value"`
	ItemID       string `json:"item_id"`
	ItemName     string `json:"item_name"`
	ItemValue    string `json:"item_value"`
	EventID      string `json:"event_id"`
}

type UserInfo added in v1.1.2

type UserInfo struct {
	Mediatypes []struct {
		Mediatypeid string `json:"mediatypeid"`
	} `json:"mediatypes"`
	Userid  string `json:"userid"`
	Usrgrps []struct {
		Usrgrpid string `json:"usrgrpid"`
	} `json:"usrgrps"`
}

UserGrpInfo st

func GetUserID added in v1.1.2

func GetUserID(Username string) (userinfo UserInfo, err error)

GetUserID by username

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL