how to empty old graphs from mysql?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

how to empty old graphs from mysql?

Post by majedz »

Peace, I have searched the forums to know how to free disk space but I am unable to find a script in the cli directory that empties rra's. my cacti version is 0.8.8f.
any help on this?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
Rno
Cacti Pro User
Posts: 680
Joined: Wed Dec 07, 2011 9:19 am

Re: how to empty old graphs from mysql?

Post by Rno »

Take this plugin
Rrdclean

it will do the job safely
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

ok, i installed it. how to use it?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
Rno
Cacti Pro User
Posts: 680
Joined: Wed Dec 07, 2011 9:19 am

Re: how to empty old graphs from mysql?

Post by Rno »

Just go to console -> setting -> misc and enter your backup and archive directory


Than go to console -> RRDCleaner -> rescan, and it wil list all the RRD file not used anymore.
Than you can delete, backup or archive it.
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

i scaned, the result was 2 unused rrd files. That's not gonna empty a 1 MB. I need a way to empty old data in the database to purge old graphs so that disk space is freed.
Thanks for the help!
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: how to empty old graphs from mysql?

Post by phalek »

Just to clarify: RRD files are created once with a fixed size. The size of the rrd file is defined by the RRA definitions. Deleting data from the rrd files will not reduce their size.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

I'm sure this is a wide spread problem, does anybody have a solution to this ?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
cigamit
Developer
Posts: 3363
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: how to empty old graphs from mysql?

Post by cigamit »

This isn't a wide spread problem, as the rrds don't grow in size, they are always the same. If you are wanting to clear up disk space, then you might want to start by looking at log files, etc...
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

i deleted the logs, but that only freed about 2 GB, do you mean after more than a year of graphing the mysql database is not hogged with graphs?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
cigamit
Developer
Posts: 3363
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: how to empty old graphs from mysql?

Post by cigamit »

The graph data is not stored in MySQL, its stored in those rrd files. The files are created full size, and they will never grow larger than they currently are. When the retention period is up on the data, it is automatically overridden by the new data.
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

Thanks for the reply. How much is the retention period?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
cigamit
Developer
Posts: 3363
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: how to empty old graphs from mysql?

Post by cigamit »

You have to look in Cacti at the RRAs you have set. That tells it the retention, etc.. (basically how much data to store and how often to expect it). Then for each data template, you select those RRAs and the consolidation functions. So basically each rrd file can be completely different based upon the data template and rras selected.
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

Peace, free space was 22% now it's 20% more than a week later. It means the rra's are still growing. I left the rra's at their default, what to set the value to and where in order to delete older data?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
cigamit
Developer
Posts: 3363
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: how to empty old graphs from mysql?

Post by cigamit »

It doesn't mean that the RRDs are growing, they can't. It most likely means that log files or something else are growing.
majedz
Posts: 39
Joined: Fri Aug 07, 2015 8:15 am

Re: how to empty old graphs from mysql?

Post by majedz »

The apache and the cacti and the messages log files grew a bit but there is something else growing and they are now in megabytes but i've reached 20% again, and thanks for the answer.what could it be if not the growing of files with time passing by?
Seek and you shall find, knock and it shall be opened, cry and you will find comfort, thirst and you shall be watered.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests