mongodb

package
v0.0.0-...-54d14c8 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Always   = 1 << iota // always activate the column
	Discover             // only active when mongostat is in discover mode
	Repl                 // only active if one of the nodes being monitored is in a replset
	Locks                // only active if node is capable of calculating lock info
	AllOnly              // only active if mongostat was run with --all option
	MMAPOnly             // only active if node has mmap-specific fields
	WTOnly               // only active if node has wiredtiger-specific fields
)

Flags to determine cases when to activate/deactivate columns for output.

View Source
const (
	MongosProcess = "mongos"
)

Variables

View Source
var DefaultReplStats = map[string]string{
	"replica.inserts_per_sec":  "InsertR",
	"replica.queries_per_sec":  "QueryR",
	"replica.updates_per_sec":  "UpdateR",
	"replica.deletes_per_sec":  "DeleteR",
	"replica.getmores_per_sec": "GetMoreR",
	"replica.commands_per_sec": "CommandR",
}

DefaultReplStats - XXX

View Source
var DefaultStats = map[string]string{
	"operations.inserts_per_sec":  "Insert",
	"operations.queries_per_sec":  "Query",
	"operations.updates_per_sec":  "Update",
	"operations.deletes_per_sec":  "Delete",
	"operations.getmores_per_sec": "GetMore",
	"operations.commands_per_sec": "Command",
	"operations.flushes_per_sec":  "Flushes",
	"memory.vsize_megabytes":      "Virtual",
	"memory.resident_megabytes":   "Resident",
	"queued.reads":                "QueuedReaders",
	"queued.writes":               "QueuedWriters",
	"active.reads":                "ActiveReaders",
	"active.writes":               "ActiveWriters",
	"net.bytes_in":                "NetIn",
	"net.bytes_out":               "NetOut",
	"open_connections":            "NumConnections",
}

DefaultStats - XXX

View Source
var MmapStats = map[string]string{
	"mapped_megabytes":               "Mapped",
	"non-mapped_megabytes":           "NonMapped",
	"operations.page_faults_per_sec": "Faults",
}

MmapStats - XXX

View Source
var StatHeaders = []StatHeader{
	{"", Always},
	{"insert", Always},
	{"query", Always},
	{"update", Always},
	{"delete", Always},
	{"getmore", Always},
	{"command", Always},
	{"% dirty", WTOnly},
	{"% used", WTOnly},
	{"flushes", Always},
	{"mapped", MMAPOnly},
	{"vsize", Always},
	{"res", Always},
	{"non-mapped", MMAPOnly | AllOnly},
	{"faults", MMAPOnly},
	{"lr|lw %", MMAPOnly | AllOnly},
	{"lrt|lwt", MMAPOnly | AllOnly},
	{"    locked db", Locks},
	{"qr|qw", Always},
	{"ar|aw", Always},
	{"netIn", Always},
	{"netOut", Always},
	{"conn", Always},
	{"set", Repl},
	{"repl", Repl},
	{"time", Always},
}

StatHeaders are the complete set of data metrics supported by mongostat.

View Source
var WiredTigerStats = map[string]string{
	"percent_cache_dirty": "CacheDirtyPercent",
	"percent_cache_used":  "CacheUsedPercent",
}

WiredTigerStats - XXX

Functions

func CollectCollectionSize

func CollectCollectionSize(server *Server, perf *PerformanceStruct) error

CollectCollectionSize - XXX

func CollectGauges

func CollectGauges(server *Server, perf *PerformanceStruct) error

CollectGauges - XXX

func GetSession

func GetSession(server *Server) error

GetSession - XXX

Types

type CacheStats

type CacheStats struct {
	TrackedDirtyBytes  int64 `bson:"tracked dirty bytes in the cache"`
	CurrentCachedBytes int64 `bson:"bytes currently in the cache"`
	MaxBytesConfigured int64 `bson:"maximum bytes configured"`
}

CacheStats stores cache statistics for WiredTiger.

type ClientStats

type ClientStats struct {
	Total   int64 `bson:"total"`
	Readers int64 `bson:"readers"`
	Writers int64 `bson:"writers"`
}

ClientStats stores the number of active read/write operations.

type CollectionLockStatus

type CollectionLockStatus struct {
	ReadAcquireWaitsPercentage  float64
	WriteAcquireWaitsPercentage float64
	ReadAcquireTimeMicros       int64
	WriteAcquireTimeMicros      int64
}

CollectionLockStatus stores a collection's lock statistics.

type CollectionStats

type CollectionStats struct {
	Count          int64            `json:"number_of_documents"`
	Ns             string           `json:"ns"`
	AvgObjSize     int64            `json:"avgObjSize"`
	TotalIndexSize int64            `json:"total_index_size"`
	StorageSize    int64            `json:"storage_size"`
	IndexSizes     map[string]int64 `json:"index_sizes"`
	Size           int64            `json:"size"`
}

CollectionStats - XXX COLLECTION_ROWS = ['count','ns','avgObjSize', 'totalIndexSize', 'indexSizes', 'size']

type ConcurrentTransStats

type ConcurrentTransStats struct {
	Out int64 `bson:"out"`
}

type ConcurrentTransactions

type ConcurrentTransactions struct {
	Write ConcurrentTransStats `bson:"write"`
	Read  ConcurrentTransStats `bson:"read"`
}

type Config

type Config struct {
	URI string
}

Config - XXX

type ConnectionStats

type ConnectionStats struct {
	Current      int64 `bson:"current"`
	Available    int64 `bson:"available"`
	TotalCreated int64 `bson:"totalCreated"`
}

ConnectionStats stores information related to incoming database connections.

type DBRecordStats

type DBRecordStats struct {
	AccessesNotInMemory       int64                     `bson:"accessesNotInMemory"`
	PageFaultExceptionsThrown int64                     `bson:"pageFaultExceptionsThrown"`
	DBRecordAccesses          map[string]RecordAccesses `bson:",inline"`
}

DBRecordStats stores data related to memory operations across databases.

type DurStats

type DurStats struct {
	Commits            int64 `bson:"commits"`
	JournaledMB        int64 `bson:"journaledMB"`
	WriteToDataFilesMB int64 `bson:"writeToDataFilesMB"`
	Compression        int64 `bson:"compression"`
	CommitsInWriteLock int64 `bson:"commitsInWriteLock"`
	EarlyCommits       int64 `bson:"earlyCommits"`
	TimeMs             DurTiming
}

DurStats stores information related to journaling statistics.

type DurTiming

type DurTiming struct {
	Dt               int64 `bson:"dt"`
	PrepLogBuffer    int64 `bson:"prepLogBuffer"`
	WriteToJournal   int64 `bson:"writeToJournal"`
	WriteToDataFiles int64 `bson:"writeToDataFiles"`
	RemapPrivateView int64 `bson:"remapPrivateView"`
}

DurTiming stores information related to journaling.

type ExtraInfo

type ExtraInfo struct {
	PageFaults *int64 `bson:"page_faults"`
}

ExtraInfo stores additional platform specific information.

type FlushStats

type FlushStats struct {
	Flushes      int64     `bson:"flushes"`
	TotalMs      int64     `bson:"total_ms"`
	AverageMs    float64   `bson:"average_ms"`
	LastMs       int64     `bson:"last_ms"`
	LastFinished time.Time `bson:"last_finished"`
}

FlushStats stores information about memory flushes.

type GlobalLockStats

type GlobalLockStats struct {
	TotalTime     int64        `bson:"totalTime"`
	LockTime      int64        `bson:"lockTime"`
	CurrentQueue  *QueueStats  `bson:"currentQueue"`
	ActiveClients *ClientStats `bson:"activeClients"`
}

GlobalLockStats stores information related locks in the MMAP storage engine.

type LockStats

type LockStats struct {
	TimeLockedMicros    ReadWriteLockTimes `bson:"timeLockedMicros"`
	TimeAcquiringMicros ReadWriteLockTimes `bson:"timeAcquiringMicros"`

	// AcquireCount and AcquireWaitCount are new fields of the lock stats only populated on 3.0 or newer.
	// Typed as a pointer so that if it is nil, mongostat can assume the field is not populated
	// with real namespace data.
	AcquireCount     *ReadWriteLockTimes `bson:"acquireCount,omitempty"`
	AcquireWaitCount *ReadWriteLockTimes `bson:"acquireWaitCount,omitempty"`
}

LockStats stores information related to time spent acquiring/holding locks for a given database.

type LockStatus

type LockStatus struct {
	DBName     string
	Percentage float64
	Global     bool
}

LockStatus stores a database's lock statistics.

type LockUsage

type LockUsage struct {
	Namespace string
	Reads     int64
	Writes    int64
}

LockUsage stores information related to a namespace's lock usage.

type MemStats

type MemStats struct {
	Bits              int64       `bson:"bits"`
	Resident          int64       `bson:"resident"`
	Virtual           int64       `bson:"virtual"`
	Supported         interface{} `bson:"supported"`
	Mapped            int64       `bson:"mapped"`
	MappedWithJournal int64       `bson:"mappedWithJournal"`
}

MemStats stores data related to memory statistics.

type MongoDB

type MongoDB struct {
	Config Config
}

MongoDB - XXX

func (*MongoDB) Collect

func (m *MongoDB) Collect() (interface{}, error)

Collect - XXX

func (*MongoDB) Description

func (m *MongoDB) Description() string

Description - XXX

func (*MongoDB) SampleConfig

func (m *MongoDB) SampleConfig() string

SampleConfig - XXX

func (*MongoDB) SetConfigDefaults

func (m *MongoDB) SetConfigDefaults() error

SetConfigDefaults - XXX

func (*MongoDB) Start

func (m *MongoDB) Start() error

Start - XXX

func (*MongoDB) Stop

func (m *MongoDB) Stop()

Stop - XXX

type NamespacedLocks

type NamespacedLocks map[string]LockStatus

NamespacedLocks stores information on the LockStatus of namespaces.

type NetworkStats

type NetworkStats struct {
	BytesIn     int64 `bson:"bytesIn"`
	BytesOut    int64 `bson:"bytesOut"`
	NumRequests int64 `bson:"numRequests"`
}

NetworkStats stores information related to network traffic.

type OpcountStats

type OpcountStats struct {
	Insert  int64 `bson:"insert"`
	Query   int64 `bson:"query"`
	Update  int64 `bson:"update"`
	Delete  int64 `bson:"delete"`
	GetMore int64 `bson:"getmore"`
	Command int64 `bson:"command"`
}

OpcountStats stores information related to comamnds and basic CRUD operations.

type PerformanceStruct

type PerformanceStruct struct {
	TableSizeData   `json:"tables_size"`
	SlowQueriesData `json:"slow_queries"`
	Gauges          map[string]interface{} `json:"gauges"`
}

PerformanceStruct - XXX

func (PerformanceStruct) String

func (p PerformanceStruct) String() string

type QueueStats

type QueueStats struct {
	Total   int64 `bson:"total"`
	Readers int64 `bson:"readers"`
	Writers int64 `bson:"writers"`
}

QueueStats stores the number of queued read/write operations.

type ReadWriteLockTimes

type ReadWriteLockTimes struct {
	Read       int64 `bson:"R"`
	Write      int64 `bson:"W"`
	ReadLower  int64 `bson:"r"`
	WriteLower int64 `bson:"w"`
}

ReadWriteLockTimes stores time spent holding read/write locks.

type RecordAccesses

type RecordAccesses struct {
	AccessesNotInMemory       int64 `bson:"accessesNotInMemory"`
	PageFaultExceptionsThrown int64 `bson:"pageFaultExceptionsThrown"`
}

RecordAccesses stores data related to memory operations scoped to a database.

type ReplStatus

type ReplStatus struct {
	SetName      interface{} `bson:"setName"`
	IsMaster     interface{} `bson:"ismaster"`
	Secondary    interface{} `bson:"secondary"`
	IsReplicaSet interface{} `bson:"isreplicaset"`
	ArbiterOnly  interface{} `bson:"arbiterOnly"`
	Hosts        []string    `bson:"hosts"`
	Passives     []string    `bson:"passives"`
	Me           string      `bson:"me"`
}

ReplStatus stores data related to replica sets.

type Server

type Server struct {
	URL     *url.URL
	Session *mgo.Session
	// contains filtered or unexported fields
}

Server - XXX

type ServerStatus

type ServerStatus struct {
	SampleTime         time.Time              `bson:""`
	Host               string                 `bson:"host"`
	Version            string                 `bson:"version"`
	Process            string                 `bson:"process"`
	Pid                int64                  `bson:"pid"`
	Uptime             int64                  `bson:"uptime"`
	UptimeMillis       int64                  `bson:"uptimeMillis"`
	UptimeEstimate     int64                  `bson:"uptimeEstimate"`
	LocalTime          time.Time              `bson:"localTime"`
	Asserts            map[string]int64       `bson:"asserts"`
	BackgroundFlushing *FlushStats            `bson:"backgroundFlushing"`
	ExtraInfo          *ExtraInfo             `bson:"extra_info"`
	Connections        *ConnectionStats       `bson:"connections"`
	Dur                *DurStats              `bson:"dur"`
	GlobalLock         *GlobalLockStats       `bson:"globalLock"`
	Locks              map[string]LockStats   `bson:"locks,omitempty"`
	Network            *NetworkStats          `bson:"network"`
	Opcounters         *OpcountStats          `bson:"opcounters"`
	OpcountersRepl     *OpcountStats          `bson:"opcountersRepl"`
	RecordStats        *DBRecordStats         `bson:"recordStats"`
	Mem                *MemStats              `bson:"mem"`
	Repl               *ReplStatus            `bson:"repl"`
	ShardCursorType    map[string]interface{} `bson:"shardCursorType"`
	StorageEngine      map[string]string      `bson:"storageEngine"`
	WiredTiger         *WiredTiger            `bson:"wiredTiger"`
}

type SlowQueriesData

type SlowQueriesData struct {
	Headers []string      `json:"headers"`
	Data    []interface{} `json:"data"`
}

SlowQueriesData - XXX

type StatHeader

type StatHeader struct {
	// The text to appear in the column's header cell
	HeaderText string

	// Bitmask containing flags to determine if this header is active or not
	ActivateFlags int
}

StatHeader describes a single column for mongostat's terminal output, its formatting, and in which modes it should be displayed.

type StatLine

type StatLine struct {
	Key string
	// What storage engine is being used for the node with this stat line
	StorageEngine string

	Error    error
	IsMongos bool
	Host     string

	// The time at which this StatLine was generated.
	Time time.Time

	// The last time at which this StatLine was printed to output.
	LastPrinted time.Time

	// Opcounter fields
	Insert, Query, Update, Delete, GetMore, Command int64

	// Collection locks (3.0 mmap only)
	CollectionLocks *CollectionLockStatus

	// Cache utilization (wiredtiger only)
	CacheDirtyPercent float64
	CacheUsedPercent  float64

	// Replicated Opcounter fields
	InsertR, QueryR, UpdateR, DeleteR, GetMoreR, CommandR int64
	Flushes                                               int64
	Mapped, Virtual, Resident, NonMapped                  int64
	Faults                                                int64
	HighestLocked                                         *LockStatus
	QueuedReaders, QueuedWriters                          int64
	ActiveReaders, ActiveWriters                          int64
	NetIn, NetOut                                         int64
	NumConnections                                        int64
	ReplSetName                                           string
	NodeType                                              string
}

StatLine is a wrapper for all metrics reported by mongostat for monitored hosts.

func NewStatLine

func NewStatLine(oldStat, newStat ServerStatus, key string, all bool, sampleSecs int64) *StatLine

NewStatLine constructs a StatLine object from two ServerStatus objects.

type TableSizeData

type TableSizeData struct {
	Headers []string      `json:"headers"`
	Data    []interface{} `json:"data"`
}

TableSizeData - XXX

type TransactionStats

type TransactionStats struct {
	TransCheckpoints int64 `bson:"transaction checkpoints"`
}

TransactionStats stores transaction checkpoints in WiredTiger.

type WiredTiger

type WiredTiger struct {
	Transaction TransactionStats       `bson:"transaction"`
	Concurrent  ConcurrentTransactions `bson:"concurrentTransactions"`
	Cache       CacheStats             `bson:"cache"`
}

WiredTiger stores information related to the WiredTiger storage engine.

Jump to

Keyboard shortcuts

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