For your first question, you could create a query similar to the following one. In order to get the alarms for the last 24 hours you will need to use a time range component feed.
For the second question I would advise you to use an Ad hoc data source. You can use the GQIDMS object to retrieve data from your DMS. https://docs.dataminer.services/user-guide/Advanced_Modules/Dashboards_and_Low_Code_Apps/GQI/Extensions/API_Reference/GQIDMS.html
You can find some examples on Github:
Hope this helps!
Best regards, Ward