mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 15:46:36 +00:00
Set relative default path for textfile collector
Signed-off-by: Artamonov Evgenii <evgenyi.artamonov@gmail.com>
This commit is contained in:
committed by
Artamonov Evgenii
parent
941b66d342
commit
d0cfc14af9
@@ -38,7 +38,7 @@ 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\\windows_exporter\\textfile_inputs").String()
|
).Default(getDefaultPath()).String()
|
||||||
|
|
||||||
mtimeDesc = prometheus.NewDesc(
|
mtimeDesc = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, "textfile", "mtime_seconds"),
|
prometheus.BuildFQName(Namespace, "textfile", "mtime_seconds"),
|
||||||
@@ -335,3 +335,8 @@ func checkBOM(encoding utfbom.Encoding) error {
|
|||||||
|
|
||||||
return fmt.Errorf(encoding.String())
|
return fmt.Errorf(encoding.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDefaultPath() string {
|
||||||
|
execPath, _ := os.Executable()
|
||||||
|
return filepath.Join(execPath, "textfile_inputs")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user