Inserting Alarms into Journal Retrospectively

What’s the easiest way to retrospectively add alarms into the alarm journal?

We’re retrieving a history of alarms from a 3rd party source (rest API) and need to insert this history into the alarm journal. I assume i’m just going to have to insert the data into the journal table myself, but wondering if there’s another way i’m overlooking? Also, how would I generate the event id if I were to add it manually?

from java.util import UUID

uuid = UUID.randomUUID()

Thanks Jordan, but would this guarantee that I don’t get the same uuid as another, despite the chances being miniscule?

Miniscule is estimated as in the quintillion item range. If you really need to ensure it, you’ll need to query the journal first.

Also, many dbs have their own UUID generation methods. May be worth looking into.

@PGriffith, does the alarming system check for this? More of a curiosity thing.

No, it doesn’t look like it. There might be some check further downstream, but the core call when you construct a new alarm event is exactly the same as Jordan’s snippet above. Querying the DB for each new alarm generation would be slow.

As for the core question, Nick, you could potentially do this via gateway API methods. Probably still easier to just do it with the DB, but it is possible to construct an arbitrary event and send it through the journal system - that’s essentially what stuff like the remote alarm journal does.