diff --git a/go.mod b/go.mod index cad9343..d98dbe4 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/go-logr/logr v0.3.0 github.com/go-logr/zapr v0.3.0 - github.com/phin1x/go-ipp v1.5.0 + github.com/phin1x/go-ipp v1.2.1-0.20191226192803-6c9dee854ace github.com/prometheus/client_golang v1.9.0 go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.16.0 diff --git a/go.sum b/go.sum index 79d1d64..f50695b 100644 --- a/go.sum +++ b/go.sum @@ -204,8 +204,8 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/phin1x/go-ipp v1.5.0 h1:3WLi0RLI3LbF93lHK7TBsK7h53u8tNXZNEokfFOurno= -github.com/phin1x/go-ipp v1.5.0/go.mod h1:GZwyNds6grdLi2xRBX22Cvt7Dh7ITWsML0bjrqBF5uo= +github.com/phin1x/go-ipp v1.2.1-0.20191226192803-6c9dee854ace h1:ELNodn+xPzMsqbwObNVFRt/OYlcCEw51IlRYdCtURcM= +github.com/phin1x/go-ipp v1.2.1-0.20191226192803-6c9dee854ace/go.mod h1:GZwyNds6grdLi2xRBX22Cvt7Dh7ITWsML0bjrqBF5uo= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/pkg/printers.go b/pkg/printers.go index 68d1361..77ba260 100644 --- a/pkg/printers.go +++ b/pkg/printers.go @@ -18,12 +18,12 @@ func (e *Exporter) printerMetrics(ch chan<- prometheus.Metric) error { printer := attr["printer-name"][0].Value.(string) - states := make(map[int8]int) + states := make(map[ipp.PrinterState]int) states[ipp.PrinterStateIdle] = 0 states[ipp.PrinterStateProcessing] = 0 states[ipp.PrinterStateStopped] = 0 - states[int8(attr["printer-state"][0].Value.(int))]++ + states[ipp.PrinterState(attr["printer-state"][0].Value.(int))]++ ch <- prometheus.MustNewConstMetric(e.printerStateTotal, prometheus.GaugeValue, float64(states[ipp.PrinterStateIdle]), printer, "idle") ch <- prometheus.MustNewConstMetric(e.printerStateTotal, prometheus.GaugeValue, float64(states[ipp.PrinterStateProcessing]), printer, "processing")