Documentation ¶
Index ¶
- Constants
- Variables
- func AddEnv(env_str string) error
- func BuildZooKeeperRunningInstance(instanceID int) dao.RunningService
- func CheckURL(TestURL string) error
- func GetElasticSearchCustomStats(halt <-chan struct{}) error
- func GetOpenTSDBCustomStats(halt <-chan struct{}) error
- func GetZooKeeperCustomStats(halt <-chan struct{}) error
- func GetZooKeeperRunningInstances() []dao.RunningService
- func Init(esStartupTimeoutInSeconds int, dockerLogDriver string, ...)
- func InitAllIsvcs(bigtable bool)
- func InitServices(isvcNames []string, dockerLogDriver string, dockerLogConfig map[string]string, ...)
- func PreInit(bigtable bool) error
- func PurgeLogstashIndices(days int, gb int)
- type CustomStatsFunction
- type ESHealth
- type ElasticSearchStats
- type ElasticSearchStatsCache
- type ElasticSearchStatsStore
- type ExitError
- type HealthCheckFunction
- type IService
- type IServiceDefinition
- type IServiceHealthResult
- type Manager
- func (m *Manager) GetHealthStatus(name string, instIndex int) (IServiceHealthResult, error)
- func (m *Manager) GetServiceNames() []string
- func (m *Manager) Notify(val interface{}) error
- func (m *Manager) Register(svc *IService) error
- func (m *Manager) SetConfigurationOption(name, key string, value interface{}) error
- func (m *Manager) SetVolumesDir(dir string)
- func (m *Manager) Start() error
- func (m *Manager) Stop() error
- func (m *Manager) TearDown() error
- type OpenTSDBStats
- type OpenTSDBStatsCache
- type OpenTSDBStatsStore
- type StartError
- type StopError
- type ZKstatsStore
- type ZooKeeperInstance
- type ZooKeeperKey
- type ZooKeeperStats
- type ZooKeeperStatsCache
- type ZooKeeperStatsStore
Constants ¶
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" )
const API_KEY_PROXY_SERVER_HEALTHCHECK_NAME = "api-key-server-running"
const API_KEY_PROXY_SERVER_INTERNAL_API_HEALTHCHECK_NAME = "internal-api-reachable"
const DEFAULT_ES_STARTUP_TIMEOUT_SECONDS = 240 //default startup timeout in seconds (4 minutes)
const DEFAULT_HEALTHCHECK_INTERVAL = time.Duration(30) * time.Second
const DEFAULT_HEALTHCHECK_NAME = "running"
const DEFAULT_HEALTHCHECK_TIMEOUT = time.Duration(10) * time.Second
const HEALTH_STATUS_INDEX_ALL = -1 // The index to return all health statuses.
const MIN_ES_STARTUP_TIMEOUT_SECONDS = 30 //minimum startup timeout in seconds
const QUORUM_HEALTHCHECK_NAME = "hasQuorum"
const WAIT_FOR_INITIAL_HEALTHCHECK = time.Duration(2) * time.Minute
Variables ¶
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") )
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") )
var ApiKeyProxyIRS dao.RunningService
var ApiKeyProxyISVC s.Service
var DockerRegistryIRS dao.RunningService
var DockerRegistryISVC s.Service
var ElasticsearchLogStashIRS dao.RunningService
var ElasticsearchLogStashISVC s.Service
var ElasticsearchServicedIRS dao.RunningService
var ElasticsearchServicedISVC s.Service
var IRSMap map[string]*dao.RunningService
var ISVCSMap map[string]*s.Service
var InternalServicesIRS dao.RunningService
var InternalServicesISVC s.Service
var KibanaIRS dao.RunningService
var KibanaISVC s.Service
var LogstashIRS dao.RunningService
var LogstashISVC s.Service
var OpentsdbIRS dao.RunningService
var OpentsdbISVC s.Service
var UseServicedLogDir = "UseServicedLogDir"
var ZookeeperIRS dao.RunningService
var ZookeeperISVC s.Service
Functions ¶
func BuildZooKeeperRunningInstance ¶
func BuildZooKeeperRunningInstance(instanceID int) dao.RunningService
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 InitAllIsvcs ¶
func InitAllIsvcs(bigtable bool)
func InitServices ¶
func PurgeLogstashIndices ¶
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 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 (c *ElasticSearchStatsCache) Read(address string) (ElasticSearchStats, error)
func (*ElasticSearchStatsCache) ReadAll ¶
func (c *ElasticSearchStatsCache) ReadAll() []ElasticSearchStats
func (*ElasticSearchStatsCache) Write ¶
func (c *ElasticSearchStatsCache) Write(stats ElasticSearchStats)
type ElasticSearchStatsStore ¶
type ElasticSearchStatsStore interface { ReadAll() []ElasticSearchStats Read(address string) (ElasticSearchStats, error) Write(stats ElasticSearchStats) WriteAll(stats []ElasticSearchStats) }
func NewElasticSearchStatsStore ¶
func NewElasticSearchStatsStore() ElasticSearchStatsStore
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)
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 ¶
Returns a list of iservice names in sorted order
func (*Manager) Notify ¶
Notify() sends a notify() message to all the containers with the given data val
func (*Manager) SetConfigurationOption ¶
func (*Manager) SetVolumesDir ¶
SetVolumesDir sets the volumes dir for *Manager
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 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 ¶
func GetZooKeeperKeys ¶
func GetZooKeeperKeys() []ZooKeeperKey
type ZooKeeperStats ¶
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