In putting our dashboard together, I've found that if I want to gather the open Alerts from "External Monitoring - System Check" I can get what I need out of the monitorAlarm table.
I'm getting the data fields I want and writing them off to another file so your choice of what to select might vary. If just doing a raw count, I could just get any of the fields, but the Select below will return Open alarms for "Ping" monitors.
SELECT monitorAlarmId,monitorType,eventDateTime,alertSubject,monitorCSPId FROM monitorAlarm WHERE monitorType = 5 AND logType = 5 AND monitorAlarmStateId = 1
To get alarms for Web Server monitors, use "logType = 1"
To get DNS alarms, use "logType = 2"
To get TCP Port connection alarms, use "logType = 4"
By getting ONLY the records with "monitorAlarmStateId = 1" the dashboard numbers clear out as we close the Alarms in Kaseya.
I've also figured out that in this same table are a bunch of my Custom Service Alerts, and with a little digging, I've figured out that the field "monitorCSPId" gets set to a value that is unique to each custom Service alert. So for instance we are watching one application specific service that always goes into the log as "monitorCSPId = 2035" so I can count those and throw that number up on my dashboard.