github.com/netdata/go.d.plugin@v0.58.1/modules/windows/collect_system.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package windows
     4  
     5  import (
     6  	"time"
     7  
     8  	"github.com/netdata/go.d.plugin/pkg/prometheus"
     9  )
    10  
    11  const (
    12  	metricSysSystemUpTime = "windows_system_system_up_time"
    13  	metricSysThreads      = "windows_system_threads"
    14  )
    15  
    16  func (w *Windows) collectSystem(mx map[string]int64, pms prometheus.Series) {
    17  	if !w.cache.collection[collectorSystem] {
    18  		w.cache.collection[collectorSystem] = true
    19  		w.addSystemCharts()
    20  	}
    21  
    22  	px := "system_"
    23  	if pm := pms.FindByName(metricSysSystemUpTime); pm.Len() > 0 {
    24  		mx[px+"up_time"] = time.Now().Unix() - int64(pm.Max())
    25  	}
    26  	if pm := pms.FindByName(metricSysThreads); pm.Len() > 0 {
    27  		mx[px+"threads"] = int64(pm.Max())
    28  	}
    29  }