forked from vovolie/lua-nginx-prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcounter.conf
33 lines (28 loc) · 910 Bytes
/
counter.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Please copy to nginx's conf.d directory
# Set search paths for pure Lua external libraries (';;' is the default path):
lua_package_path "/Users/zl/Work/Counter/nginx-lua-prometheus/?.lua;;/Users/zl/Work/Counter/lua-resty-consul/lib/resty/?.lua;;/Users/zl/Work/Counter/lib/?.lua;;";
# Set Prometheus global dict
lua_shared_dict prometheus_metrics 10M; #init 10M memory
lua_shared_dict uri_by_host 10M;
lua_shared_dict global_set 1M;
# Development option, if deploy production, pls cache on!
lua_code_cache off;
init_by_lua_block {
counter = require 'counter'
counter.init()
consul_host = "<Your consul host ip>"
consul_port = <Your consul port>
}
log_by_lua_block {
counter.log()
}
# Expose prometheus's metrics scrape port
server {
listen 9145;
allow 127.0.0.1;
deny all;
access_log off;
location /metrics {
content_by_lua 'prometheus:collect()';
}
}