Monitoring Linux Mail Server with Lightmeter (Debian, Ubuntu)

watch 5m, 12s
views 2

12:47, 27.08.2026

Article Content
arrow

  • Key Benefits of Using Lightmeter
  • What You Need to Get Started
  • Step 1: Installing the Lightmeter Binary: Quick Guide
  • Step 2: Setting Up a Systemd Service for Lightmeter
  • Step 3: Configuring a Reverse Proxy for Seamless Operations
  • Reverse Proxy with Nginx
  • Setting Up Apache as Your Reverse Proxy
  • Step 4: Enabling HTTPS for a Secure Setup
  • Step 5: Fine-Tuning Lightmeter Settings
  • Mail Flow Issues with Message Detective
  • Conclusion

In this article, we will share our practical experience according to the usage of the Lightmeter. This server monitoring tool can be extremely beneficial for a variety of users who need to monitor server activity with an open-source solution. So, let’s dive deeper into this topic!

Key Benefits of Using Lightmeter

  • Monitoring of RBL or Real-time Block lists
  • Extremely user-friendly interface
  • The support of the remote as well as local logfiles
  • Monitoring of the mail server downtime
  • Additional protection if you need to deal with brute-force or Botnet risks
  • Identification of the blocked emails by other types of SMTP servers

What You Need to Get Started

To start the installation process of Lightmeter, you should already have a running mail server. In case, you don’t, there are a diversity of tutorials that you can use for the quick setup either on your Debian or Ubuntu system.

Step 1: Installing the Lightmeter Binary: Quick Guide

Start with entering your server via SSH. After that with the help of the following line download the latest version of this open-source solution:

 wget https://gitlab.com/api/v4/projects/17017123/packages/generic/lightmeter/1.9.1/lightmeter-linux_amd64-1.9.1

Once you have done the initial step, you need to move it to the following directory:

sudo mv lightmeter-linux_amd64-1.9.1 /usr/local/bin/lightmeter

With the next steps, you should add a user and run Lightmeter:

sudo useradd lightmeter --create-home --home-dir /var/lib/lightmeter_workspace –system

sudo -u lightmeter /usr/local/bin/lightmeter -watch_dir /var/log

After the completion of all the above-discuss steps, you can enter the interface of Lightmeter with:

http://your-server-ip:8080

Here, you will be welcomed with a window where you should create an admin account.

Step 2: Setting Up a Systemd Service for Lightmeter

For the stoppage of all the processes connected with Lightmeter use Ctrl+C. After that create a unit with the following line:

sudo nano /etc/systemd/system/lightmeter.service

The following info should be added to the file:

[Unit]

Description=Mail Server Monitoring

After=network.target

 

[Service]

Type=simple

ExecStartPre=/bin/bash -c '/usr/bin/setfacl -R -m u:lightmeter:rx /var/log/mail*'

ExecStart=sudo -u lightmeter usr/local/bin/lightmeter -watch_dir /var/log/

ExecStop=sudo -u lightmeter /usr/bin/pkill /usr/local/bin/lightmeter

Restart=always

SyslogIdentifier=Lightmeter

 

[Install]

WantedBy=multi-user.target

After adding the needed details, it is required to save the file and reload systemd, start Lightmeter, and enable the automagical start with the following lines:

sudo systemctl daemon-reload

sudo systemctl start lightmeter.service

sudo systemctl enable lightmeter.service

In case, everything is done correctly you should check the status and get the output with active status, process description, tasks, main PID info, and more. To check its status use:

sudo systemctl status lightmeter.service

Step 3: Configuring a Reverse Proxy for Seamless Operations

For accessing Lightmeter with the web interface, it is crucial to set up a proper process with Nginx or Apache. Thanks to our practical knowledge in this process, we decided to share all the little details for you.

Reverse Proxy with Nginx

In case you decide to use Nginx for the reverse proxy, you should use the following command for the installation:

sudo apt install nginx

Once that is done, the following step is the creation of the block file with such line:

sudo nano /etc/nginx/conf.d/lightmeter.conf

After the creation of the file, the following information should be added:

server {

   listen 80;

   listen [::]:80;

   server_name skill.com; (skill.com – should be changed on the real DNS name)

 

   access_log /var/log/nginx/lightmeter.access;

   error_log /var/log/nginx/lightmeter.error;

 

   location / {

       proxy_pass http://127.0.0.1:8080;

       proxy_set_header Host $host;

       proxy_set_header X-Real-IP $remote_addr;

 

       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

       proxy_set_header X-Forwarded-Proto $scheme;

       proxy_set_header X-Forwarded-Protocol $scheme;

       proxy_set_header X-Forwarded-Host $http_host;

   }

}

Once the details are added save the file with the changes made, test the configuration, and reload Nginx with:

sudo nginx -t

sudo systemctl reload nginx

Setting Up Apache as Your Reverse Proxy

In case, you would rather use Apache, here is a short instruction about the setting up process using Apache. Start with the following command:

sudo apt install apache2

To use it as a reverse proxy, there is a necessity to make some changes such as:

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Then host file should be created with:

sudo nano /etc/apache2/sites-available/lightmeter.conf

Once the file is created, the following info should be added:

<VirtualHost *:80>

   ServerName skills.com (skills.com – needs to be replaced with the real name)

   ErrorDocument 404 /404.html

 

   #HTTP proxy

   ProxyPass / http://localhost:8080/

   ProxyPassReverse / http://localhost:8080/

 

</VirtualHost>

After that save the changes, and restart the system. If everything has been done properly, you can access the media server with no issues.

Step 4: Enabling HTTPS for a Secure Setup

For the secure setup, it is crucial to enable HTTPS from Let’s Encrypt. To run this free certificate on Ubuntu use:

 sudo apt install certbot

For the Nginx users the steps are the following:

sudo apt install python3-certbot-nginx

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email your@example.address.com -d lightmeter.yourexample.com

For Apache users the process is similar:

sudo apt install python3-certbot-apache

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@realexample.com -d lightmeter.your.example.com

Step 5: Fine-Tuning Lightmeter Settings

In case, everything was done properly, you can enter the web interface and create an admin account. After Lightmeter entering, you will immediately access the overview webpage. Then you can go further and enable necessary notifications.  

Mail Flow Issues with Message Detective

Also, you can check the delivery status of all the emails with the magnifier. From the settings, you can switch on the public access of the message detective webpage.

Conclusion

Hope this short guide was helpful in case you are planning to monitor a Linux mail server with Lightmeter.

Share

Was this article helpful to you?

VPS popular offers

-4.5%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 4096 Windows

16.95 /mo

/mo

Billed annually

-10%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB HDD
Bandwidth
Bandwidth
300 Gb
KVM-HDD HK 4096 Linux

12.04 /mo

/mo

Billed annually

-10%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
75 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 2048 Windows

10.23 /mo

/mo

Billed annually

-7.9%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
200 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 8192 Windows

25.87 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
200 GB HDD
Bandwidth
Bandwidth
Unlimited
KVM-HDD 8192 Linux

25.25 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
150 GB SSD
Bandwidth
Bandwidth
Unlimited
KVM-SSD 16384 Linux

49.99 /mo

/mo

Billed annually

-10%

CPU
CPU
8 Epyc Cores
RAM
RAM
32 GB
Space
Space
200 GB NVMe
Bandwidth
Bandwidth
Unlimited
Keitaro KVM 32768
OS
CentOS
Software
Software
Keitaro

77.54 /mo

/mo

Billed annually

-4.8%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
40 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 1024 Windows

10.3 /mo

/mo

Billed annually

-8.4%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
75 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-wKVM-SSD 2048 Windows

37.4 /mo

/mo

Billed annually

-20.6%

CPU
CPU
6 Xeon Cores
RAM
RAM
8GB
Space
Space
100GB SSD
Bandwidth
Bandwidth
500GB
KVM-SSD 8192 HK Linux

59 /mo

/mo

Billed annually

Other articles on this topic

cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.