#
# pmrep(1) configuration file - see pmrep.conf(5)
#


# Compact metric specifications are of form (see pmrep(1)):
#pcp.metric.name = label,instances,unit/scale,type,width,precision,limit


#
# Mimic assorted sar(1) reports
#
[sar]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       CPU"
kernel.cpu.util.user  = %%user,,,,
kernel.cpu.util.nice  = %%nice,,,,
kernel.cpu.util.sys   = %%system,,,,
kernel.cpu.util.wait  = %%iowait,,,,
kernel.cpu.util.steal = %%steal,,,,
kernel.cpu.util.idle  = %%idle,,,,

[sar-B]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
mem.vmstat.pgpgin        = pgpgin/s,,,,12
mem.vmstat.pgpgout       = pgpgout/s,,,,
mem.vmstat.pgfault       = fault/s,,,,
mem.vmstat.pgmajfault    = majflt/s,,,,
mem.vmstat.pgfree        = pgfree/s,,,,
mem.vmstat.pgscan_kswapd = pgscank/s,,,,
pgscand                  = mem.vmstat.pgscan_direct_all
pgscand.label            = pgscand/s
pgscand.formula          = mem.vmstat.pgscan_direct + mem.vmstat.pgscan_direct_throttle
pgsteal                  = mem.vmstat.pgsteal_all
pgsteal.label            = pgsteal/s
pgsteal.formula          = mem.vmstat.pgsteal_kswapd + mem.vmstat.pgsteal_direct
vmeff                    = mem.vmstat.vmeff
vmeff.label              = %%vmeff
vmeff.formula            =
  (
    delta(mem.vmstat.pgscan_kswapd) +
    delta(mem.vmstat.pgscan_direct) +
    delta(mem.vmstat.pgscan_direct_throttle)
  ) == 0
  ?
    mkconst(0, type="double", semantics="instant")
  :
    100 *
    (
      delta(mem.vmstat.pgsteal_kswapd) +
      delta(mem.vmstat.pgsteal_direct)
    )
    /
    (
      delta(mem.vmstat.pgscan_kswapd) +
      delta(mem.vmstat.pgscan_direct) +
      delta(mem.vmstat.pgscan_direct_throttle)
    )

[sar-b]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
disk.all.total      = tps,,,,12
disk.all.read       = rtps,,,,
disk.all.write      = wtps,,,,
disk.all.discard    = dtps,,,,
disk.all.blkread    = bread/s,,,,
disk.all.blkwrite   = bwrtn/s,,,,
disk.all.blkdiscard = bdscd/s,,,,

[sar-d-dev]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "         DEV"
disk.dev.total         = tps,,,,
disk.dev.read_bytes    = rkB/s,,KB,,
disk.dev.write_bytes   = wkB/s,,KB,,
disk.dev.discard_bytes = dkB/s,,KB,,
disk.dev.avg_rqsz      = areq-sz,,,,
disk.dev.avg_qlen      = aqu-sz,,,,
disk.dev.await         = await,,,,,
disk.dev.util          = %%util,,,,

[sar-d-dm]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "         DEV"
disk.dm.total         = tps,,,,
disk.dm.read_bytes    = rkB/s,,KB,,
disk.dm.write_bytes   = wkB/s,,KB,,
disk.dm.discard_bytes = dkB/s,,KB,,
disk.dm.avg_rqsz      = areq-sz,,,,
disk.dm.avg_qlen      = aqu-sz,,,,
disk.dm.await         = await,,,,
disk.dm.util          = %%util,,,,

[sar-F]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "            FILESYSTEM"
filesys.free      = MBfsfree,,MB,,,0
filesys.used      = MBfsused,,MB,,,0
fsusedp           = filesys.used_pct
fsusedp.label     = %%fsused
fsusedp.formula   = 100 * (filesys.used / filesys.capacity)
ufsusedp          = filesys.user_used_pct
ufsusedp.label    = %%ufsused
ufsusedp.formula  = 100 * ((filesys.capacity - filesys.avail) / filesys.capacity)
filesys.freefiles = Ifree,,,,11
filesys.usedfiles = Iused,,,,11
iusedp            = filesys.usedfiles_pct
iusedp.label      = %%Iused
iusedp.formula    = 100 * (filesys.usedfiles / filesys.maxfiles)

[sar-H]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 0
delimiter = " "
repeat_header = auto
mem.util.hugepagesFreeBytes = kbhugfree,,KB,,12,0
hugused                     = mem.util.hugepagesAlloc
hugused.label               = kbhugused
hugused.formula             = mem.util.hugepagesTotalBytes - mem.util.hugepagesFreeBytes
hugused.unit                = KB
hugusedpct                  = mem.util.hugepagesRsvd_pct
hugusedpct.label            = %%hugused
hugusedpct.formula          = 100 * ((mem.util.hugepagesTotalBytes - mem.util.hugepagesFreeBytes) / mem.util.hugepagesTotalBytes)
hugusedpct.precision        = 2
mem.util.hugepagesRsvdBytes = kbhugrsvd,,KB,,,0
mem.util.hugepagesSurpBytes = kbhugsurp,,KB,,,0

[sar-I-SUM]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       INTR"
kernel.all.intr = intr/s,,,,

#[sar-m]
# https://github.com/performancecopilot/pcp/issues/532

[sar-n-DEV]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       IFACE"
network.interface.in.packets     = rxpck/s,,,,
network.interface.out.packets    = txpck/s,,,,
network.interface.in.bytes       = rxkB/s,,KB,,
network.interface.out.bytes      = txkB/s,,KB,,
network.interface.in.compressed  = rxcmp/s,,,,
network.interface.out.compressed = txcmp/s,,,,
network.interface.in.mcasts      = rxmcst/s,,,,
ifutil                           = network.interface.util
ifutil.label                     = %%ifutil
ifutil.formula                   =
  network.interface.duplex == 1
  ?
    100 *
    (delta(network.interface.in.bytes) +
     delta(network.interface.out.bytes)) /
    network.interface.baudrate
  :
    (
      delta(network.interface.in.bytes) >
      delta(network.interface.out.bytes)
      ?
        100 *
        delta(network.interface.in.bytes) /
        network.interface.baudrate
      :
        100 *
        delta(network.interface.out.bytes) /
        network.interface.baudrate
    )

[sar-n-EDEV]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       IFACE"
network.interface.in.errors   = rxerr/s,,,,
network.interface.out.errors  = txerr/s,,,,
network.interface.collisions  = coll/s,,,,
network.interface.in.drops    = rxdrop/s,,,,
network.interface.out.drops   = txdrop/s,,,,
network.interface.out.carrier = txcarr/s,,,,
network.interface.in.frame    = rxfram/s,,,,
network.interface.in.fifo     = rxfifo/s,,,,
network.interface.out.fifo    = txfifo/s,,,,

[sar-n-NFSv4]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
rpc.client.rpccnt     = call/s,,,,12
rpc.client.rpcretrans = retrans/s,,,,
ops                   = nfs4.client.reqs
ops.label             = ops/s
ops.instances         = (read|write|access|getattr)

[sar-n-NFSDv4]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
rpc.server.rpccnt    = scall/s,,,,12
rpc.server.rpcerr    = badcall/s,,,,
rpc.server.netcnt    = packet/s,,,,
rpc.server.netudpcnt = udp/s,,,,
rpc.server.nettcpcnt = tcp/s,,,,
rpc.server.rchits    = hit/s,,,,
rpc.server.rcmisses  = miss/s,,,,
ops                  = nfs4.server.reqs
ops.label            = ops/s
ops.instances        = (read|write|access|getattr)

[sar-n-SOCK]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
network.sockstat.total      = totsck,,,,12
network.sockstat.tcp.inuse  = tcpsck,,,,
network.sockstat.udp.inuse  = udpsck,,,,
network.sockstat.raw.inuse  = rawsck,,,,
network.sockstat.frag.inuse = ip-frag,,,,
network.sockstat.tcp.tw     = tcp-tw,,,,

[sar-n-TCP-ETCP]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
network.tcp.activeopens  = active/s,,,,12
network.tcp.passiveopens = passive/s,,,,
network.tcp.insegs       = iseg/s,,,,
network.tcp.outsegs      = oseg/s,,,,
network.tcp.attemptfails = atmptf/s,,,,
network.tcp.estabresets  = estres/s,,,,
network.tcp.retranssegs  = retrans/s,,,,
network.tcp.inerrs       = isegerr/s,,,,
network.tcp.outrsts      = orsts/s,,,,

[sar-q]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
proc.runq.runnable = runq-sz,,,,12
kernel.all.nprocs  = plist-sz,,,,
kernel.all.load    = ldavg,,,,
kernel.all.blocked = blocked,,,,

[sar-r]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
mem.freemem        = kbmemfree,,,,12
mem.util.available = kbmemavail,,,,
memusedkb          = kbmemused,,,,
memusedkb.formula  = mem.physmem - mem.util.free - mem.util.bufmem - mem.util.cached - mem.util.slab
memusedpct         = %%memused,,,,
memusedpct.formula = 100 * (mem.physmem - mem.util.free - mem.util.bufmem - mem.util.cached - mem.util.slab) / mem.physmem
mem.util.bufmem    = kbbuffers,,,,
mem.util.cached    = kbcached,,,,
kbcommit           = mem.util.committed_AS
kbcommit.label     = kbcommit
commit             = %%commit,,,,
commit.formula     = 100 * mem.util.committed_AS / (mem.physmem + mem.util.swapTotal)
mem.util.active    = kbactive,,,,
mem.util.inactive  = kbinact,,,,
mem.util.dirty     = kbdirty,,,,

[sar-r-ALL]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
mem.freemem          = kbmemfree,,,,12
mem.util.available   = kbmemavail,,,,
memusedkb            = kbmemused,,,,
memusedkb.formula    = mem.physmem - mem.util.free - mem.util.bufmem - mem.util.cached - mem.util.slab
memusedpct           = %%memused,,,,
memusedpct.formula   = 100 * (mem.physmem - mem.util.free - mem.util.bufmem - mem.util.cached - mem.util.slab) / mem.physmem
mem.util.bufmem      = kbbuffers,,,,
mem.util.cached      = kbcached,,,,
kbcommit             = mem.util.committed_AS
kbcommit.label       = kbcommit
commit               = %%commit,,,,
commit.formula       = 100 * mem.util.committed_AS / (mem.physmem + mem.util.swapTotal)
mem.util.active      = kbactive,,,,
mem.util.inactive    = kbinact,,,,
mem.util.dirty       = kbdirty,,,,
mem.util.anonpages   = kbanonpg,,,,
mem.util.slab        = kbslab,,,,
mem.util.kernelStack = kbkstack,,,,
mem.util.pageTables  = kbpgtbl,,,,
mem.util.vmallocUsed = kbvmused,,,,

[sar-S]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
kbswpfree          = mem.util.swapFree
kbswpfree.label    = kbswpfree
kbswpfree.width    = 12
kbswpused          = kbswpused,,,,
kbswpused.formula  = mem.util.swapTotal - mem.util.swapFree
swpused            = %%swpused,,,,
swpused.formula    = 100 * (mem.util.swapTotal - mem.util.swapFree) / mem.util.swapTotal
kbswpcad           = mem.util.swapCached
kbswpcad.label     = kbswpcad
swpcad             = %%swpcad,,,,
swpcad.formula     = 100 * mem.util.swapCached / (mem.util.swapTotal - mem.util.swapFree)

[sar-u-ALL]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       CPU"
usr            = %%usr,,s,,
usr.formula    = 100 * kernel.all.cpu.vuser      / hinv.ncpu
nice           = %%nice,,s,,
nice.formula   = 100 * kernel.all.cpu.nice       / hinv.ncpu
sys            = %%sys,,s,,
sys.formula    = 100 * kernel.all.cpu.sys        / hinv.ncpu
iowait         = %%iowait,,s,,
iowait.formula = 100 * kernel.all.cpu.wait.total / hinv.ncpu
steal          = %%steal,,s,,
steal.formula  = 100 * kernel.all.cpu.steal      / hinv.ncpu
irq            = %%irq,,s,,
irq.formula    = 100 * kernel.all.cpu.irq.hard   / hinv.ncpu
soft           = %%soft,,s,,
soft.formula   = 100 * kernel.all.cpu.irq.soft   / hinv.ncpu
guest          = %%guest,,s,,
guest.formula  = 100 * kernel.all.cpu.guest      / hinv.ncpu
gnice          = %%gnice,,s,,
gnice.formula  = 100 * kernel.all.cpu.guest_nice / hinv.ncpu
idle           = %%idle,,s,,
idle.formula   = 100 * kernel.all.cpu.idle       / hinv.ncpu

[sar-u-ALL-P-ALL]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "       CPU"
usr             = %%usr,,s,,
usr.formula     = 100 * kernel.all.cpu.vuser      / hinv.ncpu
nice            = %%nice,,s,,
nice.formula    = 100 * kernel.all.cpu.nice       / hinv.ncpu
sys             = %%sys,,s,,
sys.formula     = 100 * kernel.all.cpu.sys        / hinv.ncpu
iowait          = %%iowait,,s,,
iowait.formula  = 100 * kernel.all.cpu.wait.total / hinv.ncpu
steal           = %%steal,,s,,
steal.formula   = 100 * kernel.all.cpu.steal      / hinv.ncpu
irq             = %%irq,,s,,
irq.formula     = 100 * kernel.all.cpu.irq.hard   / hinv.ncpu
soft            = %%soft,,s,,
soft.formula    = 100 * kernel.all.cpu.irq.soft   / hinv.ncpu
guest           = %%guest,,s,,
guest.formula   = 100 * kernel.all.cpu.guest      / hinv.ncpu
gnice           = %%gnice,,s,,
gnice.formula   = 100 * kernel.all.cpu.guest_nice / hinv.ncpu
idle            = %%idle,,s,,
idle.formula    = 100 * kernel.all.cpu.idle       / hinv.ncpu
pusr            = %%usr,,s,,
pusr.formula    = 100 * kernel.percpu.cpu.vuser
pnice           = %%nice,,s,,
pnice.formula   = 100 * kernel.percpu.cpu.nice
psys            = %%sys,,s,,
psys.formula    = 100 * kernel.percpu.cpu.sys
piowait         = %%iowait,,s,,
piowait.formula = 100 * kernel.percpu.cpu.wait.total
psteal          = %%steal,,s,,
psteal.formula  = 100 * kernel.percpu.cpu.steal
pirq            = %%irq,,s,,
pirq.formula    = 100 * kernel.percpu.cpu.irq.hard
psoft           = %%soft,,s,,
psoft.formula   = 100 * kernel.percpu.cpu.irq.soft
pguest          = %%guest,,s,,
pguest.formula  = 100 * kernel.percpu.cpu.guest
pgnice          = %%gnice,,s,,
pgnice.formula  = 100 * kernel.percpu.cpu.guest_nice
pidle           = %%idle,,s,,
pidle.formula   = 100 * kernel.percpu.cpu.idle

[sar-v]
header = yes
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
vfs.dentry.free  = dentunusd,,,,12
vfs.files.count  = file-nr,,,,9
inodes           = inode-nr,,,,9
inodes.formula   = vfs.inodes.count - vfs.inodes.free
kernel.all.nptys = pty-nr,,,,9

[sar-W]
header = yes
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
mem.vmstat.pswpin  = pswpin/s,,,,12
mem.vmstat.pswpout = pswpout/s,,,,9

[sar-w]
header = yes
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
kernel.all.sysfork = proc/s,,,,12
kernel.all.pswitch = cswch/s,,,,9

[sar-y]
header = yes
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "         TTY"
tty.serial.rx      = rcvin/s
tty.serial.tx      = txmtin/s
tty.serial.frame   = framerr/s
tty.serial.parity  = prtyerr/s
tty.serial.brk     = brk/s
tty.serial.overrun = ovrun/s
