%PDF- %PDF-
| Direktori : /data/old/opt/luameter/ |
| Current File : //data/old/opt/luameter/README.md |
# `luameter`
Version 1.1
Luameter is a Lua module for Nginx that records and provides key status
and performance metrics, right from within Nginx and in real-time.
It exposes those metrics with a simple JSON API for simple integration
with other live dashboards and monitoring tools.
# What is included?
- luac/ contains Luameter for normal Lua interpreter.
- luajit/ contains Luameter for Luajit 2.0.
- luajit2.1/ contains Luameter for Luajit 2.1 alpha.
- luameter.html is the live dashboard for Luameter as can be seen at demo.luameter.com.
- vendor/ contains static resources to be used by the live dashboard.
# Getting started
1. Copy this directory to `/opt`.
So you will have `/opt/luameter/stats.html`, `/opt/luameter/luac`, etc.
2. Add below block to the http section in your Nginx config to start recording metrics.
For Nginx with normal Lua interpreter.
lua_shared_dict luameter 1m;
lua_package_path "/opt/luameter/luac/?.luac";
init_by_lua "luameter = require 'luameter'";
log_by_lua "luameter.mark_by_host(); luameter.mark_by_path(1)";
For Nginx with Luajit 2.0
lua_shared_dict luameter 1m;
lua_package_path "/opt/luameter/luajit/?.luac";
init_by_lua "luameter = require 'luameter'";
log_by_lua "luameter.mark_by_host(); luameter.mark_by_path(1)";
For Nginx with Luajit 2.1 alpha
lua_shared_dict luameter 1m;
lua_package_path "/opt/luameter/luajit2.1/?.luac";
init_by_lua "luameter = require 'luameter'";
log_by_lua "luameter.mark_by_host(); luameter.mark_by_path(1)";
3. Add below server block to enable the JSON API and live dashboard on localhost.
server {
listen 127.0.0.1:8001;
location / {
root /opt/luameter;
}
location /stats {
content_by_lua "luameter.get_stats('/stats');";
expires -1;
}
}
4. View the live dashboard at http://localhost:8001/luameter.html.
The JSON API will be available at http://localhost:8001/stats.
# Documentation
Please visit http://luameter.com/docs.html for more documentations.