1extensions:
2 health_check:
3 pprof:
4 endpoint: 0.0.0.0:1777
5 zpages:
6 endpoint: 0.0.0.0:55679
7 file_storage:
8 create_directory: true
9
10receivers:
11 otlp:
12 protocols:
13 grpc:
14 endpoint: 0.0.0.0:4317
15 http:
16 endpoint: 0.0.0.0:4318
17
18 hostmetrics:
19 collection_interval: 30s
20 scrapers:
21 cpu:
22 metrics:
23 system.cpu.utilization:
24 enabled: true
25 load:
26 cpu_average: true
27 memory:
28 metrics:
29 system.memory.utilization:
30 enabled: true
31 filesystem:
32 metrics:
33 system.filesystem.usage:
34 enabled: true
35 system.filesystem.utilization:
36 enabled: true
37 disk: {}
38 network: {}
39 processes: {}
40
41 sqlserver:
42 collection_interval: 30s
43 username: <username>
44 password: <Password>
45 server: 0.0.0.0
46 port: 1433
47 metrics:
48 sqlserver.database.count:
49 enabled: true
50 sqlserver.database.io:
51 enabled: true
52 sqlserver.database.latency:
53 enabled: true
54 sqlserver.database.operations:
55 enabled: true
56 sqlserver.processes.blocked:
57 enabled: true
58 sqlserver.resource_pool.disk.throttled.read.rate:
59 enabled: true
60 sqlserver.resource_pool.disk.throttled.write.rate:
61 enabled: true
62
63 sqlquery/upmetrics:
64 driver: mssql
65 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
66 queries:
67
68 - sql: |
69 SELECT
70 sqlserver_start_time,
71 DATEDIFF(MINUTE, sqlserver_start_time, GETDATE()) AS Minutes_Uptime
72 FROM
73 sys.dm_os_sys_info;
74 metrics:
75 - metric_name: sqlserver.uptime.minutes
76 value_column: Minutes_Uptime
77 attribute_columns: ["sqlserver_start_time"]
78 static_attributes:
79 dbinstance: mydbinstance
80 filelog:
81 include:
82
83 - /var/opt/mssql/log/errorlog*
84
85 storage: file_storage
86 multiline:
87 line_start_pattern: ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{2}
88 retry_on_failure:
89 enabled: true
90
91 sqlquery/connection:
92 driver: mssql
93 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
94 storage: file_storage
95 queries:
96 - sql: |
97 SELECT
98 c.session_id,
99 c.client_net_address AS client_ip_address,
100 s.host_name,
101 s.login_name,
102 s.program_name,
103 s.login_time,
104 s.last_request_start_time,
105 s.last_request_end_time,
106 'mssql_client_log' AS log_source
107 FROM
108 sys.dm_exec_connections AS c
109 JOIN
110 sys.dm_exec_sessions AS s
111 ON
112 c.session_id = s.session_id
113 WHERE
114 s.last_request_start_time > $$1
115 ORDER BY
116 s.last_request_start_time ASC;
117 tracking_column: last_request_start_time
118 tracking_start_value: ""
119 logs:
120 - body_column: client_ip_address
121 attribute_columns: ["session_id", "host_name", "login_name", "program_name", "login_time", "last_request_start_time", "last_request_end_time", "log_source"]
122
123 sqlquery/slowquery:
124 driver: mssql
125 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
126 storage: file_storage
127 queries:
128 - sql: |
129 SELECT
130 *,
131 SUBSTRING(
132 st.text,
133 (qs.statement_start_offset / 2) + 1,
134 (
135 (
136 CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE qs.statement_end_offset END - qs.statement_start_offset
137 ) / 2
138 ) + 1
139 ) AS statement_text,
140 'mssql_slow_query_log' AS log_source
141 FROM
142 sys.dm_exec_query_stats AS qs
143 CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
144 WHERE qs.last_execution_time > $$1
145 ORDER BY qs.last_execution_time;
146 tracking_column: last_execution_time
147 tracking_start_value: " "
148 logs:
149 - body_column: statement_text
150 attribute_columns: ["sql_handle", "execution_count", "total_worker_time", "last_execution_time", "creation_time", "total_elapsed_time", "statement_start_offset", "statement_end_offset", "log_source"]
151
152 sqlquery/audit:
153 driver: mssql
154 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
155 storage: file_storage
156 collection_interval: 30s
157 queries:
158 - sql: "SELECT event_time, action_id, succeeded, session_server_principal_name AS user_name, server_principal_name AS login_name, database_name, schema_name, object_name, statement, additional_information FROM sys.fn_get_audit_file('/var/opt/mssql/log/Audit-*.sqlaudit', DEFAULT, DEFAULT) WHERE event_time > $$1 ORDER BY event_time ASC"
159 tracking_column: event_time
160 tracking_start_value: " "
161 logs:
162 - body_column: statement
163 attribute_columns: ["event_time", "action_id", "succeeded", "user_name", "login_name", "database_name", "schema_name", "object_name", "additional_information", "log_source"]
164
165
166 sqlquery/activequery:
167 driver: mssql
168 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
169 queries:
170 - sql: |
171 SELECT
172 r.session_id,
173 r.status,
174 r.command,
175 r.cpu_time,
176 r.start_time,
177 s.login_name,
178 s.host_name,
179 s.program_name,
180 st.text AS query_text,
181 'mssql_active_query' as log_source
182 FROM
183 sys.dm_exec_requests r
184 INNER JOIN
185 sys.dm_exec_sessions s
186 ON
187 r.session_id = s.session_id
188 CROSS APPLY
189 sys.dm_exec_sql_text(r.sql_handle) st
190 WHERE
191 s.is_user_process = 1
192 logs:
193 - body_column: query_text
194 attribute_columns: ["session_id", "status", "command", "cpu_time", "start_time", "login_name", "host_name", "program_name", "log_source"]
195
196 sqlquery/usersession:
197 driver: mssql
198 datasource: "sqlserver://<user>:<password>@localhost:1433?database=Kloudmate-test&encrypt=disable"
199 queries:
200 - sql: |
201 SELECT
202 session_id,
203 login_name,
204 host_name,
205 program_name,
206 login_time,
207 status,
208 client_interface_name,
209 cpu_time,
210 memory_usage,
211 reads,
212 writes,
213 'mssql_user_sessions' as log_source
214 FROM
215 sys.dm_exec_sessions
216 WHERE
217 is_user_process = 1;
218 logs:
219 - body_column: login_name
220 attribute_columns: ["session_id", "host_name", "program_name", "login_time", "status", "client_interface_name", "cpu_time", "memory_usage", "reads", "writes", "log_source"]