Discussion:
Manually delete events from MYSQL database?
ad8mustanggt
2008-01-09 18:16:38 UTC
Permalink
Can someone help me with the MYSQL command needed to delete all the events for a specific device ID from the MYSQL database? Its our firewall and is taking up around 40GB of disk space!!

Any help would be greatly appreciated... Im sitting with only 88MB free on my server [Exclamation]




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=15093#15093

-------------------- m2f --------------------
netdata
2008-01-09 18:58:09 UTC
Permalink
you could truncate the table but because the db is created as myisam you can't recover disk space, that mean you can truncate the tables and have an empty db but the db file is still 40 GB (myisam marks them as free)

To get arround this you could do a truncate, an export , delete de db file and do an import




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=15100#15100

-------------------- m2f --------------------
crosse
2008-01-09 19:18:36 UTC
Permalink
Post by ad8mustanggt
Can someone help me with the MYSQL command needed to delete all the events for a specific device ID from the MYSQL database? Its our firewall and is taking up around 40GB of disk space!!
Any help would be greatly appreciated... Im sitting with only 88MB free on my server [Exclamation]
To delete rows from the events database for a specific device, try something similar to the following:

/usr/bin/mysql -D events -e "DELETE FROM status WHERE device LIKE 'deviceName';

That will delete all the current events and move them to event history. To delete the event history for the device, specify the 'history' table instead of the 'status' table. That *should* do it.

Standard disclaimer: I'm not responsible for lost data, like if you leave off the WHERE clause to that statement. ;-) (Don't do that, unless you want to test the theory that you have good database backups ;-)) Don't just copy and paste the above command into an ssh session and hit enter...You may want to just go into the mysql interface (`mysql -u zenoss -p -D events`) and look around so you know what's going on if you're not familiar with the database structure, etc.

--seth




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=15102#15102

-------------------- m2f --------------------
ad8mustanggt
2008-01-09 22:08:48 UTC
Permalink
I think i'm at the point that I just want to drop the entire events database and start with a blank shell. What would be the easiest way todo that?


Thank everyone for your help this far.




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=15113#15113

-------------------- m2f --------------------

Loading...