func (backend *Config) InitPrometheus(vcenter string) error {
	backend.promCollectors[vcenter] = &PrometheusBackend{Config: backend, Target: vcenter}
	return nil
}
InitPrometheus : Init Multiple channels for prometheus
package backend
import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"github.com/cblomart/vsphere-graphite/utils"
	"log"
	"net/http"
	"strconv"
	"strings"
	"time"
	"github.com/cblomart/vsphere-graphite/backend/thininfluxclient"
	"github.com/fluent/fluent-logger-golang/fluent"
	influxclient "github.com/influxdata/influxdb1-client/v2"
	graphite "github.com/marpaia/graphite-golang"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	kafka "github.com/segmentio/kafka-go"
	"github.com/segmentio/kafka-go/gzip"
	elastic "gopkg.in/olivere/elastic.v5"
)
type Channels struct {
	Request *chan Point
	Target  string
}
type Backend interface {
	Init(config Config) error
	Disconnect()
	SendMetrics(metrics []*Point)
}
type MapStr map[string]interface{}
const (
	Graphite = "graphite"
	InfluxDB = "influxdb"
	ThinInfluxDB = "thininfluxdb"
	InfluxTag = "influx"
	Elastic = "elastic"
	Prometheus = "prometheus"
	Fluentd = "fluentd"
	ThinPrometheus = "thinprometheus"
	Kafka = "kafka"
)
var (
	queries *chan Channels
	prefix  string
)
func (backend *Config) Init() (*chan Channels, error) {
	q := make(chan Channels)
	queries = &q
	prefix = backend.Prefix
	if len(backend.ValueField) == 0 {
		backend.ValueField = "Value"
	}
	switch backendType := strings.ToLower(backend.Type); backendType {
	case Graphite:
		log.Printf("backend %s: intializing\n", backendType)
		carbon, err := graphite.NewGraphite(backend.Hostname, backend.Port)
		if err != nil {
			log.Printf("backend %s: error connecting to graphite - %s\n", backendType, err)
			return queries, err
		}
		backend.carbon = carbon
		return queries, nil
	case InfluxDB:
		log.Printf("backend %s: intializing\n", backendType)
		protocol := "http"
		if backend.Encrypted {
			protocol = "https"
		}
		influxclt, err := influxclient.NewHTTPClient(influxclient.HTTPConfig{
			Addr:     fmt.Sprintf("%s://%s:%d", protocol, backend.Hostname, backend.Port),
			Username: backend.Username,
			Password: backend.Password,
		})
		if err != nil {
			log.Printf("backend %s: error connecting - %s\n", backendType, err)
			return queries, err
		}
		backend.influx = &influxclt
		return queries, nil
	case ThinInfluxDB:
		log.Printf("backend %s: initializing\n", backendType)
		thininfluxclt, err := thininfluxclient.NewThinInfluxClient(backend.Hostname, backend.Port, backend.Database, backend.Username, backend.Password, "s", backend.Encrypted)
		if err != nil {
			log.Printf("backend %s: error creating client - %s\n", backendType, err)
			return queries, err
		}
		backend.thininfluxdb = &thininfluxclt
		return queries, nil
	case Elastic:
		log.Printf("backend %s: initializing\n", backendType)
		elasticindex := backend.Database
		if len(elasticindex) > 0 {
			elasticindex = elasticindex + "-" + time.Now().Format("2006.01.02")
		} else {
			log.Printf("backend %s: Database not specified in vsphere-graphite.json (used as index)\n", backendType)
		}
		log.Printf("backend %s: %s:%d/%s\n", backendType, backend.Hostname, backend.Port, elasticindex)
		protocol := "http"
		if backend.Encrypted {
			protocol = "https"
		}
		elasticclt, err := elastic.NewClient(
			elastic.SetURL(protocol+"://"+backend.Hostname+":"+strconv.Itoa(backend.Port)),
			elastic.SetRetrier(elastic.NewBackoffRetrier(elastic.NewSimpleBackoff(100, 500, 2000, 5000, 10000))),  
			elastic.SetScheme(protocol),
			elastic.SetBasicAuth(backend.Username, backend.Password),
			elastic.SetSniff(true))
		if err != nil {
			log.Printf("backend %s: error creating client - %s\n", backendType, err)
			return queries, err
		}
		backend.elastic = elasticclt
		return queries, CreateIndexIfNotExists(backend.elastic, elasticindex)
	case Prometheus:
		log.Printf("backend %s: initializing\n", backendType)
		registry := prometheus.NewRegistry()
		err := registry.Register(&PrometheusBackend{Config: backend})
		if err != nil {
			log.Printf("backend %s: error creating registry - %s\n", backendType, err)
			return queries, err
		}
		http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{ErrorHandling: promhttp.ContinueOnError}))
		http.HandleFunc("/scrape", backend.scrapeHandler)
		backend.promCollectors = make(map[string]*PrometheusBackend)
		go func() error {
			address := ""
			if len(backend.Hostname) > 0 {
				if backend.Hostname != "*" {
					address = backend.Hostname
				}
			}
			if backend.Port > 0 {
				address += ":" + utils.ValToString(backend.Port, "", false)
			} else {
				address += ":9155"
			}
			log.Printf("backend %s: starting listener on %s\n", backendType, address)
			err := http.ListenAndServe(address, nil)
			log.Printf("backend %s: listener result - %s\n", backendType, err)
			return err
		}()
		return queries, nil
	case Fluentd:
		log.Printf("backend %s: initializing\n", backendType)
		fluentclt, err := fluent.New(fluent.Config{FluentPort: backend.Port, FluentHost: backend.Hostname, MarshalAsJSON: true, RequestAck: true})
		if err != nil {
			log.Printf("backend %s: error connecting - %s\n", backendType, err)
			return queries, err
		}
		backend.fluent = fluentclt
		return queries, nil
	case ThinPrometheus:
		log.Printf("backend %s: initializing\n", backendType)
		client, err := NewThinPrometheusClient(backend.Hostname, backend.Port)
		if err != nil {
			log.Printf("backend %s: error connecting - %s\n", backendType, err)
			return nil, err
		}
		go func() {
			err := client.ListenAndServe()
			if err != nil {
				log.Printf("backend %s: error starting listener - %s", backendType, err)
			}
		}()
		return queries, nil
	case Kafka:
		log.Printf("backend %s: initializing\n", backendType)
		kafkaclt := kafka.NewWriter(kafka.WriterConfig{
			Brokers:          []string{backend.Hostname + ":" + strconv.Itoa(backend.Port)},
			Topic:            backend.Database,
			Balancer:         &kafka.LeastBytes{},
			CompressionCodec: gzip.NewCompressionCodec(),
			RequiredAcks:     1,  
		})
		log.Printf("backend %s: broker:%s:%d topic:%s\n", backendType, backend.Hostname, backend.Port, backend.Database)
		backend.kafka = kafkaclt
		return queries, nil
	default:
		log.Printf("backend %s: unknown backend\n", backendType)
		return queries, errors.New("backend " + backendType + " unknown.")
	}
}