-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGetGroupLevelRemoteMonitors.sql
35 lines (30 loc) · 1.48 KB
/
GetGroupLevelRemoteMonitors.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
Description : Get remote monitors for each group in LabTech.
Source URL : http://github.com/jesseconnr/labtech-sql-library
Tested Versions :
MySQL 5.7
LabTech 10.0
Table Aliases :
Groups - mastergroups
RemoteMonitors - groupagents
MonitorDetails - agents
GroupCategories - infocategory
AlertTemplates - alerttemplate
*/
SELECT
CONCAT_WS(' - ', Groups.GroupID, Groups.Name) AS `GroupName`
, Groups.FullName AS `GroupPath`
, MonitorDetails.Name AS `Monitor`
, AlertTemplates.Name AS `AlertTemplate`
, GroupCategories.CategoryName AS `CategoryName`
FROM groupagents AS `RemoteMonitors`
LEFT JOIN agents AS `MonitorDetails` ON RemoteMonitors.AgentID = MonitorDetails.AgentID
LEFT JOIN mastergroups AS `Groups` ON RemoteMonitors.GroupID = Groups.GroupID
LEFT JOIN alerttemplate AS `AlertTemplates` ON RemoteMonitors.AlertAction = AlertTemplates.AlertActionID
LEFT JOIN infocategory AS `GroupCategories` ON RemoteMonitors.TicketCategory = GroupCategories.ID
WHERE (MonitorDetails.Flags & 0x01) = 0
#AND Groups.GroupID = 1580 # Group Id
#AND MonitorDetails.Name = 'AV - Disabled' # Internal Monitor Name
#AND AlertTemplates.Name = 'Default - Create LT Ticket' # Alert Template Name
#AND GroupCategories.CategoryName = 'Anti-Virus' # Ticket Category Name
ORDER BY Groups.FullName ASC;