Hi LWIE,
If I understand correctly you want to check nimid in alarms outside current profile or rule.
Actually you don't need to connect to SLM database, instead you can connect to nas internal databaase
database.open("transactionlog.db")
and query table NAS_TRANSACTION_LOG or NAS_TRANSACTION_SUMMARY with filters in the where clause for nimid you need
Hope this helps