brother

package
v0.0.0-...-c2cca05 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigMap = map[string]Config{
	"Brother HL-L2350DW series": Config{
		Info: []ColumnName{
			"Node Name",
			"Model Name",
			"Location",
			"Contact",
			"IP Address",
			"Serial No.",
			"Main Firmware Version",
			"Memory Size",
		},
		GroupToLabels: []GroupToLabels{
			GroupToLabels{
				MetricNameSuffix:             "part_remaining_life_ratio",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(`^% of Life Remaining\((.+)\)$`),
				LabelName:                    "part",
				ValueMapFn:                   divideBy100,
			},
			GroupToLabels{
				MetricNameSuffix: "pages_printed_by_paper_size_total",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(
					"^(A4/Letter|Legal/Folio|B5/Executive|Envelopes|A5|Others)$",
				),
				LabelName: "paper_size",
				MinColumn: 12,
				MaxColumn: 17,
			},
			GroupToLabels{
				MetricNameSuffix: "pages_printed_by_paper_type_total",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(
					"^(Plain/Thin/Recycled|Thick/Thicker/Bond|Envelopes/Env. Thick/Env. Thin|Label|Hagaki)$",
				),
				LabelName: "paper_type",
			},
			GroupToLabels{
				MetricNameSuffix:             "part_replace_total",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(`^Replace Count\((.+)\)$`),
				LabelName:                    "part",
			},
			GroupToLabels{
				MetricNameSuffix: "paper_jam_total",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(
					"^(Jam Tray 1|Jam Inside|Jam Rear|Jam 2-sided)$",
				),
				LabelName: "location",
			},
			GroupToLabels{
				MetricNameSuffix:             "errors_total",
				ColumnNameToLabelValueRegexp: regexp.MustCompile(`^Error Count ([0-9]+)$`),
				LabelName:                    "number",
			},
		},
		Plains: []Plain{
			Plain{
				ColumnName:       ColumnName("Print"),
				MetricNameSuffix: "pages_printed_total",
				Labels: prometheus.Labels{
					"type": "print",
				},
			},
			Plain{
				ColumnName:       ColumnName("Print 2-sided Print"),
				MetricNameSuffix: "duplex_pages_printed_total",
				Labels: prometheus.Labels{
					"type": "print",
				},
			},
			Plain{
				ColumnName:       ColumnName("Others"),
				MetricNameSuffix: "pages_printed_total",
				Labels: prometheus.Labels{
					"type": "others",
				},
				MinColumn: 23,
				MaxColumn: 28,
			},
			Plain{
				ColumnName:       ColumnName("Others 2-sided Print"),
				MetricNameSuffix: "duplex_pages_printed_total",
				Labels: prometheus.Labels{
					"type": "others",
				},
			},
			Plain{
				ColumnName:       ColumnName("Average Coverage"),
				MetricNameSuffix: "average_coverage_ratio",
				ValueMapFn:       divideBy100,
			},
		},
		Ignore: []ColumnName{
			"Page Counter",
			"Total",
			"Total 2-sided Print",
			"Total Paper Jams",
		},
	},
}

Functions

func ReadMaintenanceInfo

func ReadMaintenanceInfo(ioReader io.Reader) (*prometheus.TimeSeriesGroup, error)

Types

type ColumnName

type ColumnName string

type ColumnNumber

type ColumnNumber int

type Config

type Config struct {
	Info          []ColumnName
	GroupToLabels []GroupToLabels
	Plains        []Plain
	Ignore        []ColumnName
}

func (*Config) GetTimeSeriesGroup

func (c *Config) GetTimeSeriesGroup(entries Entries) (*prometheus.TimeSeriesGroup, error)

type Entries

type Entries []Entry

func (Entries) GetByColumnName

func (entries Entries) GetByColumnName(columnName ColumnName) (*Entry, bool, error)

func (Entries) GetByColumnNumber

func (entries Entries) GetByColumnNumber(columnNumber ColumnNumber) (*Entry, bool, error)

type Entry

type Entry struct {
	ColumnNumber ColumnNumber
	ColumnName   ColumnName
	Value        string
}

type GroupToLabels

type GroupToLabels struct {
	MetricNameSuffix             string
	ColumnNameToLabelValueRegexp *regexp.Regexp
	LabelName                    string
	ValueMapFn                   ValueMapFn
	MinColumn                    ColumnNumber
	MaxColumn                    ColumnNumber
}

type Plain

type Plain struct {
	ColumnName       ColumnName
	MetricNameSuffix string
	ValueMapFn       ValueMapFn
	Labels           prometheus.Labels
	MinColumn        ColumnNumber
	MaxColumn        ColumnNumber
}

type ValueMapFn

type ValueMapFn func(string) (float64, error)

Jump to

Keyboard shortcuts

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