Swap file full errors in NAGIOS (0% free now only 4%)

Hi - running a standard install of Pi Hole on a Pi 3B+
Monitored using NEMS (Nagios on anoter PI)
Woke up this morning to SWAP CRITICAL - 0% free (0 MB out of 99 MB)
This then resolved itself several hours later (3AM start resolved itself at 9:30 AM)

Why would my pi fill the swap file overnight when it's doing nothing in the grand scheme of things ?

I'm not a Linux guru, I do understand what a swap file is and why one exists. Do I need a bigger swap file or will this just fill up again ?

I have a 64gb SD card in there so Im not shy on space if this is needed can somebody advise how to increase swap file size (if needed), troubleshoot or fix this issue before it takes my network down!

I'd add that my Pi Hole isn't on a desk in front of me but tucked away in a cupboard elsewhere plugged into my distribution switches so I don't have SSH access (strange that this is totally disabled remotely) although I suspect somebody is going to tell me that I need it!

Many thanks for all assistance to help out a fellow in need.

Rob.

Expected Behaviour:

Expect Swap file to not fill up to capacity

Actual Behaviour:

Swap file maxed out unexpectedly

Debug Token:

[✓] Your debug token is: https://tricorder.pi-hole.net/ge8o0zqpbv

Pi-hole rebuilt your gravity list this morning between 3 am and 5 am your local time. To do this, an entirely new database is built and then swapped in place of the existing database. This requires memory.

If you are going to manage the device, you will need access to it, either by direct connection or via remote access. Running a headless Pi is quite common, but then you need ssh or VNC or similar to access it.

Easy way to enable ssh without having to hook up a monitor:

Shut the Pi down normally, remove the SD card, mount the card in your computer. Add a blank file named ssh (no extension) in the boot directory. Put the card back in the Pi and boot the Pi; ssh will be enabled.

2 Likes

Thank you so much for your help - you have no idea how much it is appreciated.

It looks as though you were saying there could be a file system problem and then realised that this is expected bahaviour during the DB rebuild - is that correct ?

My swap space has now increased to 12% - just to ensure that I'm covered here can you confirm that I don't need to increase my swap file space ? If I do need to as I have plenty available how is the supported way to go about this please?

Having just clicked in a new tab I've read the other linked doc but this doesn't help me unfortunately.

I don't know how to increase the size of a temp directory, or whether the var directory is mounted correctly or not.

This has all been totally out of the box with no special config. If the dirs are too small or mounted incorrectly it's because the setup did it that way - I promise I've changed nothing - I don't have the know-how.

Can you please advise how I check or increase the size of the mounted dirs if this is going to be a problem.

What is a sensible size tmp dir to give for pi hole on a 64GB SD card please?

I'd like to get one config perfect before I build my secondary HA PI to the same spec.

Many thanks.

Rob.

My own answer:

Raspbian uses dphys-swapfile, which is a swap-file based solution instead of the "standard" swap-partition based solution. It is much easier to change the size of the swap.

The configuration file is:

/etc/dphys-swapfile 

The content is very simple. By default my Raspbian has 100MB of swap:

CONF_SWAPSIZE=100

If you want to change the size, you need to modify the number and restart dphys-swapfile:

/etc/init.d/dphys-swapfile restart

I have updated my swap file to 1024 - let's see what effect this has.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.