func (s *Sensu) ParseLine(lineToParse string) (Metric, error) {
	f := func(c rune) bool {
		return c == ' '
	}
	dot := func(c rune) bool {
		return c == '.'
	}
	underscore := func(c rune) bool {
		return c == '_'
	}
	fields := strings.FieldsFunc(lineToParse, f)
	line := ParsedLine{}
	m := Metric{}
	if len(fields) == 3 {
		toFloat, _ := strconv.ParseFloat(fields[1], 64)
		value := strconv.FormatFloat(toFloat, 'f', -1, 64)
		metricFields := strings.FieldsFunc(fields[0], dot)
		var cleanName string
		var pluginName string
		if len(metricFields) > 2 {
			cleanName = strings.Join(metricFields[2:], ".")
			pluginName = "sensu." + metricFields[1]
		} else {
			cleanName = strings.Join(metricFields[:], ".")
			pluginName = "sensu." + cleanName
		}
		CleanMetricFields := strings.FieldsFunc(cleanName, dot)
		splitOnUnderscore := strings.FieldsFunc(cleanName, underscore)
		if len(CleanMetricFields) > 1 {
			line.Elements = CleanMetricFields
		} else {
			line.Elements = splitOnUnderscore
		}
		elements := line.Elements
		if len(elements) > 2 {
			chart := strings.Join(elements[:2], "_")
			line := strings.Join(elements[2:], "_")
			m.Gauge = chart + "." + line
		} else {
			chart := elements[0]
			line := strings.Join(elements[1:], "_")
			m.Gauge = chart + "." + line
		}
		m.Value = value
		m.Plugin = pluginName
	}
	return m, nil
}
ParseLine - XXX
package sensu
import (
	"encoding/json"
	"strconv"
	"strings"
	"sync"
	log "github.com/Sirupsen/logrus"
	"github.com/amonapp/amonagent/internal/util"
	"github.com/amonapp/amonagent/plugins"
)
func (s *Sensu) Start() error {
	return nil
}
func (s *Sensu) Stop() {
}
func (s *Sensu) Description() string {
	return "Collects data from Sensu plugins"
}
var sampleConfig = `
#   Available config options:
#
#    [
#        "metrics-es-node-graphite.rb",
#        "metrics-net.rb",
#        "metrics-redis-graphite.rb",
#        "metrics-iostat-extended.rb"
#    ]
#
#    List of preinstalled sensu plugins + params
#
# Config location: /etc/opt/amonagent/plugins-enabled/sensu.conf
`
func (s *Sensu) SampleConfig() string {
	return sampleConfig
}
type Sensu struct {
	Config Config
}
type Config struct {
	Commands []util.Command `json:"commands"`
}
func (s *Sensu) SetConfigDefaults() error {
	if len(s.Config.Commands) > 0 {
		return nil
	}
	configFile, err := plugins.ReadPluginConfig("sensu")
	if err != nil {
		log.WithFields(log.Fields{
			"plugin": "sensu",
			"error":  err,
		}).Error("Can't read config file")
		return err
	}
	var Commands []util.Command
	var CommandStrings []string
	if e := json.Unmarshal(configFile, &CommandStrings); e != nil {
		log.WithFields(log.Fields{"plugin": "sensu", "error": e.Error()}).Error("Can't decode JSON file")
		return e
	}
	for _, str := range CommandStrings {
		var command = util.Command{Command: str}
		Commands = append(Commands, command)
	}
	s.Config.Commands = Commands
	return nil
}
func (m Metric) String() string {
	s, _ := json.Marshal(m)
	return string(s)
}
type Metric struct {
	Plugin string `json:"plugin"`
	Gauge  string `json:"gauge"`
	Value  string `json:"value"`
}
type ParsedLine struct {
	Plugin   string
	Elements []string
	Value    string
}