NetXMS Support Forum

English Support => General Support => Topic started by: netcaring on February 06, 2024, 06:40:41 PM

Title: automatic cancellation of all alarms after 24 hours
Post by: netcaring on February 06, 2024, 06:40:41 PM
hello,
Is there a way to erase all alarms after a certain number of hours? for example every two days the "alarms" section is completely cleaned

thanks.
Title: Re: automatic cancellation of all alarms after 24 hours
Post by: Victor Kirhenshtein on February 07, 2024, 04:12:23 PM
You can create scheduled task that will run NXSL script on any top level object ("entire network" or "infrastructure services"). In that script you can do something like this:

for(a : $object->alarms)
{
   a->terminate();
}

Alternatively you can use FindObejct(2) to refer to "infrastructure services" instead of $object - then you can run script in any context.

You can add additional logic to terminate only old alarms, etc.

Best regards,
Victor