Droping data from cacti database older than 60 days old

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

Moderators: Developers, Moderators

Post Reply
l1carter
Posts: 6
Joined: Sun Jul 25, 2004 3:05 pm
Location: Overland Park, KS
Contact:

Droping data from cacti database older than 60 days old

Post by l1carter »

Help,

I am looking for a script that can be run as a cron job to delete the data in my cacti db that is older than 60 days. I don't care to archive it I just want visiailbty for up to the last 60 days.

Is there a command that can be run to do this type of task?

Thanks,

Lee
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

All you need to do is change your RRA Definitions and recreate your graphs. Please goto http://www.rrdtool.org for a RRA Tutorial.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
l1carter
Posts: 6
Joined: Sun Jul 25, 2004 3:05 pm
Location: Overland Park, KS
Contact:

Droping data from cacti database older than 60 days old

Post by l1carter »

Ok, I'm not looking to change my rra files (I don't think) what I am looking to do is drop data directly from the cactidb.

Something like:

delete from cactidb where (Info is older than 60 days).

Maybee a TRUNCATE TABLE will do it... Don't know... Also, I would need to run this directly from the command line not from within mysql as this will need to run as a crontab.

Any ideas?

Thanks,
Lee
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I don't think you get it.....

The cacti database is only configuration information. The RRA files are the ones storing historical data and generating the graphs.

If you where to "clean out" tables in cacti, you would loose you configuration.

What prompted this, are you having space issues? Do you have binary logging turned on for mysql?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
l1carter
Posts: 6
Joined: Sun Jul 25, 2004 3:05 pm
Location: Overland Park, KS
Contact:

Droping database files

Post by l1carter »

Ok,

when I look at the directory it looked as if all my rra files were the same 84k in size and didn't grow. I was under the impression that the RRA files were really formats of how the grapsh were to look and to instruct RRDTOOL on what data to pull from the database (absolute data type ect.) and that the database would actually grow in size at time when on.

To answer your question, yes we are running out of space on the cacti server and simply adding space may fix the problem for now but parsing the data to 60 days or less would be more of a perminate fix.

So if the database is holding no data only configuration information... backing up the database is buying nothing as well correct? (unless of course you made changes to your cacti server the you would want to backup the db again.)

So, I tired to read the simple how-to for begineers on RRD and din't quite grasp what is necessary to accomplish what I am after. Would you have an example or a different way to deliver the same info so that I may understand what is necessary?

Thanks,

Lee
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

If your server is running out of space, then you need to figure out what is doing it.

Purging or cleaning the cacti database is, well, not the way to go. As I said before, and you acknowledge, the database is just configuration data.

RRA's will not change in size, that is the true beauty behind them. Once they have been created, they stay the same size.

Have you recently added a lot of devices? It is possible, you do need to add more space? Where are you lacking space?

Double check that you do not have Binary logging enabled for you mysql server. This is typically used for replication and creates a hugh binary file typically in your /var/lib/mysql directory tree.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
l1carter
Posts: 6
Joined: Sun Jul 25, 2004 3:05 pm
Location: Overland Park, KS
Contact:

database droping

Post by l1carter »

We have added devices recently and gone back and added more interfaces on existing devices to graph more.

I'll check the mysql logging to see if that's it.

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests