How to install Luameter for EasyEngine


#1

Okay I’ve stumbled a few times (posted here and here about it), but I finally figured it out and wanted to post it here for others:

Luameter is a way to visually see metrics for each vhost on NGINX. See https://luameter.com/demo.

I thought I needed to install a custom NGINX install (i.e. sudo apt-get install nginx-extras) but apparently I didn’t.

Unfortunately, the directions on the luameter website doesn’t fit well with our EE installation, and I didn’t realize it until now. So I modified it to work under the admin tools (port 22222) of EasyEngine, because it makes sense to put it there. If you want to do it too, here’s how:

  1. Purchase Luameter from their website ($10) as of this writing.

  2. Install the Luameter files under /var/www/22222/htdocs/luameter

  3. Add this to the http block in /etc/nginx/nginx.conf:

    lua_shared_dict luameter 1m;
    lua_package_path “/var/www/22222/htdocs/luameter/luac/?.luac”;
    init_by_lua “luameter = require ‘luameter’”;
    log_by_lua “luameter.mark_by_host()”;

note: I modified this from what the luameter website gives us

4 - Add this to the 22222 conf file (sudo ee site edit 22222) (at the end is ok)

# Luameter Rules
location /stats {
    content_by_lua "luameter.get_stats('/stats');";
    expires -1;
}

5 - Reload NGINX, then browse to port 22222 on your server and navigate to luameter.html - you should see it!

Any feedback is welcomed. I’d like to know if anybody else has a different way to track vhost stats in NGINX.


Monitor bandwidth and connections per vhost
#2