Add exec_boot_time for freebsd, dragonfly

Adds new sysctl type, bsdSysctlTypeStructTimeval to enable parsing of
timevals from raw memory.
This commit is contained in:
Derek Marcotte 2017-04-11 06:04:14 -04:00
commit db8ec9c6b4
3 changed files with 61 additions and 7 deletions

View file

@ -39,6 +39,9 @@ func NewExecCollector() (Collector, error) {
// vm.stats.sys.v_intr: Device interrupts
// vm.stats.sys.v_soft: Software interrupts
// vm.stats.vm.v_forks: Number of fork() calls
//
// From sys/kern/kern_tc.c:
// kern.boottime is an S,timeval
return &execCollector{
sysctls: []bsdSysctl{
@ -72,6 +75,12 @@ func NewExecCollector() (Collector, error) {
description: "Number of fork() calls since system boot. Resets at architeture unsigned integer.",
mib: "vm.stats.vm.v_forks",
},
{
name: "boot_time",
description: "Unix time of last boot, including microseconds.",
mib: "kern.boottime",
dataType: bsdSysctlTypeStructTimeval,
},
},
}, nil
}