Example #1
0
	c "github.com/elastic/beats/metricbeat/schema/mapstrstr"
)

// Based on: https://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW
var schema = s.Schema{
	"database": s.Object{
		"oid":  c.Int("datid"),
		"name": c.Str("datname"),
	},
	"pid": c.Int("pid"),
	"user": s.Object{
		"id":   c.Int("usesysid"),
		"name": c.Str("usename"),
	},
	"application_name": c.Str("application_name"),
	"client": s.Object{
		"address":  c.Str("client_addr"),
		"hostname": c.Str("client_hostname"),
		"port":     c.Int("client_port"),
	},
	"backend_start":     c.Time(time.RFC3339Nano, "backend_start"),
	"transaction_start": c.Time(time.RFC3339Nano, "xact_start", s.Optional),
	"query_start":       c.Time(time.RFC3339Nano, "query_start"),
	"state_change":      c.Time(time.RFC3339Nano, "state_change"),
	"waiting":           c.Bool("waiting"),
	"state":             c.Str("state"),
	"query":             c.Str("query"),
}

var eventMapping = schema.Apply
Example #2
0
package bgwriter

import (
	"time"

	s "github.com/elastic/beats/metricbeat/schema"
	c "github.com/elastic/beats/metricbeat/schema/mapstrstr"
)

var schema = s.Schema{
	"checkpoints": s.Object{
		"scheduled": c.Int("checkpoints_timed"),
		"requested": c.Int("checkpoints_req"),
		"times": s.Object{
			"write": s.Object{"ms": c.Float("checkpoint_write_time")},
			"sync":  s.Object{"ms": c.Float("checkpoint_sync_time")},
		},
	},
	"buffers": s.Object{
		"checkpoints":   c.Int("buffers_checkpoint"),
		"clean":         c.Int("buffers_clean"),
		"clean_full":    c.Int("maxwritten_clean"),
		"backend":       c.Int("buffers_backend"),
		"backend_fsync": c.Int("buffers_backend_fsync"),
		"allocated":     c.Int("buffers_alloc"),
	},
	"stats_reset": c.Time(time.RFC3339Nano, "stats_reset", s.Optional),
}