megos

package module
Version: v0.0.0-...-e9ff1ca Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 9 Imported by: 10

README

megos

GoDoc Build Status Go Report Card Coverage Status

Go(lang) client library for accessing an Apache Mesos cluster.

Features

  • Determine the Mesos leader
  • Get the current state of every mesos node (master or slave)
  • Retrieve stdout and stderr of tasks
  • Covered with unit tests

Installation

It is go gettable

$ go get github.com/andygrunwald/megos

(optional) to run unit / example tests:

$ cd $GOPATH/src/github.com/andygrunwald/megos
$ go test -v ./...

API

Please have a look at the GoDoc documentation for a detailed API description.

Examples / use cases

A (small) list of usecases how this library can be used:

  • Determine the leader of a Mesos cluster
  • Get a list of all completed Mesos tasks
  • Get the stdout and stderr of a failed mesos task
  • Get the statistics and push it to a different backend

Further more a few examples how the API can be used and the code looks like.

Determine the leader node
node1, _ := url.Parse("http://192.168.1.120:5050/")
node2, _ := url.Parse("http://192.168.1.122:5050/")

mesos := megos.NewClient([]*url.URL{node1, node2}, nil)
leader, err := mesos.DetermineLeader()
if err != nil {
	panic(err)
}

fmt.Println(leader)
// Output:
// master@192.168.1.122:5050
Get the version of Mesos
node1, _ := url.Parse("http://192.168.1.120:5050/")
node2, _ := url.Parse("http://192.168.1.122:5050/")

mesos := megos.NewClient([]*url.URL{node1, node2}, nil)
state, err := mesos.GetStateFromCluster()
if err != nil {
	panic(err)
}

fmt.Printf("Mesos v%s", state.Version)
// Output:
// Mesos v0.26.0
Get stdout and stderr of a task

Get stdout and stderr from a task of the chronos framework. Error checks are dropped for simplicity.

node1, _ := url.Parse("http://192.168.1.120:5050/")
node2, _ := url.Parse("http://192.168.1.122:5050/")
mesos := megos.NewClient([]*url.URL{node1, node2}, nil)

frameworkPrefix := "chronos"
taskID := "ct:1444578480000:0:example-chronos-task:"

mesos.DetermineLeader()
state, _ := mesos.GetStateFromLeader()

framework, _ := mesos.GetFrameworkByPrefix(state.Frameworks, frameworkPrefix)
task, _ := mesos.GetTaskByID(framework.CompletedTasks, taskID)

slave, _ := mesos.GetSlaveByID(state.Slaves, task.SlaveID)

pid, _ := mesos.ParsePidInformation(slave.PID)
slaveState, _ := mesos.GetStateFromPid(pid)

framework, _ = mesos.GetFrameworkByPrefix(slaveState.CompletedFrameworks, frameworkPrefix)
executor, _ := mesos.GetExecutorByID(framework.CompletedExecutors, taskID)

stdOut, _ := mesos.GetStdOutOfTask(pid, executor.Directory)
stdErr, _ := mesos.GetStdErrOfTask(pid, executor.Directory)

fmt.Println(string(stdOut))
fmt.Println("================")
fmt.Println(string(stdErr))
// Output:
// Registered executor on 192.168.1.123
// Starting task ct:1444578480000:0:example-chronos-task:
// sh -c 'MY COMMAND'
// Forked command at 10629
// ...
// ================
// I1011 17:48:00.390614 10602 exec.cpp:132] Version: 0.22.1
// I1011 17:48:00.532158 10618 exec.cpp:206] Executor registered on slave 20150603-103119-2046951690-5050-24382-S1

Version compatibility

This library was tested with Apache Mesos in version 0.26.0. In theory this should work with versions >= v0.25.x.

In version 0.25.x they renamed various API endpoints (like state.json to /state). See Upgrading Mesos - Upgrading from 0.24.x to 0.25.x for details. This is the reason why we support no lower versions of Mesos.

Other/Similar projects

  • boldfield/go-mesos: A client for discovering information about a Mesos exposed via HTTP API
  • antonlindstrom/mesos_stats: Statistics definition for Mesos /monitor/statistics.json
  • Clever/marathon-stats: A simple container which queries marathon and mesos for stats about their current state, and logs these stats to stderr
  • bolcom/mesos_metrics: Go definitions for the Mesos {master}:5050/metrics/snapshot and {slave}:5051/metrics/snapshot endpoints

Contribution

  • You have a question?
  • Don`t know if a feature is supported?
  • Want to implement a new feature, but don`t know how?
  • You like the library and use it for your implementation / use case?
  • You found a bug or incompatibility?
  • Something is not working as expected?

Feel free to open a new issue. I will be happy to answer them and try to help you. It might be useful to add as much information as possible into the issue like Mesos version, example URL, (parts) of your code and the expected and current behaviour.

License

This project is released under the terms of the MIT license.

Documentation

Overview

Package megos provides a client library for accessing information of a Apache Mesos cluster.

Construct a new megos client, then use the various functions on the client to access different information of Mesos HTTP endpoints. For example to identify the leader node:

node1, _ := url.Parse("http://192.168.1.120:5050/")
node2, _ := url.Parse("http://192.168.1.122:5050/")

mesos := megos.NewClient([]*url.URL{node1, node2}, nil)
leader, err := mesos.DetermineLeader()
if err != nil {
panic(err)
}

fmt.Println(leader)
// Output:
// master@192.168.1.122:5050

More examples are available in the README.md on github: https://github.com/andygrunwald/megos

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendPath

func AppendPath(instance url.URL, path string) url.URL

Types

type Address

type Address struct {
	Hostname string `json:"hostname"`
	IP       string `json:"ip"`
	Port     int    `json:"port"`
}

Address represents a single address. e.g. from a Slave or from a Master

type Client

type Client struct {
	sync.Mutex

	// Master is the list of Mesos master nodes in the cluster.
	Master []*url.URL
	// Leader is the PID reference to the Leader of the Cluster (of Master URLs)
	Leader          *Pid
	State           *State
	System          *System
	MetricsSnapshot *MetricsSnapshot
	HTTP            HTTPClient
}

Client manages the communication with the Mesos cluster.

func NewClient

func NewClient(addresses []*url.URL, httpClient HTTPClient) *Client

NewClient returns a new Megos / Mesos information client. addresses has to be the the URL`s of the single nodes of the Mesos cluster. It is recommended to apply all nodes in case of failures.

func (*Client) DetermineLeader

func (c *Client) DetermineLeader() (*Pid, error)

DetermineLeader will return the leader of several master nodes of the Mesos cluster. Only one leader is chosen per time. This leader will be returned.

func (*Client) GetBodyOfHTTPResponse

func (c *Client) GetBodyOfHTTPResponse(u *url.URL) ([]byte, error)

GetBodyOfHTTPResponse will return the request body of the requested url u.

func (*Client) GetExecutorByID

func (c *Client) GetExecutorByID(executor []Executor, executorID string) (*Executor, error)

GetExecutorByID will return an Executor by its unique ID.

The list of executors are provided by a framework.

func (*Client) GetFrameworkByPrefix

func (c *Client) GetFrameworkByPrefix(frameworks []Framework, prefix string) (*Framework, error)

GetFrameworkByPrefix will return a framework that matches prefix.

The list of framework are provided by a state of a slave / master.

func (*Client) GetHTTPResponse

func (c *Client) GetHTTPResponse(u *url.URL) (*http.Response, error)

GetHTTPResponse will return a http.Response from a URL

func (*Client) GetHTTPResponseFromCluster

func (c *Client) GetHTTPResponseFromCluster(f func(url.URL) url.URL) (*http.Response, error)

GetHTTPResponseFromCluster will return a http.Response from one of the Mesos master nodes. In a cluster the master nodes can be online or offline. With GetHTTPResponseFromCluster you will receive a response from one of the nodes.

func (*Client) GetHTTPResponseFromLeader

func (c *Client) GetHTTPResponseFromLeader(f func(Pid) url.URL) (*http.Response, error)

GetHTTPResponseFromLeader will return a http.Response from the determined leader of the master nodes.

func (*Client) GetMetricsSnapshot

func (c *Client) GetMetricsSnapshot(pid *Pid) (*MetricsSnapshot, error)

GetMetricsSnapshot will return the snapshot of pid

func (*Client) GetSlaveByID

func (c *Client) GetSlaveByID(slaves []Slave, slaveID string) (*Slave, error)

GetSlaveByID will return a a slave by its unique ID (slaveID).

The list of slaves are provided by a state of a single node.

func (*Client) GetSlavesFromCluster

func (c *Client) GetSlavesFromCluster() (*State, error)

GetSlavesFromCluster will return the current slaves of one of the cluster nodes.

func (*Client) GetSlavesFromLeader

func (c *Client) GetSlavesFromLeader() (*State, error)

GetSlavesFromLeader will return the current slaves of the leader node of the cluster.

func (*Client) GetSlavesFromPid

func (c *Client) GetSlavesFromPid(pid *Pid) (*State, error)

GetSlavesFromPid will return the current slaves of the process id per machine (PID).

func (*Client) GetStateFromCluster

func (c *Client) GetStateFromCluster() (*State, error)

GetStateFromCluster will return the current state of one of the cluster nodes.

func (*Client) GetStateFromLeader

func (c *Client) GetStateFromLeader() (*State, error)

GetStateFromLeader will return the current state of the leader node of the cluster.

func (*Client) GetStateFromPid

func (c *Client) GetStateFromPid(pid *Pid) (*State, error)

GetStateFromPid will return the current state of the process id per machine (PID).

func (*Client) GetStateSummaryFromCluster

func (c *Client) GetStateSummaryFromCluster() (*State, error)

GetStateSummaryFromCluster will return the current state summary of one of the cluster nodes.

func (*Client) GetStateSummaryFromLeader

func (c *Client) GetStateSummaryFromLeader() (*State, error)

GetStateSummaryFromLeader will return the current state summary of the leader node of the cluster.

func (*Client) GetStateSummaryFromPid

func (c *Client) GetStateSummaryFromPid(pid *Pid) (*State, error)

GetStateSummaryFromPid will return the current state summary of the process id per machine (PID).

func (*Client) GetStdErrOfTask

func (c *Client) GetStdErrOfTask(pid *Pid, directory string) ([]byte, error)

GetStdErrOfTask will return Stdout of a task.

pid is a single mesos slave node. directory is the directory of a single executor,

func (*Client) GetStdOutOfTask

func (c *Client) GetStdOutOfTask(pid *Pid, directory string) ([]byte, error)

GetStdOutOfTask will return Stdout of a task.

pid is a single mesos slave node. directory is the directory of a single executor,

func (*Client) GetSystemFromPid

func (c *Client) GetSystemFromPid(pid *Pid) (*System, error)

GetSystemFromPid will return the system stats of node

func (*Client) GetTaskByID

func (c *Client) GetTaskByID(tasks []Task, taskID string) (*Task, error)

GetTaskByID will return a Task by its unique ID.

The list of tasks are provided by a framework.

func (*Client) GetURLForMetricsSnapshotPid

func (c *Client) GetURLForMetricsSnapshotPid(pid Pid) url.URL

GetURLForMetricsSnapshotPid will return the URL for the snapshot based on a PID

func (*Client) GetURLForSlavesFile

func (c *Client) GetURLForSlavesFile(instance url.URL) url.URL

GetURLForSlavesFile will return the URL for the slaves file of a node

func (*Client) GetURLForSlavesFilePid

func (c *Client) GetURLForSlavesFilePid(pid Pid) url.URL

GetURLForSlavesFilePid will return the URL for the slaves file of a node based on a PID

func (*Client) GetURLForStateFile

func (c *Client) GetURLForStateFile(instance url.URL) url.URL

GetURLForStateFile will return the URL for the state file of a node

func (*Client) GetURLForStateFilePid

func (c *Client) GetURLForStateFilePid(pid Pid) url.URL

GetURLForStateFilePid will return the URL for the state file of a node based on a PID

func (*Client) GetURLForStateSummaryFile

func (c *Client) GetURLForStateSummaryFile(instance url.URL) url.URL

GetURLForStateSummaryFile will return the URL for the state-summary file of a node

func (*Client) GetURLForStateSummaryFilePid

func (c *Client) GetURLForStateSummaryFilePid(pid Pid) url.URL

GetURLForStateSummaryFilePid will return the URL for the state-summary file of a node based on a PID

func (*Client) GetURLForSystemFilePid

func (c *Client) GetURLForSystemFilePid(pid Pid) url.URL

GetURLForSystemFilePid will return the URL for the system stats of a node based on a PID

func (*Client) ParsePidInformation

func (c *Client) ParsePidInformation(pid string) (*Pid, error)

ParsePidInformation will split up a single PID of format node@ip:port into a Pid structure to access single parts of the PID on its own.

Example pid: master@10.1.1.12:5050

type Container

type Container struct {
	Type   string `json:"type"`
	Docker Docker `json:"docker,omitempty"`
}

Container represents one way a Mesos task can be ran

type ContainerStatus

type ContainerStatus struct {
	NetworkInfos []NetworkInfo `json:"network_infos"`
}

ContainerStatus represents the status of a single container inside a task

type Docker

type Docker struct {
	Image          string        `json:"image"`
	Network        string        `json:"network"`
	PortMappings   []PortMapping `json:"port_mappings"`
	Priviledge     bool          `json:"priviledge"`
	Parameters     []Parameter   `json:"parameters"`
	ForcePullImage bool          `json:"force_pull_image"`
}

Docker is one type of Container

type Executor

type Executor struct {
	CompletedTasks []Task    `json:"completed_tasks"`
	Container      string    `json:"container"`
	Directory      string    `json:"directory"`
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Resources      Resources `json:"resources"`
	Source         string    `json:"source"`
	QueuedTasks    []Task    `json:"queued_tasks"`
	Tasks          []Task    `json:"tasks"`
}

Executor represents a single executor of a framework

type Flags

type Flags struct {
	AppcStoreDir                     string `json:"appc_store_dir"`
	AllocationInterval               string `json:"allocation_interval"`
	Allocator                        string `json:"allocator"`
	Authenticate                     string `json:"authenticate"`
	AuthenticateHTTP                 string `json:"authenticate_http"`
	Authenticatee                    string `json:"authenticatee"`
	AuthenticateSlaves               string `json:"authenticate_slaves"`
	Authenticators                   string `json:"authenticators"`
	Authorizers                      string `json:"authorizers"`
	CgroupsCPUEnablePIDsAndTIDsCount string `json:"cgroups_cpu_enable_pids_and_tids_count"`
	CgroupsEnableCfs                 string `json:"cgroups_enable_cfs"`
	CgroupsHierarchy                 string `json:"cgroups_hierarchy"`
	CgroupsLimitSwap                 string `json:"cgroups_limit_swap"`
	CgroupsRoot                      string `json:"cgroups_root"`
	Cluster                          string `json:"cluster"`
	ContainerDiskWatchInterval       string `json:"container_disk_watch_interval"`
	Containerizers                   string `json:"containerizers"`
	DefaultRole                      string `json:"default_role"`
	DiskWatchInterval                string `json:"disk_watch_interval"`
	Docker                           string `json:"docker"`
	DockerKillOrphans                string `json:"docker_kill_orphans"`
	DockerRegistry                   string `json:"docker_registry"`
	DockerRemoveDelay                string `json:"docker_remove_delay"`
	DockerSandboxDirectory           string `json:"docker_sandbox_directory"`
	DockerSocket                     string `json:"docker_socket"`
	DockerStoreDir                   string `json:"docker_store_dir"`
	DockerStopTimeout                string `json:"docker_stop_timeout"`
	EnforceContainerDiskQuota        string `json:"enforce_container_disk_quota"`
	ExecutorRegistrationTimeout      string `json:"executor_registration_timeout"`
	ExecutorShutdownGracePeriod      string `json:"executor_shutdown_grace_period"`
	FetcherCacheDir                  string `json:"fetcher_cache_dir"`
	FetcherCacheSize                 string `json:"fetcher_cache_size"`
	FrameworksHome                   string `json:"frameworks_home"`
	FrameworkSorter                  string `json:"framework_sorter"`
	GCDelay                          string `json:"gc_delay"`
	GCDiskHeadroom                   string `json:"gc_disk_headroom"`
	HadoopHome                       string `json:"hadoop_home"`
	Help                             string `json:"help"`
	Hostname                         string `json:"hostname"`
	HostnameLookup                   string `json:"hostname_lookup"`
	HTTPAuthenticators               string `json:"http_authenticators"`
	ImageProvisionerBackend          string `json:"image_provisioner_backend"`
	InitializeDriverLogging          string `json:"initialize_driver_logging"`
	IP                               string `json:"ip"`
	Isolation                        string `json:"isolation"`
	LauncherDir                      string `json:"launcher_dir"`
	LogAutoInitialize                string `json:"log_auto_initialize"`
	LogDir                           string `json:"log_dir"`
	Logbufsecs                       string `json:"logbufsecs"`
	LoggingLevel                     string `json:"logging_level"`
	MaxCompletedFrameworks           string `json:"max_completed_frameworks"`
	MaxCompletedTasksPerFramework    string `json:"max_completed_tasks_per_framework"`
	MaxSlavePingTimeouts             string `json:"max_slave_ping_timeouts"`
	Master                           string `json:"master"`
	PerfDuration                     string `json:"perf_duration"`
	PerfInterval                     string `json:"perf_interval"`
	Port                             string `json:"port"`
	Quiet                            string `json:"quiet"`
	Quorum                           string `json:"quorum"`
	QOSCorrectionIntervalMin         string `json:"qos_correction_interval_min"`
	Recover                          string `json:"recover"`
	RevocableCPULowPriority          string `json:"revocable_cpu_low_priority"`
	RecoverySlaveRemovalLimit        string `json:"recovery_slave_removal_limit"`
	RecoveryTimeout                  string `json:"recovery_timeout"`
	RegistrationBackoffFactor        string `json:"registration_backoff_factor"`
	Registry                         string `json:"registry"`
	RegistryFetchTimeout             string `json:"registry_fetch_timeout"`
	RegistryStoreTimeout             string `json:"registry_store_timeout"`
	RegistryStrict                   string `json:"registry_strict"`
	ResourceMonitoringInterval       string `json:"resource_monitoring_interval"`
	RootSubmissions                  string `json:"root_submissions"`
	SandboxDirectory                 string `json:"sandbox_directory"`
	SlavePingTimeout                 string `json:"slave_ping_timeout"`
	SlaveReregisterTimeout           string `json:"slave_reregister_timeout"`
	Strict                           string `json:"strict"`
	SystemdRuntimeDirectory          string `json:"systemd_runtime_directory"`
	SwitchUser                       string `json:"switch_user"`
	OversubscribedResourcesInterval  string `json:"oversubscribed_resources_interval"`
	UserSorter                       string `json:"user_sorter"`
	Version                          string `json:"version"`
	WebuiDir                         string `json:"webui_dir"`
	WorkDir                          string `json:"work_dir"`
	ZK                               string `json:"zk"`
	ZKSessionTimeout                 string `json:"zk_session_timeout"`
}

Flags represents the flags of a mesos state

type Framework

type Framework struct {
	Active             bool       `json:"active"`
	Checkpoint         bool       `json:"checkpoint"`
	CompletedTasks     []Task     `json:"completed_tasks"`
	Executors          []Executor `json:"executors"`
	CompletedExecutors []Executor `json:"completed_executors"`
	FailoverTimeout    float64    `json:"failover_timeout"`
	Hostname           string     `json:"hostname"`
	ID                 string     `json:"id"`
	Name               string     `json:"name"`
	PID                string     `json:"pid"`
	OfferedResources   Resources  `json:"offered_resources"`
	Offers             []Offer    `json:"offers"`
	RegisteredTime     float64    `json:"registered_time"`
	ReregisteredTime   float64    `json:"reregistered_time"`
	Resources          Resources  `json:"resources"`
	Role               string     `json:"role"`
	Tasks              []Task     `json:"tasks"`
	UnregisteredTime   float64    `json:"unregistered_time"`
	UsedResources      Resources  `json:"used_resources"`
	User               string     `json:"user"`
	WebuiURL           string     `json:"webui_url"`
	Labels             []Label    `json:"label"`
}

Framework represent a single framework of a mesos node

type HTTPClient

type HTTPClient interface {
	Get(url string) (res *http.Response, err error)
}

HTTPClient allows the client to be changed to any valid client.

type IpAddress

type IpAddress struct {
	IpAddress string `json:"ip_address"`
}

IpAddress represents a single IpAddress

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Label represents a single key / value pair for labeling

type MetricsSnapshot

type MetricsSnapshot struct {
	AllocatorEventQueueDispatches                          float64 `json:"allocator/event_queue_dispatches"`
	AllocatorMesosAllocationRunMs                          float64 `json:"allocator/mesos/allocation_run_ms"`
	AllocatorMesosAllocationRunMsCount                     float64 `json:"allocator/mesos/allocation_run_ms/count"`
	AllocatorMesosAllocationRunMsMax                       float64 `json:"allocator/mesos/allocation_run_ms/max"`
	AllocatorMesosAllocationRunMsMin                       float64 `json:"allocator/mesos/allocation_run_ms/min"`
	AllocatorMesosAllocationRunMsP50                       float64 `json:"allocator/mesos/allocation_run_ms/p50"`
	AllocatorMesosAllocationRunMsP90                       float64 `json:"allocator/mesos/allocation_run_ms/p90"`
	AllocatorMesosAllocationRunMsP95                       float64 `json:"allocator/mesos/allocation_run_ms/p95"`
	AllocatorMesosAllocationRunMsP99                       float64 `json:"allocator/mesos/allocation_run_ms/p99"`
	AllocatorMesosAllocationRunMsP999                      float64 `json:"allocator/mesos/allocation_run_ms/p999"`
	AllocatorMesosAllocationRunMsP9999                     float64 `json:"allocator/mesos/allocation_run_ms/p9999"`
	AllocatorMesosAllocationRuns                           float64 `json:"allocator/mesos/allocation_runs"`
	AllocatorMesosEventQueueDispatches                     float64 `json:"allocator/mesos/event_queue_dispatches"`
	AllocatorMesosOfferFiltersRolesActive                  float64 `json:"allocator/mesos/offer_filters/roles/*/active"`
	AllocatorMesosResourcesCpusOfferedorAllocated          float64 `json:"allocator/mesos/resources/cpus/offered_or_allocated"`
	AllocatorMesosResourcesCpusTotal                       float64 `json:"allocator/mesos/resources/cpus/total"`
	AllocatorMesosResourcesDiskOfferedorAllocated          float64 `json:"allocator/mesos/resources/disk/offered_or_allocated"`
	AllocatorMesosResourcesDiskTotal                       float64 `json:"allocator/mesos/resources/disk/total"`
	AllocatorMesosResourcesMemOfferedorAllocated           float64 `json:"allocator/mesos/resources/mem/offered_or_allocated"`
	AllocatorMesosResourcesMemTotal                        float64 `json:"allocator/mesos/resources/mem/total"`
	AllocatorMesosRolesSharesDominant                      float64 `json:"allocator/mesos/roles/*/shares/dominant"`
	MasterCpusPercent                                      float64 `json:"master/cpus_percent"`
	MasterCpusRevocablePercent                             float64 `json:"master/cpus_revocable_percent"`
	MasterCpusRevocableTotal                               float64 `json:"master/cpus_revocable_total"`
	MasterCpusRevocableUsed                                float64 `json:"master/cpus_revocable_used"`
	MasterCpusTotal                                        float64 `json:"master/cpus_total"`
	MasterCpusUsed                                         float64 `json:"master/cpus_used"`
	MasterDiskPercent                                      float64 `json:"master/disk_percent"`
	MasterDiskRevocablePercent                             float64 `json:"master/disk_revocable_percent"`
	MasterDiskRevocableTotal                               float64 `json:"master/disk_revocable_total"`
	MasterDiskRevocableUsed                                float64 `json:"master/disk_revocable_used"`
	MasterDiskTotal                                        float64 `json:"master/disk_total"`
	MasterDiskUsed                                         float64 `json:"master/disk_used"`
	MasterDroppedMessages                                  float64 `json:"master/dropped_messages"`
	MasterElected                                          float64 `json:"master/elected"`
	MasterEventQueueDispatches                             float64 `json:"master/event_queue_dispatches"`
	MasterEventQueueHttpRequests                           float64 `json:"master/event_queue_http_requests"`
	MasterEventQueueMessages                               float64 `json:"master/event_queue_messages"`
	MasterFrameworksActive                                 float64 `json:"master/frameworks_active"`
	MasterFrameworksConnected                              float64 `json:"master/frameworks_connected"`
	MasterFrameworksDisconnected                           float64 `json:"master/frameworks_disconnected"`
	MasterFrameworksInactive                               float64 `json:"master/frameworks_inactive"`
	MasterGpusPercent                                      float64 `json:"master/gpus_percent"`
	MasterGpusRevocablePercent                             float64 `json:"master/gpus_revocable_percent"`
	MasterGpusRevocableTotal                               float64 `json:"master/gpus_revocable_total"`
	MasterGpusRevocableUsed                                float64 `json:"master/gpus_revocable_used"`
	MasterGpusTotal                                        float64 `json:"master/gpus_total"`
	MasterGpusUsed                                         float64 `json:"master/gpus_used"`
	MasterInvalidExecutortoFrameworkMessages               float64 `json:"master/invalid_executor_to_framework_messages"`
	MasterInvalidFrameworktoExecutorMessages               float64 `json:"master/invalid_framework_to_executor_messages"`
	MasterInvalidStatusUpdateAcknowledgements              float64 `json:"master/invalid_status_update_acknowledgements"`
	MasterInvalidStatusUpdates                             float64 `json:"master/invalid_status_updates"`
	MasterMemPercent                                       float64 `json:"master/mem_percent"`
	MasterMemRevocablePercent                              float64 `json:"master/mem_revocable_percent"`
	MasterMemRevocableTotal                                float64 `json:"master/mem_revocable_total"`
	MasterMemRevocableUsed                                 float64 `json:"master/mem_revocable_used"`
	MasterMemTotal                                         float64 `json:"master/mem_total"`
	MasterMemUsed                                          float64 `json:"master/mem_used"`
	MasterMessagesAuthenticate                             float64 `json:"master/messages_authenticate"`
	MasterMessagesDeactivateFramework                      float64 `json:"master/messages_deactivate_framework"`
	MasterMessagesDeclineOffers                            float64 `json:"master/messages_decline_offers"`
	MasterMessagesExecutortoFramework                      float64 `json:"master/messages_executor_to_framework"`
	MasterMessagesExitedExecutor                           float64 `json:"master/messages_exited_executor"`
	MasterMessagesFrameworkToExecutor                      float64 `json:"master/messages_framework_to_executor"`
	MasterMessagesKillTask                                 float64 `json:"master/messages_kill_task"`
	MasterMessagesLaunchTasks                              float64 `json:"master/messages_launch_tasks"`
	MasterMessagesReconcileTasks                           float64 `json:"master/messages_reconcile_tasks"`
	MasterMessagesRegisterFramework                        float64 `json:"master/messages_register_framework"`
	MasterMessagesRegisterSlave                            float64 `json:"master/messages_register_slave"`
	MasterMessagesReregisterFramework                      float64 `json:"master/messages_reregister_framework"`
	MasterMessagesReregisterSlave                          float64 `json:"master/messages_reregister_slave"`
	MasterMessagesResourceRequest                          float64 `json:"master/messages_resource_request"`
	MasterMessagesReviveOffers                             float64 `json:"master/messages_revive_offers"`
	MasterMessagesStatusUpdate                             float64 `json:"master/messages_status_update"`
	MasterMessagesStatusUpdateAcknowledgement              float64 `json:"master/messages_status_update_acknowledgement"`
	MasterMessagesSuppressOffers                           float64 `json:"master/messages_suppress_offers"`
	MasterMessagesUnregisterFramework                      float64 `json:"master/messages_unregister_framework"`
	MasterMessagesUnregisterSlave                          float64 `json:"master/messages_unregister_slave"`
	MasterMessagesUpdateSlave                              float64 `json:"master/messages_update_slave"`
	MasterOutstandingOffers                                float64 `json:"master/outstanding_offers"`
	MasterRecoverySlaveRemovals                            float64 `json:"master/recovery_slave_removals"`
	MasterSlaveRegistrations                               float64 `json:"master/slave_registrations"`
	MasterSlaveRemovals                                    float64 `json:"master/slave_removals"`
	MasterSlaveRemovalsReasonRegistered                    float64 `json:"master/slave_removals/reason_registered"`
	MasterSlaveRemovalsReasonUnhealthy                     float64 `json:"master/slave_removals/reason_unhealthy"`
	MasterSlaveRemovalsReasonUnregistered                  float64 `json:"master/slave_removals/reason_unregistered"`
	MasterSlaveReregistrations                             float64 `json:"master/slave_reregistrations"`
	MasterSlaveShutdownsCanceled                           float64 `json:"master/slave_shutdowns_canceled"`
	MasterSlaveShutdownsCompleted                          float64 `json:"master/slave_shutdowns_completed"`
	MasterSlaveShutdownsScheduled                          float64 `json:"master/slave_shutdowns_scheduled"`
	MasterSlavesActive                                     float64 `json:"master/slaves_active"`
	MasterSlavesConnected                                  float64 `json:"master/slaves_connected"`
	MasterSlavesDisconnected                               float64 `json:"master/slaves_disconnected"`
	MasterSlavesInactive                                   float64 `json:"master/slaves_inactive"`
	MasterTaskFailedSourceSlaveReasonContainerLaunchFailed float64 `json:"master/task_failed/source_slave/reason_container_launch_failed"`
	MasterTaskKilledSourceSlaveReasonExecutorUnregistered  float64 `json:"master/task_killed/source_slave/reason_executor_unregistered"`
	MasterTasksError                                       float64 `json:"master/tasks_error"`
	MasterTasksFailed                                      float64 `json:"master/tasks_failed"`
	MasterTasksFinished                                    float64 `json:"master/tasks_finished"`
	MasterTasksKilled                                      float64 `json:"master/tasks_killed"`
	MasterTasksKilling                                     float64 `json:"master/tasks_killing"`
	MasterTasksLost                                        float64 `json:"master/tasks_lost"`
	MasterTasksRunning                                     float64 `json:"master/tasks_running"`
	MasterTasksStaging                                     float64 `json:"master/tasks_staging"`
	MasterTasksStarting                                    float64 `json:"master/tasks_starting"`
	MasterUptimeSecs                                       float64 `json:"master/uptime_secs"`
	MasterValidExecutortoFrameworkMessages                 float64 `json:"master/valid_executor_to_framework_messages"`
	MasterValidFrameworktoExecutorMessages                 float64 `json:"master/valid_framework_to_executor_messages"`
	MasterValidStatusUpdateAcknowledgements                float64 `json:"master/valid_status_update_acknowledgements"`
	MasterValidStatusUpdates                               float64 `json:"master/valid_status_updates"`
	RegistrarLogRecovered                                  float64 `json:"registrar/log/recovered"`
	RegistrarQueuedOperations                              float64 `json:"registrar/queued_operations"`
	RegistrarRegistrySizeBytes                             float64 `json:"registrar/registry_size_bytes"`
	RegistrarStateFetchMs                                  float64 `json:"registrar/state_fetch_ms"`
	RegistrarStateStoreMs                                  float64 `json:"registrar/state_store_ms"`
	RegistrarStateStoreMsCount                             float64 `json:"registrar/state_store_ms/count"`
	RegistrarStateStoreMsMax                               float64 `json:"registrar/state_store_ms/max"`
	RegistrarStateStoreMsMin                               float64 `json:"registrar/state_store_ms/min"`
	RegistrarStateStoreMsP50                               float64 `json:"registrar/state_store_ms/p50"`
	RegistrarStateStoreMsP90                               float64 `json:"registrar/state_store_ms/p90"`
	RegistrarStateStoreMsP95                               float64 `json:"registrar/state_store_ms/p95"`
	RegistrarStateStoreMsP99                               float64 `json:"registrar/state_store_ms/p99"`
	RegistrarStateStoreMsP999                              float64 `json:"registrar/state_store_ms/p999"`
	RegistrarStateStoreMsP9999                             float64 `json:"registrar/state_store_ms/p9999"`
	SystemCpusTotal                                        float64 `json:"system/cpus_total"`
	SystemLoad15min                                        float64 `json:"system/load_15min"`
	SystemLoad1min                                         float64 `json:"system/load_1min"`
	SystemLoad5min                                         float64 `json:"system/load_5min"`
	SystemMemFreeBytes                                     float64 `json:"system/mem_free_bytes"`
	SystemMemTotalBytes                                    float64 `json:"system/mem_total_bytes"`
}

MetricsSnapshot represents the metrics of a node

type NetworkInfo

type NetworkInfo struct {
	IpAddress   string      `json:"ip_address"`
	IpAddresses []IpAddress `json:"ip_addresses"`
}

NetworkInfo represents information about the network of a container

type Offer

type Offer struct {
	ID          string            `json:"id"`
	FrameworkID string            `json:"framework_id"`
	SlaveID     string            `json:"slave_id"`
	Hostname    string            `json:"hostname"`
	URL         URL               `json:"url"`
	Resources   Resources         `json:"resources"`
	Attributes  map[string]string `json:"attributes"`
}

Offer represents a single offer from a Mesos Slave to a Mesos master

type Parameter

type Parameter struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Parameter represents a single key / value pair for parameters

type Pid

type Pid struct {
	// Role of a PID
	Role string
	// Host / IP of the PID
	Host string
	// Port of the PID.
	// If no Port is available the standard port (5050) will be used.
	Port int
}

Pid is the process if per machine.

func (*Pid) String

func (p *Pid) String() string

String implements the Stringer interface for PID. It can be named as the opposite of Client.ParsePidInformation, because it transfers a single Pid structure into its original form with format node@ip:port.

type PortDetails

type PortDetails struct {
	Number   int    `json:"number"`
	Protocol string `json:"protocol"`
}

PortDetails represents details about a single port

type PortMapping

type PortMapping struct {
	HostPort      int    `json:"host_port"`
	ContainerPort int    `json:"container_port"`
	Protocol      string `json:"protocol"`
}

PortMapping represents how containers ports map to host ports

type Ports

type Ports struct {
	Ports []PortDetails `json:"ports"`
}

Ports represents a number of PortDetails

type Resources

type Resources struct {
	CPUs  float64 `json:"cpus"`
	Disk  float64 `json:"disk"`
	Mem   float64 `json:"mem"`
	Ports string  `json:"ports"`
}

Resources represents a resource type for a task

type Slave

type Slave struct {
	Active              bool                   `json:"active"`
	Hostname            string                 `json:"hostname"`
	ID                  string                 `json:"id"`
	PID                 string                 `json:"pid"`
	RegisteredTime      float64                `json:"registered_time"`
	Resources           Resources              `json:"resources"`
	UsedResources       Resources              `json:"used_resources"`
	OfferedResources    Resources              `json:"offered_resources"`
	ReservedResources   map[string]Resources   `json:"reserved_resources"`
	UnreservedResources Resources              `json:"unreserved_resources"`
	Attributes          map[string]interface{} `json:"attributes"`
	Version             string                 `json:"version"`
}

Slave represents a single mesos slave node

type State

type State struct {
	Version                string      `json:"version"`
	GitSHA                 string      `json:"git_sha"`
	GitTag                 string      `json:"git_tag"`
	BuildDate              string      `json:"build_date"`
	BuildTime              float64     `json:"build_time"`
	BuildUser              string      `json:"build_user"`
	StartTime              float64     `json:"start_time"`
	ElectedTime            float64     `json:"elected_time"`
	ID                     string      `json:"id"`
	PID                    string      `json:"pid"`
	Hostname               string      `json:"hostname"`
	ActivatedSlaves        float64     `json:"activated_slaves"`
	DeactivatedSlaves      float64     `json:"deactivated_slaves"`
	Cluster                string      `json:"cluster"`
	Leader                 string      `json:"leader"`
	CompletedFrameworks    []Framework `json:"completed_frameworks"`
	OrphanTasks            []Task      `json:"orphan_tasks"`
	UnregisteredFrameworks []string    `json:"unregistered_frameworks"`
	Flags                  Flags       `json:"flags"`
	Slaves                 []Slave     `json:"slaves"`
	Frameworks             []Framework `json:"frameworks"`
	GitBranch              string      `json:"git_branch"`
	LogDir                 string      `json:"log_dir"`
	ExternalLogFile        string      `json:"external_log_file"`
}

State represents the JSON from the state.json of a mesos node

type System

type System struct {
	AvgLoad15min  float64 `json:"avg_load_15min"`
	AvgLoad1min   float64 `json:"avg_load_1min"`
	AvgLoad5min   float64 `json:"avg_load_5min"`
	CpusTotal     float64 `json:"cpus_total"`
	MemFreeBytes  float64 `json:"mem_free_bytes"`
	MemTotalBytes float64 `json:"mem_total_bytes"`
}

System represents a system stats of a node

type Task

type Task struct {
	// Missing fields
	// TODO: "labels": [],
	ExecutorID  string        `json:"executor_id"`
	FrameworkID string        `json:"framework_id"`
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Resources   Resources     `json:"resources"`
	SlaveID     string        `json:"slave_id"`
	State       string        `json:"state"`
	Statuses    []TaskStatus  `json:"statuses"`
	Discovery   TaskDiscovery `json:"discovery"`
	Container   Container     `json:"container"`
}

Task represent a single Mesos task

type TaskDiscovery

type TaskDiscovery struct {
	Visibility string `json:"visibility"`
	Name       string `json:"name"`
	Ports      Ports  `json:"ports"`
}

TaskDiscovery represents the dicovery information of a task

type TaskStatus

type TaskStatus struct {
	State           string          `json:"state"`
	Timestamp       float64         `json:"timestamp"`
	ContainerStatus ContainerStatus `json:"container_status"`
}

TaskStatus represents the status of a single task

type URL

type URL struct {
	Scheme     string      `json:"scheme"`
	Address    Address     `json:"address"`
	Path       string      `json:"path"`
	Parameters []Parameter `json:"parameters"`
}

URL represents a single URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL