Exemple #1
0
	"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"),
		"approximate_data_size": c.Int("zk_approximate_data_size"),
	}
Exemple #2
0
package info

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

var (
	schema = s.Schema{
		"clients": s.Object{
			"connected":           c.Int("connected_clients"),
			"longest_output_list": c.Int("client_longest_output_list"),
			"biggest_input_buf":   c.Int("client_biggest_input_buf"),
			"blocked":             c.Int("blocked_clients"),
		},
		"cluster": s.Object{
			"enabled": c.Bool("cluster_enabled"),
		},
		"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"),
Exemple #3
0
package status

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

var (
	schema = s.Schema{
		"aborted": s.Object{
			"clients":  c.Int("Aborted_clients"),
			"connects": c.Int("Aborted_connects"),
		},
		"binlog": s.Object{
			"cache": s.Object{
				"disk_use": c.Int("Binlog_cache_disk_use"),
				"use":      c.Int("Binlog_cache_use"),
			},
		},
		"bytes": s.Object{
			"received": c.Int("Bytes_received"),
			"sent":     c.Int("Bytes_sent"),
		},
		"threads": s.Object{
			"cached":    c.Int("Threads_cached"),
			"created":   c.Int("Threads_created"),
			"connected": c.Int("Threads_connected"),
			"running":   c.Int("Threads_running"),
		},
		"connections": c.Int("Connections"),
Exemple #4
0
	"regexp"
	"strings"

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

var (
	scoreboardRegexp = regexp.MustCompile("(Scoreboard):\\s+((_|S|R|W|K|D|C|L|G|I|\\.)+)")

	// This should match: "CPUSystem: .01"
	matchNumber = regexp.MustCompile("(^[0-9a-zA-Z ]+):\\s+(\\d*\\.?\\d+)")

	schema = s.Schema{
		"total_accesses":    c.Int("Total Accesses"),
		"total_kbytes":      c.Int("Total kBytes"),
		"requests_per_sec":  c.Float("ReqPerSec", s.Optional),
		"bytes_per_sec":     c.Float("BytesPerSec", s.Optional),
		"bytes_per_request": c.Float("BytesPerReq", s.Optional),
		"workers": s.Object{
			"busy": c.Int("BusyWorkers"),
			"idle": c.Int("IdleWorkers"),
		},
		"uptime": s.Object{
			"server_uptime": c.Int("ServerUptimeSeconds"),
			"uptime":        c.Int("Uptime"),
		},
		"cpu": s.Object{
			"load":            c.Float("CPULoad", s.Optional),
			"user":            c.Float("CPUUser"),
Exemple #5
0
}

// findKeyspaceStats will grep for keyspace ("^db" keys) and return the resulting map
func findKeyspaceStats(info map[string]string) map[string]string {
	keyspace := map[string]string{}

	for k, v := range info {
		if strings.HasPrefix(k, "db") {
			keyspace[k] = v
		}
	}
	return keyspace
}

var schema = s.Schema{
	"keys":    c.Int("keys"),
	"expires": c.Int("expires"),
	"avg_ttl": c.Int("avg_ttl"),
}

// parseKeyspaceStats resolves the overloaded value string that Redis returns for keyspace
func parseKeyspaceStats(keyspaceMap map[string]string) map[string]common.MapStr {
	keyspace := map[string]common.MapStr{}
	for k, v := range keyspaceMap {

		// Extract out the overloaded values for db keyspace
		// fmt: info[db0] = keys=795341,expires=0,avg_ttl=0
		dbInfo := redis.ParseRedisLine(v, ",")

		if len(dbInfo) == 3 {
			db := map[string]interface{}{}
Exemple #6
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"),
Exemple #7
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"),
Exemple #8
0
package info

import (
	"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"

	"reflect"
	"strconv"
	"strings"
)

var (
	schema = s.Schema{
		"processes":   c.Int("Nbproc"),
		"process_num": c.Int("ProcessNum"),
		"pid":         c.Int("Pid"),
		"ulimit_n":    c.Int("UlimitN"),
		"tasks":       c.Int("Tasks"),
		"run_queue":   c.Int("RunQueue"),

		"uptime": s.Object{
			"sec": c.Int("UptimeSec"),
		},

		"memory": s.Object{
			"max": s.Object{
				"bytes": c.Int("MemMax"),
			},
		},
Exemple #9
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{
		"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),
		},
Exemple #10
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),
}
Exemple #11
0
package info

import (
	"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"

	"reflect"
	"strconv"
	"strings"
)

var (
	schema = s.Schema{
		"nb_proc":       c.Int("Nbproc"),
		"process_num":   c.Int("ProcessNum"),
		"pid":           c.Int("Pid"),
		"uptime_sec":    c.Int("UptimeSec"),
		"mem_max_bytes": c.Int("MemMax"),
		"ulimit_n":      c.Int("UlimitN"),

		"compress": s.Object{
			"bps": s.Object{
				"in":         c.Int("CompressBpsIn"),
				"out":        c.Int("CompressBpsOut"),
				"rate_limit": c.Int("CompressBpsRateLim"),
			},
		},

		"conn": s.Object{
Exemple #12
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"),