func (c *ResourceCollector) Get(ch chan<- prometheus.Metric) (float64, error) {
	jsonResources, err := getResourceStats()
	if err != nil {
		totalResourceErrors++
		return totalResourceErrors, fmt.Errorf("cannot get resources: %s", err)
	}
	if err := processResourceStats(ch, jsonResources); err != nil {
		totalResourceErrors++
		return totalResourceErrors, err
	}
	return totalResourceErrors, nil
}
Get metrics and send to the Prometheus.Metric channel.
package collector
import (
	"encoding/json"
	"fmt"
	"os/exec"
	"strings"
	"github.com/prometheus/client_golang/prometheus"
	kingpin "gopkg.in/alecthomas/kingpin.v2"
)
var (
	resourceSubsystem = "resource"
	resourceLabels = []string{"resource"}
	resourceDesc = map[string]*prometheus.Desc{
		"max":  colPromDesc(resourceSubsystem, "maximum", "Resource Maximum.", resourceLabels),
		"used": colPromDesc(resourceSubsystem, "used", "Resource Used.", resourceLabels),
	}
	totalResourceErrors = 0.0
	cumulusCLResPath = kingpin.Flag("cumulus.cl-resource-query.path", "Path of cl-resource-query.").Default("/usr/cumulus/bin/cl-resource-query").String()
)
func init() {
	registerCollector(resourceSubsystem, enabledByDefault, NewResourceCollector)
}
type ResourceCollector struct{}
func NewResourceCollector() Collector {
	return &ResourceCollector{}
}