Deleting old entries from alarms table

Started by KjellO, January 31, 2012, 06:37:07 PM

Previous topic - Next topic

KjellO

Hi!
I have not been able to find any retention settings for the alarms table, in the same way you can set retention for events (Server config). Am I missing something?

Otherwise, is it safe to manually delete old entries from alarms table? Are there some related tables that should be cleaned as well? Could deletion be done while the netxms server is running?
Postgres database, if that matters.

Table has grown quite large over time, and I would like to set up some archiving procedure.
netxms=# select count(*) from alarms;
count 
--------
579673
(1 row)

Best regards,
Kjell

Victor Kirhenshtein

Hi!

Yes, it's actually a bug. There should be retention time for alarms. I'll add it to bug list.
Currently, you can safely delete terminated alarms while NetXMS server is running. You can do it like this:

DELETE FROM alarms WHERE alarm_state=2 AND last_change_time<(timestamp here)

We use UNIX timestamp (seconds since 01.01.1970 00:00:00 UTC).

Best regards,
Victor