isvcs

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 30 Imported by: 11

Documentation

Index

Constants

View Source
const (
	IMAGE_REPO         = "zenoss/serviced-isvcs"
	IMAGE_TAG          = "v73"
	ZK_IMAGE_REPO      = "zenoss/isvcs-zookeeper"
	ZK_IMAGE_TAG       = "v16"
	OTSDB_BT_REPO      = "zenoss/isvcs-metrics-bigtable"
	OTSDB_BT_TAG       = "v2"
	API_KEY_PROXY_REPO = "gcr.io/zing-registry-188222/api-key-proxy"
	API_KEY_PROXY_TAG  = "2018-08-01-1"
)
View Source
const API_KEY_PROXY_SERVER_HEALTHCHECK_NAME = "api-key-server-running"
View Source
const API_KEY_PROXY_SERVER_INTERNAL_API_HEALTHCHECK_NAME = "internal-api-reachable"
View Source
const DEFAULT_ES_STARTUP_TIMEOUT_SECONDS = 240 //default startup timeout in seconds (4 minutes)
View Source
const DEFAULT_HEALTHCHECK_INTERVAL = time.Duration(30) * time.Second
View Source
const DEFAULT_HEALTHCHECK_NAME = "running"
View Source
const DEFAULT_HEALTHCHECK_TIMEOUT = time.Duration(10) * time.Second
View Source
const HEALTH_STATUS_INDEX_ALL = -1 // The index to return all health statuses.
View Source
const MIN_ES_STARTUP_TIMEOUT_SECONDS = 30 //minimum startup timeout in seconds
View Source
const QUORUM_HEALTHCHECK_NAME = "hasQuorum"
View Source
const WAIT_FOR_INITIAL_HEALTHCHECK = time.Duration(2) * time.Minute

Variables

View Source
var (
	ErrNotRunning       = errors.New("isvc: not running")
	ErrRunning          = errors.New("isvc: running")
	ErrBadContainerSpec = errors.New("isvc: bad service specification")
	ErrNoDockerIP       = errors.New("isvc: unable to get IP for docker interface")
)
View Source
var (
	ErrManagerUnknownOp  = errors.New("manager: unknown operation")
	ErrManagerUnknownArg = errors.New("manager: unknown arg type")
	ErrImageNotExists    = errors.New("manager: image does not exist")
	ErrNotifyFailed      = errors.New("manager: notification failure")
)
View Source
var ApiKeyProxyIRS dao.RunningService
View Source
var ApiKeyProxyISVC s.Service
View Source
var DockerRegistryIRS dao.RunningService
View Source
var DockerRegistryISVC s.Service
View Source
var ElasticsearchLogStashIRS dao.RunningService
View Source
var ElasticsearchLogStashISVC s.Service
View Source
var ElasticsearchServicedIRS dao.RunningService
View Source
var ElasticsearchServicedISVC s.Service
View Source
var ISVCSMap map[string]*s.Service
View Source
var InternalServicesIRS dao.RunningService
View Source
var InternalServicesISVC s.Service
View Source
var KibanaISVC s.Service
View Source
var LogstashIRS dao.RunningService
View Source
var LogstashISVC s.Service
View Source
var OpentsdbIRS dao.RunningService
View Source
var OpentsdbISVC s.Service
View Source
var UseServicedLogDir = "UseServicedLogDir"
View Source
var ZookeeperIRS dao.RunningService
View Source
var ZookeeperISVC s.Service

Functions

func AddEnv

func AddEnv(env_str string) error

Add a string of the form SERVICE:KEY=VAL to the isvcs environment map

func BuildZooKeeperRunningInstance

func BuildZooKeeperRunningInstance(instanceID int) dao.RunningService

func CheckURL

func CheckURL(TestURL string) error

func GetElasticSearchCustomStats

func GetElasticSearchCustomStats(halt <-chan struct{}) error

GetElasticSearchCustomStats retrieves ElasticSearch specific stats form the ElasticSearch servers. This should be run as a separate go routine.

func GetOpenTSDBCustomStats

func GetOpenTSDBCustomStats(halt <-chan struct{}) error

GetOpenTSDBCustomStats retrieves OpenTSDB specific stats form the OpenTSDB servers. This should be run as a separate go routine.

func GetZooKeeperCustomStats

func GetZooKeeperCustomStats(halt <-chan struct{}) error

GetZooKeeperCustomStats retrieves ZooKeeper specific stats form the ZooKeeper servers. This should be run as a separate go routine.

func GetZooKeeperRunningInstances

func GetZooKeeperRunningInstances() []dao.RunningService

func Init

func Init(esStartupTimeoutInSeconds int, dockerLogDriver string, dockerLogConfig map[string]string, dockerAPI docker.Docker, startZK bool, bigtable bool)

func InitAllIsvcs

func InitAllIsvcs(bigtable bool)

func InitServices

func InitServices(isvcNames []string, dockerLogDriver string, dockerLogConfig map[string]string, dockerAPI docker.Docker)

func PreInit

func PreInit(bigtable bool) error

func PurgeLogstashIndices

func PurgeLogstashIndices(days int, gb int)

Types

type CustomStatsFunction

type CustomStatsFunction func(halt <-chan struct{}) error

CustomStatFunction is a function to run at an interval to get custom stats for a service

type ESHealth

type ESHealth int
const (
	ESRed ESHealth = iota
	ESYellow
	ESGreen
)

func GetHealth

func GetHealth(health string) ESHealth

func (ESHealth) String

func (health ESHealth) String() string

type ElasticSearchStats

type ElasticSearchStats struct {
	Address string
	// contains filtered or unexported fields
}

type ElasticSearchStatsCache

type ElasticSearchStatsCache struct {
	// contains filtered or unexported fields
}

func NewElasticSearchStatsCache

func NewElasticSearchStatsCache() *ElasticSearchStatsCache

func (*ElasticSearchStatsCache) Read

func (*ElasticSearchStatsCache) ReadAll

func (*ElasticSearchStatsCache) Write

type ElasticSearchStatsStore

type ElasticSearchStatsStore interface {
	ReadAll() []ElasticSearchStats
	Read(address string) (ElasticSearchStats, error)
	Write(stats ElasticSearchStats)
	WriteAll(stats []ElasticSearchStats)
}

func NewElasticSearchStatsStore

func NewElasticSearchStatsStore() ElasticSearchStatsStore

type ExitError

type ExitError int

func (ExitError) Error

func (err ExitError) Error() string

type HealthCheckFunction

type HealthCheckFunction func(halt <-chan struct{}) error

HealthCheckFunction- A function to verify the service is healthy

func SetKeyProxyAnsweringHealthCheck

func SetKeyProxyAnsweringHealthCheck() HealthCheckFunction

func SetKeyServerReachableHealthCheck

func SetKeyServerReachableHealthCheck() HealthCheckFunction

func SetZKHealthCheck

func SetZKHealthCheck(connectString string) HealthCheckFunction

This function sets up a ZooKeeper health check function parameterized with the connection string eg: "127.0.0.1:2181".

func SetZKQuorumCheck

func SetZKQuorumCheck(connectString string) HealthCheckFunction

This function sets up a ZooKeeper quorum check function parameterized with the connection string eg: "127.0.0.1:2181".

type IService

type IService struct {
	IServiceDefinition
	// contains filtered or unexported fields
}

func NewIService

func NewIService(sd IServiceDefinition) (*IService, error)

func (*IService) Exec

func (svc *IService) Exec(command []string) ([]byte, error)

func (*IService) IsRunning

func (svc *IService) IsRunning() bool

func (*IService) Restart

func (svc *IService) Restart() error

func (*IService) SetRoot

func (svc *IService) SetRoot(root string)

func (*IService) Start

func (svc *IService) Start() error

func (*IService) Stop

func (svc *IService) Stop() error

type IServiceDefinition

type IServiceDefinition struct {
	ID             string                             // the ID of the service associated
	Name           string                             // name of the service (used in naming containers)
	Repo           string                             // the service's docker repository
	Tag            string                             // the service's docker repository tag
	Command        func() string                      // the command to run in the container
	Volumes        map[string]string                  // volumes to bind mount to the container
	PortBindings   []portBinding                      // defines how ports are exposed on the host
	HealthChecks   []map[string]healthCheckDefinition // a set of functions to verify the service is healthy
	Configuration  map[string]interface{}             // service specific configuration
	Notify         func(*IService, interface{}) error // A function to run when notified of a data event
	PreStart       func(*IService) error              // A function to run before the initial start of the service
	PostStart      func(*IService) error              // A function to run after the initial start of the service
	Recover        func(path string) error            // A recovery step if the service fails to start
	StartupFailed  func()                             // A clean up step just before the service is stopped
	HostNetwork    bool                               // enables host network in the container
	Links          []string                           // List of links to other containers in the form of <name>:<alias>
	StartGroup     uint16                             // Start up group number
	StartupTimeout time.Duration                      // How long to wait for the service to start up (this is the timeout for the initial 'startup' healthcheck)
	CustomStats    CustomStatsFunction                // Function that is run on interval to get custom stats
}
var Zookeeper IServiceDefinition

type IServiceHealthResult

type IServiceHealthResult struct {
	ServiceName    string
	ContainerName  string
	ContainerID    string
	HealthStatuses []domain.HealthCheckStatus
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

A manager of docker services run in ephemeral containers

var (
	Mgr *Manager
)

func NewManager

func NewManager(imagesDir, volumesDir string, dockerLogDriver string, dockerLogConfig map[string]string) *Manager

Returns a new Manager struct and starts the Manager's main loop()

func (*Manager) GetHealthStatus

func (m *Manager) GetHealthStatus(name string, instIndex int) (IServiceHealthResult, error)

func (*Manager) GetServiceNames

func (m *Manager) GetServiceNames() []string

Returns a list of iservice names in sorted order

func (*Manager) Notify

func (m *Manager) Notify(val interface{}) error

Notify() sends a notify() message to all the containers with the given data val

func (*Manager) Register

func (m *Manager) Register(svc *IService) error

Register() registers a container to be managed by the *Manager

func (*Manager) SetConfigurationOption

func (m *Manager) SetConfigurationOption(name, key string, value interface{}) error

func (*Manager) SetVolumesDir

func (m *Manager) SetVolumesDir(dir string)

SetVolumesDir sets the volumes dir for *Manager

func (*Manager) Start

func (m *Manager) Start() error

Start() starts all the containers managed by the *Manager

func (*Manager) Stop

func (m *Manager) Stop() error

Stop() stops all the containers currently registered to the *Manager

func (*Manager) TearDown

func (m *Manager) TearDown() error

TearDown() causes the *Manager's loop() to exit

type OpenTSDBStats

type OpenTSDBStats struct {
	// contains filtered or unexported fields
}

type OpenTSDBStatsCache

type OpenTSDBStatsCache struct {
	// contains filtered or unexported fields
}

func NewOpenTSDBStatsCache

func NewOpenTSDBStatsCache() *OpenTSDBStatsCache

func (*OpenTSDBStatsCache) Read

func (c *OpenTSDBStatsCache) Read() (OpenTSDBStats, error)

func (*OpenTSDBStatsCache) ReadAll

func (c *OpenTSDBStatsCache) ReadAll() []OpenTSDBStats

func (*OpenTSDBStatsCache) Write

func (c *OpenTSDBStatsCache) Write(stats OpenTSDBStats)

type OpenTSDBStatsStore

type OpenTSDBStatsStore interface {
	ReadAll() []OpenTSDBStats
	Read() (OpenTSDBStats, error)
	Write(stats OpenTSDBStats)
	WriteAll(stats []OpenTSDBStats)
}

func NewOpenTSDBStatsStore

func NewOpenTSDBStatsStore() OpenTSDBStatsStore

type StartError

type StartError int

func (StartError) Error

func (err StartError) Error() string

type StopError

type StopError int

func (StopError) Error

func (err StopError) Error() string

type ZKstatsStore

type ZKstatsStore struct {
	// contains filtered or unexported fields
}

func (*ZKstatsStore) Read

func (ss *ZKstatsStore) Read(key ZooKeeperKey) (ZooKeeperStats, error)

func (*ZKstatsStore) ReadAll

func (ss *ZKstatsStore) ReadAll() []ZooKeeperStats

func (*ZKstatsStore) Write

func (ss *ZKstatsStore) Write(stats ZooKeeperStats)

func (*ZKstatsStore) WriteAll

func (ss *ZKstatsStore) WriteAll(stats []ZooKeeperStats)

type ZooKeeperInstance

type ZooKeeperInstance struct {
	dao.RunningService
	IP    string
	Port  int
	Stats ZooKeeperStats
}

func GetZooKeeperInstances

func GetZooKeeperInstances() []ZooKeeperInstance

type ZooKeeperKey

type ZooKeeperKey struct {
	InstanceID int
	Connection string
}

func GetZooKeeperKeys

func GetZooKeeperKeys() []ZooKeeperKey

type ZooKeeperStats

type ZooKeeperStats struct {
	Address     string
	InstanceID  int
	Connections int
	Mode        string
}

func GetZooKeeperStatsByID

func GetZooKeeperStatsByID(instanceID int) (ZooKeeperStats, error)

type ZooKeeperStatsCache

type ZooKeeperStatsCache struct {
	// contains filtered or unexported fields
}

func NewZooKeeperStatsCache

func NewZooKeeperStatsCache() *ZooKeeperStatsCache

func (*ZooKeeperStatsCache) Read

func (c *ZooKeeperStatsCache) Read(address string) (ZooKeeperStats, error)

func (*ZooKeeperStatsCache) ReadAll

func (c *ZooKeeperStatsCache) ReadAll() []ZooKeeperStats

func (*ZooKeeperStatsCache) Write

func (c *ZooKeeperStatsCache) Write(stats ZooKeeperStats)

type ZooKeeperStatsStore

type ZooKeeperStatsStore interface {
	ReadAll() []ZooKeeperStats
	Read(key ZooKeeperKey) (ZooKeeperStats, error)
	Write(stats ZooKeeperStats)
	WriteAll(stats []ZooKeeperStats)
}

func NewZooKeeperStatsStore

func NewZooKeeperStatsStore() ZooKeeperStatsStore

Jump to

Keyboard shortcuts

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