From 3ced80875717eb77777946ac0a48f45c224eb59f Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Wed, 27 Nov 2024 14:33:53 +0100
Subject: Add interval option
---
main.go | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/main.go b/main.go
index 1f5c201..2e3a136 100644
--- a/main.go
+++ b/main.go
@@ -16,10 +16,11 @@ import (
)
var (
- path string
- httpPort int
httpHost string
+ httpPort int
+ interval int
namespace string
+ path string
subsystem string
gauges map[string]*prometheus.GaugeVec
@@ -27,10 +28,11 @@ var (
func main() {
// Set options
- flag.StringVar(&path, "path", "", "The path to export metrics of")
- flag.IntVar(&httpPort, "port", 9091, "The path to export metrics of")
flag.StringVar(&httpHost, "host", "[::]", "The path to export metrics of")
+ flag.IntVar(&httpPort, "port", 9091, "The path to export metrics of")
+ flag.IntVar(&interval, "interval", 10, "The path to export metrics of")
flag.StringVar(&namespace, "namespace", "fsdir_exporter", "Namespace to use for the Prometheus metrics")
+ flag.StringVar(&path, "path", "", "The path to export metrics of")
flag.StringVar(&subsystem, "subsystem", "", "Subsystem to use for the Prometheus metrics")
flag.Parse()
@@ -136,7 +138,7 @@ func update() {
}
func updateLoop() {
- for range time.Tick(time.Duration(10) * time.Second) {
+ for range time.Tick(time.Duration(interval) * time.Second) {
update()
}
}
--
cgit v1.2.3