Skip to content

Commit b98ac8e

Browse files
committed
generic flags moved to exporter-toolkit
Signed-off-by: kwilt <[email protected]>
1 parent 5050288 commit b98ac8e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

main.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,9 @@ var (
5151
concurrency = kingpin.Flag("snmp.module-concurrency", "The number of modules to fetch concurrently per scrape").Default("1").Int()
5252
debugSNMP = kingpin.Flag("snmp.debug-packets", "Include a full debug trace of SNMP packet traffics.").Default("false").Bool()
5353
expandEnvVars = kingpin.Flag("config.expand-environment-variables", "Expand environment variables to source secrets").Default("false").Bool()
54-
externalURL = kingpin.Flag("web.external-url", "The URL under which snmp exporter is externally reachable (for example, if snmp exporter is served via a reverse proxy). Used for generating relative and absolute links back to snmp exporter itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by snmp exporter. If omitted, relevant URL components will be derived automatically.").PlaceHolder("<url>").String()
55-
routePrefix = kingpin.Flag("web.route-prefix", "Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.").PlaceHolder("<path>").String()
56-
metricsPath = kingpin.Flag(
57-
"web.telemetry-path",
58-
"Path under which to expose metrics.",
59-
).Default("/metrics").String()
60-
toolkitFlags = webflag.AddFlags(kingpin.CommandLine, ":9116")
54+
routePrefix = toolkitFlags.WebRoutePrefix
55+
metricsPath = toolkitFlags.WebMetricsPath
56+
toolkitFlags = webflag.AddFlags(kingpin.CommandLine, ":9116")
6157

6258
// Metrics about the SNMP exporter itself.
6359
snmpRequestErrors = promauto.NewCounter(
@@ -302,7 +298,7 @@ func main() {
302298
Description: "Prometheus Exporter for SNMP targets",
303299
Version: version.Info(),
304300
RoutePrefix: *routePrefix,
305-
ExternalURL: *externalURL,
301+
ExternalURL: *toolkitFlags.WebExternalURL,
306302
ListenAddresses: *toolkitFlags.WebListenAddresses,
307303
UseSystemdSocket: *toolkitFlags.WebSystemdSocket,
308304
Logger: logger,

0 commit comments

Comments
 (0)