linux

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2014 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PLUGIN_PREFIX = "custom."

Functions

This section is empty.

Types

type CpuusageGenerator

type CpuusageGenerator struct {
	Interval time.Duration
}

collect CPU usage

`cpu.{metric}.percentage`: The increased amount of CPU time per minute as percentage of total CPU cores x 100

metric = "user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal", "guest"

graph: stacks `cpu.{metric}.percentage`

cat /proc/stat sample: {{{
	cpu  7792253 5479 4851396 18056319678 127239 0 146818 2383839
	cpu0 5385397 1412 1970781 4509432750 103260 0 136689 876389
	cpu1 641247 1361 782257 4516019361 7247 0 2403 452803
	cpu2 652342 1366 617100 4516172153 7762 0 2447 453509
	cpu3 1113265 1339 1481257 4514695413 8968 0 5278 601135
	intr 6664031039 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3682869251 40969382 60 304 40427429 141 567698585 39988217 145 500771676 67725387 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 1349954031
	processes 60807520
	procs_running 1
	procs_blocked 0
}}}

func (*CpuusageGenerator) Generate

func (g *CpuusageGenerator) Generate() (metrics.Values, error)

type DiskGenerator

type DiskGenerator struct {
	Interval time.Duration
}

collect disk I/O

`disk.{device}.{metric}.delta`: The increased amount of disk I/O per minute retrieved from /proc/diskstats

device = "sda1", "xvda1" and so on...

metric = "reads", "readsMerged", "sectorsRead", "readTime", "writes", "writesMerged", "sectorsWritten", "writeTime", "ioInProgress", "ioTime", "ioTimeWeighted"

graph: `disk.{device}.{metric}.delta`

cat /proc/diskstats sample:

202       1 xvda1 750193 3037 28116978 368712 16600606 7233846 424712632 23987908 0 2355636 24345740
202       2 xvda2 1641 9310 87552 1252 6365 3717 80664 24192 0 15040 25428
  7       0 loop0 0 0 0 0 0 0 0 0 0 0 0
  7       1 loop1 0 0 0 0 0 0 0 0 0 0 0
253       0 dm-0 46095806 0 549095028 2243928 7192424 0 305024576 12521088 0 2728444 14782668
253     628 dm-628 3198 0 75410 1360 30802835 0 3942653176 1334317408 0 70948 1358596768

253 2 dm-2 2022 0 42250 488 30822403 0 3942809696 1364721232 0 93348 1382989868

func (*DiskGenerator) Generate

func (g *DiskGenerator) Generate() (metrics.Values, error)

type InterfaceGenerator

type InterfaceGenerator struct {
	Interval time.Duration
}

collect network interface I/O

`interface.{interface}.{metric}.delta`: The increased amount of network I/O per minute retrieved from /proc/net/dev

interface = "eth0", "eth1" and so on...

metric = "rxBytes", "rxPackets", "rxErrors", "rxDrops", "rxFifo", "rxFrame", "rxCompressed", "rxMulticast", "txBytes", "txPackets", "txErrors", "txDrops", "txFifo", "txColls", "txCarrier", "txCompressed"

cat /proc/net/dev sample:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
eth0: 5461472598 24386569    0    2    0     0          0         0 7215710422 6079810    0    0    0     0       0          0
lo: 7779878638 1952628    0    0    0     0          0         0 7779878638 1952628    0    0    0     0       0          0
docker0: 250219988  333736    0    0    0     0          0         0 2024726607 1409929    0    0    0     0       0          0

func (*InterfaceGenerator) Generate

func (g *InterfaceGenerator) Generate() (metrics.Values, error)

type Loadavg5Generator

type Loadavg5Generator struct {
}

collect load average

`loadavg5`: load average per 5 minutes retrieved from /proc/loadavg

graph: `loadavg5`

func (*Loadavg5Generator) Generate

func (g *Loadavg5Generator) Generate() (metrics.Values, error)

type MemoryGenerator

type MemoryGenerator struct {
}

collect memory usage

`memory.{metric}`: using memory size[KiB] retrieved from /proc/meminfo

metric = "total", "free", "buffers", "cached", "active", "inactive", "swap_cached", "swap_total", "swap_free"

Metrics "used" is caluculated here like (total - free - buffers - cached) for ease. This calculation may be going to be done in server side in the future.

graph: stacks `memory.{metric}`

func (*MemoryGenerator) Generate

func (g *MemoryGenerator) Generate() (metrics.Values, error)

type PluginGenerator

type PluginGenerator struct {
	Config config.PluginConfig
	Meta   *pluginMeta
}

PluginGenerator collects user-defined metrics. mackerel-agent runs specified command and parses the result for the metric names and values.

func (*PluginGenerator) Generate

func (g *PluginGenerator) Generate() (metrics.Values, error)

func (*PluginGenerator) InitWithAPI added in v0.10.0

func (g *PluginGenerator) InitWithAPI(api *mackerel.API) error

type UptimeGenerator

type UptimeGenerator struct {
}

collect uptime

`uptime`: uptime[day] retrieved from /proc/uptime

graph: `uptime`

func (*UptimeGenerator) Generate

func (g *UptimeGenerator) Generate() (metrics.Values, error)

Jump to

Keyboard shortcuts

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