@@ -198,7 +198,7 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
198198
199199func (e * Exporter ) Collect (ch chan <- prometheus.Metric ) {
200200
201- body , err := fetchHTTP (e .URI , 2 * time .Second )()
201+ body , err := fetchHTTP (e .URI , time . Duration ( * nginxScrapeTimeout ) * time .Second )()
202202 if err != nil {
203203 log .Println ("fetchHTTP failed" , err )
204204 return
@@ -310,12 +310,13 @@ func fetchHTTP(uri string, timeout time.Duration) func() (io.ReadCloser, error)
310310}
311311
312312var (
313- showVersion = flag .Bool ("version" , false , "Print version information." )
314- listenAddress = flag .String ("telemetry.address" , ":9913" , "Address on which to expose metrics." )
315- metricsEndpoint = flag .String ("telemetry.endpoint" , "/metrics" , "Path under which to expose metrics." )
316- metricsNamespace = flag .String ("metrics.namespace" , "nginx" , "Prometheus metrics namespace." )
317- nginxScrapeURI = flag .String ("nginx.scrape_uri" , "http://localhost/status" , "URI to nginx stub status page" )
318- insecure = flag .Bool ("insecure" , true , "Ignore server certificate if using https" )
313+ showVersion = flag .Bool ("version" , false , "Print version information." )
314+ listenAddress = flag .String ("telemetry.address" , ":9913" , "Address on which to expose metrics." )
315+ metricsEndpoint = flag .String ("telemetry.endpoint" , "/metrics" , "Path under which to expose metrics." )
316+ metricsNamespace = flag .String ("metrics.namespace" , "nginx" , "Prometheus metrics namespace." )
317+ nginxScrapeURI = flag .String ("nginx.scrape_uri" , "http://localhost/status" , "URI to nginx stub status page" )
318+ insecure = flag .Bool ("insecure" , true , "Ignore server certificate if using https" )
319+ nginxScrapeTimeout = flag .Int ("nginx.scrape_timeout" , 2 , "The number of seconds to wait for an HTTP response from the nginx.scrape_uri" )
319320)
320321
321322func init () {
0 commit comments