beater

package
v0.0.0-...-4d7fba2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CLUSTER_HEALTH = "/_cluster/health"
View Source
const CLUSTER_STATS = "/_cluster/stats"
View Source
const GREEN = 2

GREEN cluster status

View Source
const NODE_IDS = "/_cat/nodes?full_id=true&h=id"
View Source
const NODE_STATS = "/_nodes/stats/process,jvm,os,fs,thread_pool,transport,http,breaker,script"
View Source
const RED = 0

RED cluster status

View Source
const UNKNOWN = -1

UNKNOWN cluster status

View Source
const YELLOW = 1

YELLOW cluster status

Variables

This section is empty.

Functions

func GetNumericalClusterStatus

func GetNumericalClusterStatus(s string) int64

func TrimSuffix

func TrimSuffix(s, suffix string) string

Types

type ClusterHealth

type ClusterHealth struct {
	Cluster_name                     string  `json:"cluster_name"`
	Status                           string  `json:"status"`
	Status_num                       int64   `json:"status_num"`
	Timed_out                        bool    `json:"timed_out"`
	Number_of_nodes                  uint64  `json:"number_of_nodes"`
	Number_of_data_nodes             uint64  `json:"number_of_data_nodes"`
	Active_primary_shards            uint64  `json:"active_primary_shards"`
	Active_shards                    uint64  `json:"active_shards"`
	Relocating_shards                uint64  `json:"relocating_shards"`
	Initializing_shards              uint64  `json:"intializing_shards"`
	Unassigned_shards                uint64  `json:"unassigned_shards"`
	Delayed_unassigned_shards        uint64  `json:"delayed_unassigned_shards"`
	Number_of_pending_tasks          uint64  `json:"number_of_pending_tasks"`
	Number_of_in_flight_fetch        uint64  `json:"number_of_in_flight_fetch"`
	Task_max_waiting_in_queue_millis uint64  `json:"task_max_waiting_in_queue_millis"`
	Active_shards_percent_as_number  float64 `json:"active_shards_percent_as_number"`
}

type ClusterStats

type ClusterStats struct {
	Timestamp    uint64 `json:"timestamp"`
	Cluster_name string `json:"cluster_name"`
	Status       string `json:"status"`
	Status_num   int64  `json:"status_num"`
	Indices      struct {
		Count  uint64 `json:"count"`
		Shards struct {
			Total       uint64  `json:"total"`
			Primaries   uint64  `json:"primaries"`
			Replication float64 `json:"replication"`
			Index       struct {
				Shards struct {
					Min float64 `json:"min"`
					Max float64 `json:"max"`
					Avg float64 `json:"avg"`
				}
				Primaries struct {
					Min float64 `json:"min"`
					Max float64 `json:"max"`
					Avg float64 `json:"avg"`
				}
				Replication struct {
					Min float64 `json:"min"`
					Max float64 `json:"max"`
					Avg float64 `json:"avg"`
				}
			}
		}
		Docs struct {
			Count   uint64 `json:"count"`
			Deleted uint64 `json:"deleted"`
		}
		Store struct {
			Size_in_bytes           uint64 `json:"size_in_bytes"`
			Throttle_time_in_millis uint64 `json:"throttle_time_in_millis"`
		}
		Fielddata struct {
			Memory_size_in_bytes int64  `json:"memory_size_in_bytes"`
			Evictions            uint64 `json:"evictions"`
		}
		Query_cache struct {
			Memory_size_in_bytes int64  `json:"memory_size_in_bytes"`
			Total_count          uint64 `json:"total_count"`
			Hit_count            uint64 `json:"hit_count"`
			Miss_count           uint64 `json:"miss_count"`
			Cache_size           uint64 `json:"cache_size"`
			Cache_count          uint64 `json:"cache_count"`
			Evictions            uint64 `json:"evictions"`
		}
		Completion struct {
			Size_in_bytes uint64 `json:"size_in_bytes"`
		}
		Segments struct {
			Count                            uint64 `json:"count"`
			Memory_in_bytes                  uint64 `json:"memory_in_bytes"`
			Terms_memory_in_bytes            uint64 `json:"terms_memory_in_bytes"`
			Stored_fields_memory_in_bytes    uint64 `json:"stored_fields_memory_in_bytes"`
			Term_vectors_memory_in_bytes     uint64 `json:"term_vectors_memory_in_bytes"`
			Norms_memory_in_bytes            uint64 `json:"norms_memory_in_bytes"`
			Doc_values_memory_in_bytes       uint64 `json:"doc_values_memory_in_bytes"`
			Index_writer_memory_in_bytes     uint64 `json:"index_writer_memory_in_bytes"`
			Index_writer_max_memory_in_bytes uint64 `json:"index_writer_max_memory_in_bytes"`
			Version_map_memory_in_bytes      uint64 `json:"version_map_memory_in_bytes"`
			Fixed_bit_set_memory_in_bytes    uint64 `json:"fixed_bit_set_memory_in_bytes"`
		}
		Percolate struct {
			Total                uint64 `json:"total"`
			Time_in_millis       uint64 `json:"time_in_millis"`
			Current              uint64 `json:"current"`
			Memory_size_in_bytes int64  `json:"memory_size_in_bytes"`
			Memory_size          string `json:"memory_size"` // TODO: check value
			Queries              uint64 `json:"queries"`
		}
	}
	Nodes struct {
		Count struct {
			Total       uint64 `json:"total"`
			Master_only uint64 `json:"master_only"`
			Data_only   uint64 `json:"data_only"`
			Master_data uint64 `json:"master_data"`
			Client      uint64 `json:"client"`
		}
		//Versions - not implemented
		Os struct {
			Available_processors uint64 `json:"available_processors"`
			Allocated_processors uint64 `json:"allocated_processors"`
			Mem                  struct {
				Total_in_bytes uint64 `json:"total_in_bytes"`
			}
		}
		Process struct {
			Cpu struct {
				Percent int64 `json:"percent"`
			}
			Open_file_descriptors struct {
				Min float64 `json:"min"`
				Max float64 `json:"max"`
				Avg float64 `json:"avg"`
			}
		}
		Jvm struct {
			Max_uptime_in_millis uint64 `json:"max_uptime_in_millis"`
			// Versions - not implemented
			Mem struct {
				Heap_used_in_bytes uint64 `json:"heap_used_in_bytes"`
				Heap_max_in_bytes  uint64 `json:"heap_max_in_bytes"`
			}
			Threads uint64 `json:"threads"`
		}
		Fs struct {
			Total_in_bytes     uint64 `json:"total_in_bytes"`
			Free_in_bytes      uint64 `json:"free_in_bytes"`
			Available_in_bytes uint64 `json:"available_in_bytes"`
			Spins              string `json:"spins"`
		}
	}
}

type ConfigSettings

type ConfigSettings struct {
	Input EsConfig
}

type Elasticbeat

type Elasticbeat struct {
	EbConfig ConfigSettings
	// contains filtered or unexported fields
}

func New

func New() *Elasticbeat

func (*Elasticbeat) Cleanup

func (eb *Elasticbeat) Cleanup(b *beat.Beat) error

func (*Elasticbeat) Config

func (eb *Elasticbeat) Config(b *beat.Beat) error

func (*Elasticbeat) GetCLusterHealth

func (eb *Elasticbeat) GetCLusterHealth(u url.URL) (ClusterHealth, error)

func (*Elasticbeat) GetCLusterStats

func (eb *Elasticbeat) GetCLusterStats(u url.URL) (ClusterStats, error)

func (*Elasticbeat) GetNodeIDs

func (eb *Elasticbeat) GetNodeIDs(u url.URL) ([]string, error)

func (*Elasticbeat) GetNodesStats

func (eb *Elasticbeat) GetNodesStats(u url.URL) ([]NodeStats, error)

func (*Elasticbeat) Run

func (eb *Elasticbeat) Run(b *beat.Beat) error

func (*Elasticbeat) Setup

func (eb *Elasticbeat) Setup(b *beat.Beat) error

func (*Elasticbeat) Stop

func (eb *Elasticbeat) Stop()

type EsConfig

type EsConfig struct {
	Period *int64

	URLs []string

	Stats struct {
		Nodes   *bool
		Cluster *bool
		Health  *bool
	}

	// Authentication for BasicAuth
	Authentication struct {
		Username *string
		Password *string
	}
}

type NodeStats

type NodeStats struct {
	Timestamp uint64 `json:"timestamp"`
	Name      string `json:"name"`
	// transport_address - not implemented
	Host string `json:"host"`
	//[]ip - not implemented
	Cluster_name string `json:"cluster_name"`
	Os           struct {
		Timestamp    uint64  `json:"timestamp"`
		Load_average float64 `json:"load_average"`
		Mem          struct {
			Total_in_bytes uint64 `json:"total_in_bytes"`
			Free_in_bytes  uint64 `json:"free_in_bytes"`
			Used_in_bytes  uint64 `json:"used_in_bytes"`
			Free_percent   uint64 `json:"free_percent"`
			Used_percent   uint64 `json:"used_percent"`
		}
		Swap struct {
			Total_in_bytes uint64 `json:"total_in_bytes"`
			Free_in_bytes  uint64 `json:"free_in_bytes"`
			Used_in_bytes  uint64 `json:"used_in_bytes"`
		}
	}
	Process struct {
		Timestamp             uint64 `json:"timestamp"`
		Open_file_descriptors int64  `json:"open_file_descriptors"`
		Max_file_descriptors  int64  `json:"max_file_descriptors"`
		Cpu                   struct {
			Percent         int64  `json:"percent"`
			Total_in_millis uint64 `json:"total_in_millis"`
		}
		Mem struct {
			Total_virtual_in_bytes uint64 `json:"total_virtual_in_bytes"`
		}
	}
	Jvm struct {
		Timestamp        uint64 `json:"timestamp"`
		Uptime_in_millis uint64 `json:"uptime_in_millis"`
		Mem              struct {
			Heap_used_in_bytes          uint64 `json:"heap_used_in_bytes"`
			Heap_used_percent           uint64 `json:"heap_used_percent"`
			Heap_committed_in_bytes     uint64 `json:"heap_committed_in_bytes"`
			Heap_max_in_bytes           uint64 `json:"heap_max_in_bytes"`
			Non_heap_used_in_bytes      uint64 `json:"non_heap_used_in_bytes"`
			Non_heap_committed_in_bytes uint64 `json:"non_heap_committed_in_bytes"`
			Pools                       struct {
				Young struct {
					Used_in_bytes      uint64 `json:"used_in_bytes"`
					Max_in_bytes       uint64 `json:"max_in_bytes"`
					Peak_used_in_bytes uint64 `json:"peak_used_in_bytes"`
					Peak_max_in_bytes  uint64 `json:"peak_max_in_bytes"`
				}
				Survivor struct {
					Used_in_bytes      uint64 `json:"used_in_bytes"`
					Max_in_bytes       uint64 `json:"max_in_bytes"`
					Peak_used_in_bytes uint64 `json:"peak_used_in_bytes"`
					Peak_max_in_bytes  uint64 `json:"peak_max_in_bytes"`
				}
				Old struct {
					Used_in_bytes      uint64 `json:"used_in_bytes"`
					Max_in_bytes       uint64 `json:"max_in_bytes"`
					Peak_used_in_bytes uint64 `json:"peak_used_in_bytes"`
					Peak_max_in_bytes  uint64 `json:"peak_max_in_bytes"`
				}
			}
		}
		Threads struct {
			Count      uint64 `json:"count"`
			Peak_count uint64 `json:"peak_count"`
		}
		Gc struct {
			Collectors struct {
				Young struct {
					Collection_count          uint64 `json:"collection_count"`
					Collection_time_in_millis uint64 `json:"collection_time_in_millis"`
				}
				Old struct {
					Collection_count          uint64 `json:"collection_count"`
					Collection_time_in_millis uint64 `json:"collection_time_in_millis"`
				}
			}
		}
		Buffer_pools struct {
			Direct struct {
				Count                   uint64 `json:"count"`
				Used_in_bytes           uint64 `json:"used_in_bytes"`
				Total_capacity_in_bytes uint64 `json:"total_capacity_in_bytes"`
			}
			Mapped struct {
				Count                   uint64 `json:"count"`
				Used_in_bytes           uint64 `json:"used_in_bytes"`
				Total_capacity_in_bytes uint64 `json:"total_capacity_in_bytes"`
			}
		}
	}
	Thread_pool struct {
		Bulk struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Fetch_shard_started struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Fetch_shard_store struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Flush struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Force_merge struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Generic struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Get struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Index struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Listener struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Management struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Percolate struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Refresh struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Search struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Snapshot struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Suggest struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
		Warmer struct {
			Threads   uint64 `json:"threads"`
			Queue     uint64 `json:"queue"`
			Active    uint64 `json:"active"`
			Rejected  uint64 `json:"rejected"`
			Largest   uint64 `json:"largest"`
			Completed uint64 `json:"completed"`
		}
	}
	Fs struct {
		Timestamp uint64 `json:"timestamp"`
		Total     struct {
			Total_in_bytes     uint64 `json:"total_in_bytes"`
			Free_in_bytes      uint64 `json:"free_in_bytes"`
			Available_in_bytes uint64 `json:"available_in_bytes"`
			Spins              string `json:"spins"`
		}
	}
	Transport struct {
		Server_open      uint64 `json:"server_open"`
		Rx_count         uint64 `json:"rx_count"`
		Rx_size_in_bytes uint64 `json:"rx_size_in_bytes"`
		Tx_count         uint64 `json:"tx_count"`
		Tx_size_in_bytes uint64 `json:"tx_size_in_bytes"`
	}
	Http struct {
		Current_open uint64 `json:"current_open"`
		Total_opened uint64 `json:"total_opened"`
	}
	Breakers struct {
		Request struct {
			Limit_size_in_bytes     uint64  `json:"limit_size_in_bytes"`
			Limit_size              string  `json:"limit_size"`
			Estimated_size_in_bytes uint64  `json:"estimated_size_in_bytes"`
			Estimated_size          string  `json:"estimated_size"`
			Overhead                float64 `json:"overhead"`
			Tripped                 uint64  `json:"tripped"`
		}
		Fielddata struct {
			Limit_size_in_bytes     uint64  `json:"limit_size_in_bytes"`
			Limit_size              string  `json:"limit_size"`
			Estimated_size_in_bytes uint64  `json:"estimated_size_in_bytes"`
			Estimated_size          string  `json:"estimated_size"`
			Overhead                float64 `json:"overhead"`
			Tripped                 uint64  `json:"tripped"`
		}
		Parent struct {
			Limit_size_in_bytes     uint64  `json:"limit_size_in_bytes"`
			Limit_size              string  `json:"limit_size"`
			Estimated_size_in_bytes uint64  `json:"estimated_size_in_bytes"`
			Estimated_size          string  `json:"estimated_size"`
			Overhead                float64 `json:"overhead"`
			Tripped                 uint64  `json:"tripped"`
		}
	}
	Script struct {
		Compilations    uint64 `json:"compilations"`
		Cache_evictions uint64 `json:"cache_evictions"`
	}
}

type NodesBody

type NodesBody struct {
	Cluster_name string          `json:"cluster_name"`
	Nodes        json.RawMessage `json:"nodes"`
}

Jump to

Keyboard shortcuts

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