mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 15:46:36 +00:00
gofmt
This commit is contained in:
@@ -40,9 +40,7 @@ func NewMSMQCollector() (Collector, error) {
|
|||||||
wc.WriteString(*msmqWhereClause)
|
wc.WriteString(*msmqWhereClause)
|
||||||
log.Println("warning: No where-clause specified for msmq collector. This will generate a very large number of metrics!")
|
log.Println("warning: No where-clause specified for msmq collector. This will generate a very large number of metrics!")
|
||||||
}
|
}
|
||||||
// else {
|
|
||||||
// log.Println("warning: No where-clause specified for msmq collector. This will generate a very large number of metrics!")
|
|
||||||
// }
|
|
||||||
return &Win32_PerfRawData_MSMQ_MSMQQueueCollector{
|
return &Win32_PerfRawData_MSMQ_MSMQQueueCollector{
|
||||||
BytesinJournalQueue: prometheus.NewDesc(
|
BytesinJournalQueue: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "bytes_in_journal_queue"),
|
prometheus.BuildFQName(Namespace, subsystem, "bytes_in_journal_queue"),
|
||||||
@@ -128,6 +126,6 @@ func (c *Win32_PerfRawData_MSMQ_MSMQQueueCollector) collect(ch chan<- prometheus
|
|||||||
float64(msmq.MessagesinQueue),
|
float64(msmq.MessagesinQueue),
|
||||||
strings.ToLower(msmq.Name),
|
strings.ToLower(msmq.Name),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ type OSCollector struct {
|
|||||||
PagingLimitBytes *prometheus.Desc
|
PagingLimitBytes *prometheus.Desc
|
||||||
VirtualMemoryBytes *prometheus.Desc
|
VirtualMemoryBytes *prometheus.Desc
|
||||||
VisibleMemoryBytes *prometheus.Desc
|
VisibleMemoryBytes *prometheus.Desc
|
||||||
Time *prometheus.Desc
|
Time *prometheus.Desc
|
||||||
Timezone *prometheus.Desc
|
Timezone *prometheus.Desc
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOSCollector ...
|
// NewOSCollector ...
|
||||||
@@ -132,7 +132,7 @@ type Win32_OperatingSystem struct {
|
|||||||
SizeStoredInPagingFiles uint64
|
SizeStoredInPagingFiles uint64
|
||||||
TotalVirtualMemorySize uint64
|
TotalVirtualMemorySize uint64
|
||||||
TotalVisibleMemorySize uint64
|
TotalVisibleMemorySize uint64
|
||||||
LocalDateTime time.Time
|
LocalDateTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *OSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
func (c *OSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||||
|
|||||||
@@ -28,16 +28,16 @@ import (
|
|||||||
dto "github.com/prometheus/client_model/go"
|
dto "github.com/prometheus/client_model/go"
|
||||||
"github.com/prometheus/common/expfmt"
|
"github.com/prometheus/common/expfmt"
|
||||||
"github.com/prometheus/common/log"
|
"github.com/prometheus/common/log"
|
||||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
textFileDirectory = kingpin.Flag(
|
textFileDirectory = kingpin.Flag(
|
||||||
"collector.textfile.directory",
|
"collector.textfile.directory",
|
||||||
"Directory to read text files with metrics from.",
|
"Directory to read text files with metrics from.",
|
||||||
).Default("C:\\Program Files\\wmi_exporter\\textfile_inputs").String()
|
).Default("C:\\Program Files\\wmi_exporter\\textfile_inputs").String()
|
||||||
|
|
||||||
mtimeDesc = prometheus.NewDesc(
|
mtimeDesc = prometheus.NewDesc(
|
||||||
"wmi_textfile_mtime_seconds",
|
"wmi_textfile_mtime_seconds",
|
||||||
"Unixtime mtime of textfiles successfully read.",
|
"Unixtime mtime of textfiles successfully read.",
|
||||||
[]string{"file"},
|
[]string{"file"},
|
||||||
@@ -149,8 +149,8 @@ func convertMetricFamily(metricFamily *dto.MetricFamily, ch chan<- prometheus.Me
|
|||||||
buckets, values...,
|
buckets, values...,
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
log.Errorf("unknown metric type for file")
|
log.Errorf("unknown metric type for file")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if metricType == dto.MetricType_GAUGE || metricType == dto.MetricType_COUNTER || metricType == dto.MetricType_UNTYPED {
|
if metricType == dto.MetricType_GAUGE || metricType == dto.MetricType_COUNTER || metricType == dto.MetricType_UNTYPED {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ func expandEnabledCollectors(enabled string) []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result := make([]string, 0, len(unique))
|
result := make([]string, 0, len(unique))
|
||||||
for s, _ := range unique {
|
for s := range unique {
|
||||||
result = append(result, s)
|
result = append(result, s)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user