Hello,
My pgsql database used by Zabbix has grown to 12 GB in the last few years and takes up a disproportionate amount of space on my root partition. How can I reduce the size of the database?
Sincerely, Marko
I have a process / script for “cleaning” the database.
The basic problem is: Zabbix Agents fill the database faster than the default cleaning / garbage collection can actually clean the database.
It is usually enough to run this process once every year or even only once every two or three years. This depends on how large your Zabbix Database is growing!
One Tip: failing monitored services can cause huge databases. A 3 week wiring issue we had at a clients (In wall wiring corroded after 15-20 years, before was 1 GB/S certified, at the end was down to 100-150 MBit/S…). These 3 weeks alone bloated the database by 25 GB !!!
The script has a small manual point necessary (not finished, inperfect programming, etc…).
But it works, and works fairly well!
→ Do not underestimate the time this can take!
6-10 hours for a cleanup is easily possible, depending again on how performant your hardware is.
Due to load, this is best done when less load on the server, eg Weekends!
The script has to be copied to /root of the NethServer where you’re running Zabbix on.
Please read the accompaning Text-File.
The server can be used during this time, just the Zabbix services need to be stopped. As the cleanup does use resources, I do suggest not doing the cleanup during “working hours”.
My 2 cents
Andy
PS: I’ll send the script (ZIP) and the Textfile via Message…