github.com/netdata/go.d.plugin@v0.58.1/modules/couchbase/init.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package couchbase
     4  
     5  import (
     6  	"errors"
     7  	"net/http"
     8  
     9  	"github.com/netdata/go.d.plugin/agent/module"
    10  	"github.com/netdata/go.d.plugin/pkg/web"
    11  )
    12  
    13  func (cb *Couchbase) initCharts() (*Charts, error) {
    14  	var bucketCharts = module.Charts{
    15  		bucketQuotaPercentUsedChart.Copy(),
    16  		bucketOpsPerSecChart.Copy(),
    17  		bucketDiskFetchesChart.Copy(),
    18  		bucketItemCountChart.Copy(),
    19  		bucketDiskUsedChart.Copy(),
    20  		bucketDataUsedChart.Copy(),
    21  		bucketMemUsedChart.Copy(),
    22  		bucketVBActiveNumNonResidentChart.Copy(),
    23  	}
    24  	return bucketCharts.Copy(), nil
    25  }
    26  
    27  func (cb Couchbase) initHTTPClient() (*http.Client, error) {
    28  	return web.NewHTTPClient(cb.Client)
    29  }
    30  
    31  func (cb Couchbase) validateConfig() error {
    32  	if cb.URL == "" {
    33  		return errors.New("URL not set")
    34  	}
    35  	if _, err := web.NewHTTPRequest(cb.Request); err != nil {
    36  		return err
    37  	}
    38  	return nil
    39  }