Ejemplo n.º 1
0
import (
	"bufio"
	"io"
	"regexp"

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

var (
	// Matches first the variable name, second the param itself
	paramMatcher = regexp.MustCompile("([^\\s]+)\\s+(.*$)")
	schema_      = s.Schema{
		"version": c.Str("zk_version"),
		"latency": s.Object{
			"avg": c.Int("zk_avg_latency"),
			"min": c.Int("zk_min_latency"),
			"max": c.Int("zk_max_latency"),
		},
		"packets": s.Object{
			"received": c.Int("zk_packets_received"),
			"sent":     c.Int("zk_packets_sent"),
		},
		"num_alive_connections": c.Int("zk_num_alive_connections"),
		"outstanding_requests":  c.Int("zk_outstanding_requests"),
		"server_state":          c.Str("zk_server_state"),
		"znode_count":           c.Int("zk_znode_count"),
		"watch_count":           c.Int("zk_watch_count"),
		"ephemerals_count":      c.Int("zk_ephemerals_count"),
Ejemplo n.º 2
0
		"cpu": s.Object{
			"used": s.Object{
				"sys":           c.Float("used_cpu_sys"),
				"user":          c.Float("used_cpu_user"),
				"sys_children":  c.Float("used_cpu_sys_children"),
				"user_children": c.Float("used_cpu_user_children"),
			},
		},
		"memory": s.Object{
			"used": s.Object{
				"value": c.Int("used_memory"), // As it is a top key, this goes into value
				"rss":   c.Int("used_memory_rss"),
				"peak":  c.Int("used_memory_peak"),
				"lua":   c.Int("used_memory_lua"),
			},
			"allocator": c.Str("mem_allocator"), // Could be moved to server as it rarely changes
		},
		"persistence": s.Object{
			"loading": c.Bool("loading"),
			"rdb": s.Object{
				"last_save.changes_since": c.Int("rdb_changes_since_last_save"),
				"last_save.time":          c.Int("rdb_last_save_time"),
				"bgsave": s.Object{
					"last_status":      c.Str("rdb_last_bgsave_status"),
					"in_progress":      c.Bool("rdb_bgsave_in_progress"),
					"last_time.sec":    c.Int("rdb_last_bgsave_time_sec"),
					"current_time.sec": c.Int("rdb_current_bgsave_time_sec"),
				},
			},
			"aof": s.Object{
				"enabled": c.Bool("aof_enabled"),
Ejemplo n.º 3
0
package activity

import (
	"time"

	s "github.com/elastic/beats/metricbeat/schema"
	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"),
Ejemplo n.º 4
0
package stat

import (
	"reflect"

	"github.com/elastic/beats/libbeat/common"
	"github.com/elastic/beats/metricbeat/module/haproxy"
	s "github.com/elastic/beats/metricbeat/schema"
	c "github.com/elastic/beats/metricbeat/schema/mapstrstr"
)

var (
	schema = s.Schema{
		"pxname":         c.Str("PxName"),
		"svname":         c.Str("SvName"),
		"qcur":           c.Int("Qcur", s.Optional),
		"qmax":           c.Int("Qmax", s.Optional),
		"scur":           c.Int("Scur"),
		"smax":           c.Int("Smax"),
		"slim":           c.Int("Slim", s.Optional),
		"stot":           c.Int("Stot"),
		"bin":            c.Int("Bin"),
		"bout":           c.Int("Bout"),
		"dreq":           c.Int("Dreq", s.Optional),
		"dresp":          c.Int("Dresp"),
		"ereq":           c.Int("Ereq", s.Optional),
		"econ":           c.Int("Econ", s.Optional),
		"eresp":          c.Int("Eresp", s.Optional),
		"wretr":          c.Int("Wretr", s.Optional),
		"wredis":         c.Int("Wredis", s.Optional),
		"status":         c.Str("Status"),
Ejemplo n.º 5
0
Archivo: data.go Proyecto: ruflin/beats
package stat

import (
	"reflect"

	"github.com/elastic/beats/libbeat/common"
	"github.com/elastic/beats/metricbeat/module/haproxy"
	s "github.com/elastic/beats/metricbeat/schema"
	c "github.com/elastic/beats/metricbeat/schema/mapstrstr"
)

var (
	schema = s.Schema{
		"status":         c.Str("Status"),
		"weight":         c.Int("Weight", s.Optional),
		"downtime":       c.Int("Downtime", s.Optional),
		"component_type": c.Int("Type"),
		"process_id":     c.Int("Pid"),
		"service_name":   c.Str("SvName"),
		"in.bytes":       c.Int("Bin"),
		"out.bytes":      c.Int("Bout"),
		"last_change":    c.Int("Lastchg", s.Optional),
		"throttle.pct":   c.Int("Throttle", s.Optional),
		"selected.total": c.Int("Lbtot", s.Optional),
		"tracked.id":     c.Int("Tracked", s.Optional),

		"connection": s.Object{
			"total":    c.Int("Stot"),
			"retried":  c.Int("Wretr", s.Optional),
			"time.avg": c.Int("Ctime", s.Optional),
		},
Ejemplo n.º 6
0
package database

import (
	"time"

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

// Based on https://www.postgresql.org/docs/9.2/static/monitoring-stats.html#PG-STAT-DATABASE-VIEW
var schema = s.Schema{
	"oid":                c.Int("datid"),
	"name":               c.Str("datname"),
	"number_of_backends": c.Int("numbackends"),
	"transactions": s.Object{
		"commit":   c.Int("xact_commit"),
		"rollback": c.Int("xact_rollback"),
	},
	"blocks": s.Object{
		"read": c.Int("blks_read"),
		"hit":  c.Int("blks_hit"),
		"time": s.Object{
			"read":  s.Object{"ms": c.Int("blk_read_time")},
			"write": s.Object{"ms": c.Int("blk_write_time")},
		},
	},
	"rows": s.Object{
		"returned": c.Int("tup_returned"),
		"fetched":  c.Int("tup_fetched"),
		"inserted": c.Int("tup_inserted"),
		"updated":  c.Int("tup_updated"),