Page 1 of 1
Backend cache folder grows and grows
Posted: Fri Jan 25, 2019 3:53 am
by sgargano
Hello,
we have enabled the backend cache feature to decrease the server load due to large amount of running checks.
Following the guide we also mounted the partition to the tmpfs -->
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Unfortunately we have seen that this folder grows without freeing up itself, it only grows and has to be monitored manually to delete those files (xml) manually. We know a reboot will empty this folder since it is mounted to tmpfs but for obvious reason we won't reboot this server so often.
Question: is it something not working or should we implement by our self a crontab to delete the oldest files?
Thanks for your suggestion..
Re: Backend cache folder grows and grows
Posted: Fri Jan 25, 2019 3:43 pm
by cdienger
Did you make the cache 512MB as suggested on the screen? How many hosts and services are there on the system total? The cache is going to hold data from all the hosts and services and populated as it makes calls so you may need to increase it if you have a very large system.
Re: Backend cache folder grows and grows
Posted: Mon Jan 28, 2019 8:05 am
by sgargano
Thanks for your reply,
yes I have now expanded the size to 1024, we currently have 1300 hosts and 4500 services checks running.
In any case, it looks like the xml's generated have never been automatically deleted. As you can see by the img attached, the trend is only growing until I have deleted manually on 23rd of Jan. and after that day is going up again...
Re: Backend cache folder grows and grows
Posted: Mon Jan 28, 2019 3:13 pm
by cdienger
I confirmed with dev that it will not delete cached files. Periodically deleting the files may be necessary, but as it caches every unique call, it should eventually level off.
Re: Backend cache folder grows and grows
Posted: Tue Jan 29, 2019 3:34 am
by sgargano
Understood,
will you provide an official script or an update release to automatize the deletion process?
Thanks
Re: Backend cache folder grows and grows
Posted: Tue Jan 29, 2019 3:22 pm
by lmiltchev
Unfortunately, we don't have such a script. However, you could set up a cron job to delete files, older than x days, e.g. a week.
This is just an example. Modify it to match your environment.
Code: Select all
0 0 * * 0 /usr/bin/find /usr/local/nagiosxi/tmp/backendcache -type f -mtime +7 -name '*.xml' -execdir rm -- '{}' \;
Let us know if you have any further questions.
Re: Backend cache folder grows and grows
Posted: Mon Mar 04, 2019 7:51 am
by sgargano
Thanks,
the example above does not go trough the subfolders where the xml resides.
I added this code which will delete the folders instead:
Code: Select all
/usr/bin/find /usr/local/nagiosxi/tmp/backendcache/* -mtime +30 -type d -exec rm -rf {} \;
Thanks for your support.
Re: Backend cache folder grows and grows
Posted: Mon Mar 04, 2019 8:21 am
by scottwilkerson
sgargano wrote:Thanks,
the example above does not go trough the subfolders where the xml resides.
I added this code which will delete the folders instead:
Code: Select all
/usr/bin/find /usr/local/nagiosxi/tmp/backendcache/* -mtime +30 -type d -exec rm -rf {} \;
Thanks for your support.
Looks good. Thanks for sharing