Re: [Shinken-devel] 'Slow' livestatus and db growing
Status: Beta
Brought to you by:
naparuba
From: Gerhard L. <Ger...@co...> - 2011-05-25 12:04:44
|
Hi, the command deletes everything older than one day. So if you click on "alert history" etc. you only see events of the last day and won't be able to go back any further. I would recommend to keep at least a week of logs. (Of course it depends on how you handled the archived nagios logfiles) delete from .. 3600*24*_you-might-want-to-change-this Gerhard Von: Denis GERMAIN [mailto:dt....@gm...] Gesendet: Mittwoch, 25. Mai 2011 13:20 An: shi...@li... Betreff: Re: [Shinken-devel] 'Slow' livestatus and db growing Hi! I've finally managed to shrink my growing livestatus db. The old data was indeed flushed with the command Gerhard gave me, but the db also needed to be flushed, because the disk space was still claimed. The query "VACUUM" did that. I had my livestatus.db go from 140 MB to 25 MB (and it stills work :-p ). A little cron will do nicely. sqlite3 /usr/local/shinken/var/livestatus.db "delete from logs where time < strftime('%s', 'now') - 3600*24*7" sqlite3 /usr/local/shinken/var/livestatus.db "VACUUM" Thanks ! Denis 2011/5/20 Denis GERMAIN <dt....@gm...> I tried to apply your patch, but it's difficult to see a difference. Pages still take quite a long time to display (between 10 et 15 seconds), and as it's not constant, I can't tell if it's better or not. And for the cleanup of the livestatus.db, there is also little difference in the filesize, even though the query did work, as there are now nearly no entries when I type the "select count(*)" query Denis 2011/5/19 Denis GERMAIN <dt....@gm...> Yeah, I had guessed, but I was not in a hurry :-p Thanks! Denis 2011/5/19 Gerhard Lausser <Ger...@co...> Hi, > And for the livestatus.db, I have tried your command to count the entries and it gave me. A cleaning up in cron might be a good idea, like you said :-p > sqlite3 /usr/local/shinken/var/livestatus.db "select count(*) from logs where time < strftime('%s', 'now') - 3600*24*7" > 483973 I'm an idiot. This statement I sent you counts the log entries older than a week. To delete the old entries it must be: "delete from logs where ....." Gerhard ---------------------------------------------------------------------------- -- What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Shinken-devel mailing list Shi...@li... https://lists.sourceforge.net/lists/listinfo/shinken-devel |