2022-11-09 16:07:28 +00:00
|
|
|
package watcher
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.k-space.ee/k-space/logmower-shipper/pkg/globals"
|
|
|
|
prom "github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
|
|
)
|
|
|
|
|
2022-11-09 19:13:36 +00:00
|
|
|
const promSubsystem = "watcher"
|
|
|
|
|
2022-11-09 16:07:28 +00:00
|
|
|
var (
|
|
|
|
promWatcherOnline = promauto.NewGauge(prom.GaugeOpts{
|
2022-11-09 19:13:36 +00:00
|
|
|
Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
|
|
|
|
Name: "online",
|
|
|
|
Help: "1 if initialized, and directory watcher has been engaged successfully",
|
2022-11-09 16:07:28 +00:00
|
|
|
})
|
|
|
|
promWatcherErr = promauto.NewCounter(prom.CounterOpts{
|
2022-11-09 19:13:36 +00:00
|
|
|
Namespace: globals.PrometheusPrefix, Subsystem: promSubsystem,
|
|
|
|
Name: "errors",
|
|
|
|
Help: "Error in logmower watching log files",
|
2022-11-09 16:07:28 +00:00
|
|
|
})
|
|
|
|
promWatcherFilesStarted = promauto.NewCounter(prom.CounterOpts{
|
2022-11-09 19:13:36 +00:00
|
|
|
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
|
|
|
|
Name: "log_file", // "discovered_logfiles",
|
|
|
|
Help: "Number of tracked log files",
|
2022-11-09 16:07:28 +00:00
|
|
|
})
|
|
|
|
promWatcherFilesSkipped = promauto.NewCounter(prom.CounterOpts{
|
2022-11-09 19:13:36 +00:00
|
|
|
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
|
|
|
|
Name: "invalid_filename", // "skipped_files",
|
|
|
|
Help: "Number of files in log directory skipped due to unexpected filename",
|
2022-11-09 16:07:28 +00:00
|
|
|
})
|
|
|
|
promWatcherEvents = promauto.NewCounter(prom.CounterOpts{
|
2022-11-09 19:13:36 +00:00
|
|
|
Namespace: globals.PrometheusPrefix, // Subsystem: promSubsystem,
|
|
|
|
Name: "inotify_event", // "events",
|
|
|
|
Help: "Number of events while watchng (includes initial create events for existing file discovery)",
|
2022-11-09 16:07:28 +00:00
|
|
|
})
|
|
|
|
)
|