collector: add openbsd support to interrupt collector

This commit is contained in:
Nick Owens 2015-11-01 22:55:46 -08:00
commit 73ee8f5257
3 changed files with 197 additions and 22 deletions

View file

@ -27,28 +27,9 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
type interruptsCollector struct {
metric *prometheus.CounterVec
}
func init() {
Factories["interrupts"] = NewInterruptsCollector
}
// Takes a prometheus registry and returns a new Collector exposing
// interrupts stats
func NewInterruptsCollector() (Collector, error) {
return &interruptsCollector{
metric: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Name: "interrupts",
Help: "Interrupt details.",
},
[]string{"CPU", "type", "info", "devices"},
),
}, nil
}
var (
interruptLabelNames = []string{"CPU", "type", "info", "devices"}
)
func (c *interruptsCollector) Update(ch chan<- prometheus.Metric) (err error) {
interrupts, err := getInterrupts()