oraquery

package
v0.0.0-...-7301b9a Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 9 Imported by: 0

README

ORAQUERY

  • Collect data by consistent connections to oracle dbs.
  • add new collections just by config with sql.
  • need a prerequisite: oracle instant client.

install and config oracle instant client:

  • installation (please choose the version by yourself. The following just show a example)
    wget https://download.oracle.com/otn_software/linux/instantclient/19600/oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
    rpm -iUh oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
    
  • config tnsnames.ora
    ## create monitor user in db
    create user umsp identified by umsp;
    grant create session to umsp;
    grant select any dictionary to umsp;
    vim $(cat /etc/ld.so.conf.d/oracle-instantclient.conf)/network/admin/tnsnames.ora
    

alread-configed collecting metrics:

  • nonrac_dbtime
  • rac_dbtime
  • nonrac_performance
  • rac_performance
  • nonrac_topevent5
  • rac_topevent5
  • tablespace
  • nonrac_topsql5
  • rac_topsql5

get all detailed configuration by command:

./telegraf --usage oraquery

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSNDefine

type DSNDefine struct {
	Name string `toml:"name"`
	DSN  string `toml:"dsn"`
}

type ItemDef

type ItemDef struct {
	Name      string `toml:"name"`
	Type      string `toml:"type"`
	ColumnPos int    `toml:"column_pos_sql"`
}

ItemDef - define fields and tags with type for flush to influxdb

type ORADB

type ORADB struct {
	DSN string
	DB  *sql.DB

	IsRAC   int8
	StmtMap map[string]*STMT //MeasureName : stmt
	// contains filtered or unexported fields
}

ORADB --

type OraQuery

type OraQuery struct {
	MaxOpenConns int          `toml:"max_dbconns"`
	SQLMetrics   []*SQLMetric `toml:"metrics"`
	DSNDefines   []*DSNDefine `toml:"dsn_defines"`
	SQLDefines   []*SQLDefine `toml:"sql_defines"`

	ReconnIntervalSec int `toml:"reconn_interval_second"`

	//TimeFunc
	Log telegraf.Logger
	// contains filtered or unexported fields
}

OraQuery is an input plugin that collects external metrics sent via HTTP

func (*OraQuery) Description

func (O *OraQuery) Description() string

Description -- input interface function

func (*OraQuery) Gather

func (O *OraQuery) Gather(_ telegraf.Accumulator) error

Gather -- input interface function. Not use it in this service.

func (*OraQuery) Init

func (O *OraQuery) Init() error

Init -- invoked by telegraf framework before Start

func (*OraQuery) SampleConfig

func (O *OraQuery) SampleConfig() string

SampleConfig -- input interface function

func (*OraQuery) StartContext

func (O *OraQuery) StartContext(ctx context.Context, acc telegraf.Accumulator) error

StartContext -- start the service. invoked by telegraf framwork

func (*OraQuery) Stop

func (O *OraQuery) Stop()

Stop cleans up all resources

type SQLDefine

type SQLDefine struct {
	Name        string    `toml:"name"`
	DBType      int8      `toml:"dbtype"` //1 -- rac, 2 -- non-rac, 0 -- any type
	SQLStr      string    `toml:"sqlstr"`
	MeasureName string    `toml:"measure_name"`
	Tags        []ItemDef `toml:"tags"`
	Fields      []ItemDef `toml:"fields"`
}

type SQLMetric

type SQLMetric struct {
	DSNName     string   `toml:"dsn_name"`
	SQLName     string   `toml:"sql_name"`
	IntervalSec int      `toml:"interval_second"`
	Tags        []string `toml:"tags"`
}

SQLMetric --

type STMT

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

STMT --

Jump to

Keyboard shortcuts

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