perfmon

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package perfmon implements a Metricbeat metricset for reading Windows performance counters.

Index

Constants

This section is empty.

Variables

View Source
var InvalidCounterHandle = ^PdhCounterHandle(0)
View Source
var InvalidQueryHandle = ^PdhQueryHandle(0)

Functions

func New

func New(base mb.BaseMetricSet) (mb.MetricSet, error)

New create a new instance of the MetricSet.

func PdhCloseQuery

func PdhCloseQuery(query PdhQueryHandle) error

func PdhCollectQueryData

func PdhCollectQueryData(query PdhQueryHandle) error

Types

type Counter

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

type CounterConfig

type CounterConfig struct {
	InstanceLabel    string `config:"instance_label" validate:"required"`
	InstanceName     string `config:"instance_name"`
	MeasurementLabel string `config:"measurement_label" validate:"required"`
	Query            string `config:"query" validate:"required"`
	Format           string `config:"format"`
}

type CounterValueItem

type CounterValueItem struct {
	Name  string
	Value PdhCounterValue
}

func PdhGetFormattedCounterArray

func PdhGetFormattedCounterArray(counter PdhCounterHandle, format PdhCounterFormat) ([]CounterValueItem, error)

type Counters

type Counters map[string]*Counter

type Format

type Format int
const (
	FloatFlormat Format = iota
	LongFormat
)

type MetricSet

type MetricSet struct {
	mb.BaseMetricSet
	// contains filtered or unexported fields
}

func (*MetricSet) Fetch

func (m *MetricSet) Fetch() ([]common.MapStr, error)

type PdhCounterFormat

type PdhCounterFormat uint32
const (
	PdhFmtDouble PdhCounterFormat = 0x200

	PdhFmtLarge PdhCounterFormat = 0x400

	PdhFmtLong PdhCounterFormat = 0x100

	PdhFmtNoScale PdhCounterFormat = 0x1000

	PdhFmtNoCap100 PdhCounterFormat = 0x8000

	PdhFmtMultiply1000 PdhCounterFormat = 0x2000
)

type PdhCounterHandle

type PdhCounterHandle uintptr

func PdhAddCounter

func PdhAddCounter(query PdhQueryHandle, counterPath string, userData uintptr) (PdhCounterHandle, error)

type PdhCounterValue

type PdhCounterValue struct {
	CStatus   uint32
	Pad_cgo_0 [4]byte
	LongValue int32
	Pad_cgo_1 [4]byte
}

func PdhCalculateCounterFromRawValue

func PdhCalculateCounterFromRawValue(counter PdhCounterHandle, format PdhCounterFormat, rawValue1 *PdhRawCounter, rawValue2 *PdhRawCounter) (*PdhCounterValue, error)

func PdhFormatFromRawValue

func PdhFormatFromRawValue(format PdhCounterFormat, rawValue1 *PdhRawCounter, rawValue2 *PdhRawCounter) (*PdhCounterValue, error)

func PdhGetFormattedCounterValue

func PdhGetFormattedCounterValue(counter PdhCounterHandle, format PdhCounterFormat) (uint32, *PdhCounterValue, error)

type PdhErrno

type PdhErrno uintptr
const (
	PDH_CSTATUS_VALID_DATA                     PdhErrno = 0x0
	PDH_CSTATUS_NEW_DATA                       PdhErrno = 0x1
	PDH_CSTATUS_NO_MACHINE                     PdhErrno = 0x800007d0
	PDH_CSTATUS_NO_INSTANCE                    PdhErrno = 0x800007d1
	PDH_MORE_DATA                              PdhErrno = 0x800007d2
	PDH_CSTATUS_ITEM_NOT_VALIDATED             PdhErrno = 0x800007d3
	PDH_RETRY                                  PdhErrno = 0x800007d4
	PDH_NO_DATA                                PdhErrno = 0x800007d5
	PDH_CALC_NEGATIVE_DENOMINATOR              PdhErrno = 0x800007d6
	PDH_CALC_NEGATIVE_TIMEBASE                 PdhErrno = 0x800007d7
	PDH_CALC_NEGATIVE_VALUE                    PdhErrno = 0x800007d8
	PDH_DIALOG_CANCELLED                       PdhErrno = 0x800007d9
	PDH_END_OF_LOG_FILE                        PdhErrno = 0x800007da
	PDH_ASYNC_QUERY_TIMEOUT                    PdhErrno = 0x800007db
	PDH_CANNOT_SET_DEFAULT_REALTIME_DATASOURCE PdhErrno = 0x800007dc
	PDH_CSTATUS_NO_OBJECT                      PdhErrno = 0xc0000bb8
	PDH_CSTATUS_NO_COUNTER                     PdhErrno = 0xc0000bb9
	PDH_CSTATUS_INVALID_DATA                   PdhErrno = 0xc0000bba
	PDH_MEMORY_ALLOCATION_FAILURE              PdhErrno = 0xc0000bbb
	PDH_INVALID_HANDLE                         PdhErrno = 0xc0000bbc
	PDH_INVALID_ARGUMENT                       PdhErrno = 0xc0000bbd
	PDH_FUNCTION_NOT_FOUND                     PdhErrno = 0xc0000bbe
	PDH_CSTATUS_NO_COUNTERNAME                 PdhErrno = 0xc0000bbf
	PDH_CSTATUS_BAD_COUNTERNAME                PdhErrno = 0xc0000bc0
	PDH_INVALID_BUFFER                         PdhErrno = 0xc0000bc1
	PDH_INSUFFICIENT_BUFFER                    PdhErrno = 0xc0000bc2
	PDH_CANNOT_CONNECT_MACHINE                 PdhErrno = 0xc0000bc3
	PDH_INVALID_PATH                           PdhErrno = 0xc0000bc4
	PDH_INVALID_INSTANCE                       PdhErrno = 0xc0000bc5
	PDH_INVALID_DATA                           PdhErrno = 0xc0000bc6
	PDH_NO_DIALOG_DATA                         PdhErrno = 0xc0000bc7
	PDH_CANNOT_READ_NAME_STRINGS               PdhErrno = 0xc0000bc8
	PDH_LOG_FILE_CREATE_ERROR                  PdhErrno = 0xc0000bc9
	PDH_LOG_FILE_OPEN_ERROR                    PdhErrno = 0xc0000bca
	PDH_LOG_TYPE_NOT_FOUND                     PdhErrno = 0xc0000bcb
	PDH_NO_MORE_DATA                           PdhErrno = 0xc0000bcc
	PDH_ENTRY_NOT_IN_LOG_FILE                  PdhErrno = 0xc0000bcd
	PDH_DATA_SOURCE_IS_LOG_FILE                PdhErrno = 0xc0000bce
	PDH_DATA_SOURCE_IS_REAL_TIME               PdhErrno = 0xc0000bcf
	PDH_UNABLE_READ_LOG_HEADER                 PdhErrno = 0xc0000bd0
	PDH_FILE_NOT_FOUND                         PdhErrno = 0xc0000bd1
	PDH_FILE_ALREADY_EXISTS                    PdhErrno = 0xc0000bd2
	PDH_NOT_IMPLEMENTED                        PdhErrno = 0xc0000bd3
	PDH_STRING_NOT_FOUND                       PdhErrno = 0xc0000bd4
	PDH_UNABLE_MAP_NAME_FILES                  PdhErrno = 0x80000bd5
	PDH_UNKNOWN_LOG_FORMAT                     PdhErrno = 0xc0000bd6
	PDH_UNKNOWN_LOGSVC_COMMAND                 PdhErrno = 0xc0000bd7
	PDH_LOGSVC_QUERY_NOT_FOUND                 PdhErrno = 0xc0000bd8
	PDH_LOGSVC_NOT_OPENED                      PdhErrno = 0xc0000bd9
	PDH_WBEM_ERROR                             PdhErrno = 0xc0000bda
	PDH_ACCESS_DENIED                          PdhErrno = 0xc0000bdb
	PDH_LOG_FILE_TOO_SMALL                     PdhErrno = 0xc0000bdc
	PDH_INVALID_DATASOURCE                     PdhErrno = 0xc0000bdd
	PDH_INVALID_SQLDB                          PdhErrno = 0xc0000bde
	PDH_NO_COUNTERS                            PdhErrno = 0xc0000bdf
	PDH_SQL_ALLOC_FAILED                       PdhErrno = 0xc0000be0
	PDH_SQL_ALLOCCON_FAILED                    PdhErrno = 0xc0000be1
	PDH_SQL_EXEC_DIRECT_FAILED                 PdhErrno = 0xc0000be2
	PDH_SQL_FETCH_FAILED                       PdhErrno = 0xc0000be3
	PDH_SQL_ROWCOUNT_FAILED                    PdhErrno = 0xc0000be4
	PDH_SQL_MORE_RESULTS_FAILED                PdhErrno = 0xc0000be5
	PDH_SQL_CONNECT_FAILED                     PdhErrno = 0xc0000be6
	PDH_SQL_BIND_FAILED                        PdhErrno = 0xc0000be7
	PDH_CANNOT_CONNECT_WMI_SERVER              PdhErrno = 0xc0000be8
	PDH_PLA_COLLECTION_ALREADY_RUNNING         PdhErrno = 0xc0000be9
	PDH_PLA_ERROR_SCHEDULE_OVERLAP             PdhErrno = 0xc0000bea
	PDH_PLA_COLLECTION_NOT_FOUND               PdhErrno = 0xc0000beb
	PDH_PLA_ERROR_SCHEDULE_ELAPSED             PdhErrno = 0xc0000bec
	PDH_PLA_ERROR_NOSTART                      PdhErrno = 0xc0000bed
	PDH_PLA_ERROR_ALREADY_EXISTS               PdhErrno = 0xc0000bee
	PDH_PLA_ERROR_TYPE_MISMATCH                PdhErrno = 0xc0000bef
	PDH_PLA_ERROR_FILEPATH                     PdhErrno = 0xc0000bf0
	PDH_PLA_SERVICE_ERROR                      PdhErrno = 0xc0000bf1
	PDH_PLA_VALIDATION_ERROR                   PdhErrno = 0xc0000bf2
	PDH_PLA_VALIDATION_WARNING                 PdhErrno = 0x80000bf3
	PDH_PLA_ERROR_NAME_TOO_LONG                PdhErrno = 0xc0000bf4
	PDH_INVALID_SQL_LOG_FORMAT                 PdhErrno = 0xc0000bf5
	PDH_COUNTER_ALREADY_IN_QUERY               PdhErrno = 0xc0000bf6
	PDH_BINARY_LOG_CORRUPT                     PdhErrno = 0xc0000bf7
	PDH_LOG_SAMPLE_TOO_SMALL                   PdhErrno = 0xc0000bf8
	PDH_OS_LATER_VERSION                       PdhErrno = 0xc0000bf9
	PDH_OS_EARLIER_VERSION                     PdhErrno = 0xc0000bfa
	PDH_INCORRECT_APPEND_TIME                  PdhErrno = 0xc0000bfb
	PDH_UNMATCHED_APPEND_COUNTER               PdhErrno = 0xc0000bfc
	PDH_SQL_ALTER_DETAIL_FAILED                PdhErrno = 0xc0000bfd
	PDH_QUERY_PERF_DATA_TIMEOUT                PdhErrno = 0xc0000bfe
)

func (PdhErrno) Error

func (e PdhErrno) Error() string

type PdhFileTime

type PdhFileTime struct {
	DwLowDateTime  uint32
	DwHighDateTime uint32
}

type PdhQueryHandle

type PdhQueryHandle uintptr

func PdhOpenQuery

func PdhOpenQuery(dataSource string, userData uintptr) (PdhQueryHandle, error)

type PdhRawCounter

type PdhRawCounter struct {
	CStatus     uint32
	TimeStamp   PdhFileTime
	Pad_cgo_0   [4]byte
	FirstValue  int64
	SecondValue int64
	MultiCount  uint32
	Pad_cgo_1   [4]byte
}

func PdhGetRawCounterValue

func PdhGetRawCounterValue(counter PdhCounterHandle) (uint32, *PdhRawCounter, error)

type PerfmonReader

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

func NewPerfmonReader

func NewPerfmonReader(config []CounterConfig) (*PerfmonReader, error)

func (*PerfmonReader) Read

func (r *PerfmonReader) Read() ([]common.MapStr, error)

type Query

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

func NewQuery

func NewQuery(dataSource string) (*Query, error)

func (*Query) AddCounter

func (q *Query) AddCounter(counterPath string, format Format, instanceName string) error

func (*Query) Close

func (q *Query) Close() error

Closes the query and all of its counters.

func (*Query) Execute

func (q *Query) Execute() error

func (*Query) Values

func (q *Query) Values() (map[string][]Value, error)

type Value

type Value struct {
	Instance    string
	Measurement interface{}
	Err         error
}

Jump to

Keyboard shortcuts

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