utils

package
v0.3.9-9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 26 Imported by: 3

Documentation

Index

Constants

View Source
const TELEGRAF_CONF_TEMPLETE = `` /* 1246-byte string literal not displayed */

copy from: https://github.com/yunionio/ansible-telegraf/blob/master/templates/telegraf.conf.j2

View Source
const TELEGRAF_INPUT_BAREMETAL = `` /* 822-byte string literal not displayed */
View Source
const TELEGRAF_INPUT_LINUX = `` /* 809-byte string literal not displayed */
View Source
const TELEGRAF_INPUT_WINDOWS = `` /* 712-byte string literal not displayed */

Variables

View Source
var ErrCannotReachInfluxbd = errors.Error("no suitable network to reach influxdb")
View Source
var ErrServerNotSshable = errors.Error("server is not sshable")

Functions

func FindValidServiceUrl

func FindValidServiceUrl(ctx context.Context, service Service, proxyEndpointId string, info sServerInfo, host *ansible_api.AnsibleHost) (string, error)

func GenerateTelegrafConf

func GenerateTelegrafConf(
	serverDetails *api.ServerDetails, influxdbUrl, osType, hypervisor string,
) (string, error)

func GetArgGenerator

func GetArgGenerator(name string) (argGenerator, bool)

func GetArgs

func GetArgs(ctx context.Context, serverId, proxyEndpointId string, others interface{}) (map[string]interface{}, error)

func GetCleanFunc

func GetCleanFunc(session *mcclient.ClientSession, hypervisor, serverId, host, forward string, port int) func() error

func GetLocalArgs

func GetLocalArgs(serverDetails *comapi.ServerDetails, influxdbUrl string) map[string]interface{}

func GetServerInfo

func GetServerInfo(ctx context.Context, serverId string) (sServerInfo, error)

func GetServiceUrl

func GetServiceUrl(ctx context.Context, serviceName string) (string, error)

func GetValFromMap

func GetValFromMap(valMap map[string]string, key string) string

func RegisterArgGenerator

func RegisterArgGenerator(name string, ag argGenerator)

Types

type SSHable

type SSHable struct {
	Ok     bool
	Reason string

	User     string
	Host     string
	Port     int
	Password string

	ServerName       string
	ServerHypervisor string
	OsType           string

	ProxyEndpointId string
	ProxyAgentId    string
	ProxyForwardId  string
}

func CheckSSHable

func CheckSSHable(session *mcclient.ClientSession, serverId string) (sshable SSHable, cleanFunc func() error, err error)

func CheckSshableForYunionCloud

func CheckSshableForYunionCloud(session *mcclient.ClientSession, serverInfo SServerInfo) (sshable SSHable, cleanFunc func() error, err error)

type SServerInfo

type SServerInfo struct {
	Id         string
	Ip         string
	VpcId      string
	Hypervisor string
}

type Service

type Service struct {
	Name string
	Url  string
}

Jump to

Keyboard shortcuts

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