Пример #1
0
)

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"),
				"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{
Пример #2
0
	"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"),
			"system":          c.Float("CPUSystem"),
			"children_user":   c.Float("CPUChildrenUser"),
Пример #3
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),
}
Пример #4
0
			},
		},

		"ssl": s.Object{
			"rate": s.Object{
				"value": c.Int("SslRate"),
				"limit": c.Int("SslRateLimit"),
				"max":   c.Int("MaxSslRate"),
			},
			"frontend": s.Object{
				"key_rate": s.Object{
					"value": c.Int("SslFrontendKeyRate"),
					"max":   c.Int("SslFrontendMaxKeyRate"),
				},
				"session_reuse": s.Object{
					"pct": c.Float("SslFrontendSessionReusePct"),
				},
			},
			"backend": s.Object{
				"key_rate": s.Object{
					"value": c.Int("SslBackendKeyRate"),
					"max":   c.Int("SslBackendMaxKeyRate"),
				},
			},
			"cached_lookups": c.Int("SslCacheLookups"),
			"cache_misses":   c.Int("SslCacheMisses"),
		},

		"zlib_mem_usage": s.Object{
			"value": c.Int("ZlibMemUsage"),
			"max":   c.Int("MaxZlibMemUsage"),
Пример #5
0
				"key_rate":          c.Int("SslFrontendKeyRate"),
				"max_key_rate":      c.Int("SslFrontendMaxKeyRate"),
				"session_reuse_pct": c.Int("SslFrontendSessionReusePct"),
			},
			"backend": s.Object{
				"key_rate":     c.Int("SslBackendKeyRate"),
				"max_key_rate": c.Int("SslBackendMaxKeyRate"),
			},
			"cached_lookups": c.Int("SslCacheLookups"),
			"cache_misses":   c.Int("SslCacheMisses"),
		},

		"zlib_mem_usage": c.Int("ZlibMemUsage"),
		"tasks":          c.Int("Tasks"),
		"run_queue":      c.Int("RunQueue"),
		"idle_pct":       c.Float("IdlePct"),
	}
)

// Map data to MapStr
func eventMapping(info *haproxy.Info) (common.MapStr, error) {
	// Full mapping from info

	st := reflect.ValueOf(info).Elem()
	typeOfT := st.Type()
	source := map[string]interface{}{}

	for i := 0; i < st.NumField(); i++ {
		f := st.Field(i)

		if typeOfT.Field(i).Name == "IdlePct" {