Hi,
Following up this question: automation get information events slow i've come up to this to retrieve some information events
ScriptDummy eldum = engine.GetDummy("VirtualMatrix");
IDms dms = engine.GetDms();
IDmsElement vm = dms.GetElement(new DmsElementId(eldum.DmaId, eldum.ElementId));
AlarmFilter af = new AlarmFilter();
AlarmFilterItem ci = new AlarmFilterItemString(
AlarmFilterField.ParameterDescription,
AlarmFilterCompareType.WildcardEquality,
new string[] { "Connected Input (Virtual Outputs)*" }
);
AlarmFilterItem afvm = new AlarmFilterItemString(
AlarmFilterField.ElementID,
AlarmFilterCompareType.Equality,
new string[] { vm.DmsElementId.Value }
);
af.FilterItems = new AlarmFilterItem[] { ci, afvm };DateTime today = DateTime.Today;
DateTime month = new DateTime(today.Year, today.Month, 1);
DateTime first = month.AddYears(-1);//month.AddMonths(-1);
DateTime last = month.AddSeconds(-1);
var repostoryRegistery = SLDataGateway.API.Repositories.Registry.DatabaseRepositoryRegistryBuilder.Default
.WithConnection(Engine.SLNetRaw)
.Build();
var alarmRepository = repostoryRegistery.Get<IInfoRepository>();var alarmsfromDB = alarmRepository.Read(af, first, last)
.Cast<AlarmEventMessage>()
.Where(a => a.Severity == "Information")
.ToList();
engine.GenerateInformation($" count {alarmsfromDB.Count()}");
However i got different result with the information i got from cube: The result of the script:
12/1/2022 12:00:00 AM --- 11/30/2023 11:59:59 PM (Script 'GetInformationEvents')
count 57689 (Script 'GetInformationEvents') (this fluctuate (yesterday it was consistent on: count 57767 ) as well between yesterday and today which should have been the same looking at the datetime/range.)
VS
I end up with:
& matching in de alarm console:
I'm i doing something wrong? Or does the repostoryRegistery doesn't fetch all information events?
Hi Gerwin,
This seems to be an issue on our side, a task was already made: repostoryRegistery not returning all information event | Collaboration (dataminer.services).
To me it seems like severity filters are done post query, causing first at max 100_000 alarms to be returned from the query and then only the ones with the right severity to remain.
The difference with the alarm console is that there is a limit in the query.
Hi Gerwin,
How long are alarms and information events being stored on your system? By default this is one year and I see that you are trying to retrieve alarms that are older than one year. Could it be that the number of results changes because old alarms are being pruned?
They where at 52 weeks but we increased those. However I ran the script first and used the returned dates in cube so it should return the same or similar results. However the script returns far less then cube