github.com/netdata/go.d.plugin@v0.58.1/modules/lighttpd/collect.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package lighttpd
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/netdata/go.d.plugin/pkg/stm"
     9  )
    10  
    11  func (l *Lighttpd) collect() (map[string]int64, error) {
    12  	status, err := l.apiClient.getServerStatus()
    13  
    14  	if err != nil {
    15  		return nil, err
    16  	}
    17  
    18  	mx := stm.ToMap(status)
    19  
    20  	if len(mx) == 0 {
    21  		return nil, fmt.Errorf("nothing was collected from %s", l.URL)
    22  	}
    23  
    24  	return mx, nil
    25  }