Skip to content

Commit a6f30d0

Browse files
committed
in_nginx_exporter_metrics: add scrape_interval option (default: 5s)
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 549f95f commit a6f30d0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plugins/in_nginx_exporter_metrics/nginx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static int nginx_init(struct flb_input_instance *ins,
22712271
}
22722272
ctx->coll_id = flb_input_set_collector_time(ins,
22732273
nginx_collect,
2274-
1,
2274+
ctx->scrape_interval,
22752275
0, config);
22762276
ret = 0;
22772277
nginx_init_end:
@@ -2340,6 +2340,11 @@ static struct flb_config_map config_map[] = {
23402340
0, FLB_TRUE, offsetof(struct nginx_ctx, status_url),
23412341
"Define URL of stub status handler"
23422342
},
2343+
{
2344+
FLB_CONFIG_MAP_TIME, "scrape_interval", "5s",
2345+
0, FLB_TRUE, offsetof(struct nginx_ctx, scrape_interval),
2346+
"Scrape interval to collect metrics from NGINX."
2347+
},
23432348
{
23442349
FLB_CONFIG_MAP_BOOL, "nginx_plus", "true",
23452350
0, FLB_TRUE, offsetof(struct nginx_ctx, is_nginx_plus),

plugins/in_nginx_exporter_metrics/nginx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
struct nginx_ctx
3131
{
3232
int coll_id; /* collector id */
33+
int scrape_interval; /* collection interval */
3334
flb_sds_t status_url;
3435
struct flb_parser *parser;
3536
struct flb_input_instance *ins; /* Input plugin instace */

0 commit comments

Comments
 (0)