func (c *Custom) Description() string {
	return "Collects metrics from custom collectors"
}
Description - XXX
package custom
import (
	"encoding/json"
	"strconv"
	"strings"
	"sync"
	log "github.com/Sirupsen/logrus"
	"github.com/amonapp/amonagent/internal/util"
	"github.com/amonapp/amonagent/plugins"
)
type Metric struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
	Type  string  `json:"type"`
}
func ParseLine(s string) (Metric, error) {
	f := func(c rune) bool {
		return c == '|' || c == ':'
	}
	fields := strings.FieldsFunc(s, f)
	m := Metric{}
	if len(fields) == 3 {
		if s, err := strconv.ParseFloat(fields[1], 64); err == nil {
			m = Metric{Name: fields[0], Value: s, Type: fields[2]}
		}
	}
	return m, nil
}
func (c *Custom) Start() error { return nil }
func (c *Custom) Stop() {}
var sampleConfig = `
#   Available config options:
#
#  A JSON list with commands
#   [
#    {
#        "command":"python /path/to/yourplugin.py",
#        "name":"requests"
#    },
#    {
#        "command":"python /path/to/yourpingplugin.py",
#        "name":"ping"
#    },
#   ]
#
#  You can create a custom plugin in any language. Amon parses all the lines from STDOUT:
#
#   Format: metric.line_on_chart_name:value|type
#   Example:
#   requests.per_second:12|gauge
#
#   Available types: counter and gauge
#
#   To group metrics on a single chart:
#
#     connections.active:12|gauge
#     connections.waiting:12|gauge
#
#    In Python you can emmit metrics with:
#    print "requests.per_second:12|gauge"
#
#    In Bash with printf "requests.per_second:12|gauge\n", Ruby "puts requests.per_second:12|gauge"
#
# Config location: /etc/opt/amonagent/plugins-enabled/custom.conf
`
func (c *Custom) SampleConfig() string {
	return sampleConfig
}
type Custom struct {
	Config Config
}
type Config struct {
	Commands []util.Command `json:"commands"`
}
func (c *Custom) SetConfigDefaults() error {
	if len(c.Config.Commands) > 0 {
		return nil
	}
	configFile, err := plugins.ReadPluginConfig("custom")
	if err != nil {
		log.WithFields(log.Fields{
			"plugin": "custom",
			"error":  err,
		}).Error("Can't read config file")
	}
	var Commands []util.Command
	if e := json.Unmarshal(configFile, &Commands); e != nil {
		log.WithFields(log.Fields{"plugin": "custom", "error": e.Error()}).Error("Can't decode JSON file")
	}
	c.Config.Commands = Commands
	return nil
}
func (p PerformanceStruct) String() string {
	s, _ := json.Marshal(p)
	return string(s)
}
type PerformanceStruct struct {
	Gauges   map[string]interface{} `json:"gauges,omitempty"`
	Counters map[string]interface{} `json:"counters,omitempty"`
}
func (p PerformanceStructBlock) String() string {
	s, _ := json.Marshal(p)
	return string(s)
}
type PerformanceStructBlock map[string]PerformanceStruct