-
Notifications
You must be signed in to change notification settings - Fork 26
/
view_vk_config.sql
59 lines (59 loc) · 2.23 KB
/
view_vk_config.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CREATE OR REPLACE VIEW public.view_vk_config AS
-- This view is part of the Vertica Diagnostic Kit from http://git.io/q9m-fw
-- Version
(SELECT 'Version' AS Description,
VERSION() AS Result)
UNION ALL
-- License Information
(SELECT 'License Type',
REGEXP_REPLACE(companyname || ' ' || CASE
WHEN POSITION('Unlimited' IN size) = 1 THEN 'Unlimited'
ELSE TRIM(E' \n' FROM SPLIT_PART(size, 'B', 1)) || 'B'
END, '[\r\t\f\n]', ' ')
FROM v_internal.vs_licenses)
UNION ALL
-- Database Size
(SELECT 'Database Size',
CAST(ROUND(database_size_bytes / (1024^3), 2) AS VARCHAR(20)) || ' GB'
FROM v_internal.vs_license_audits
ORDER BY audit_start_timestamp DESC
LIMIT 1)
UNION ALL
-- License Utilization
(SELECT 'License Utilization',
CAST(ROUND(a.usage_percent * 100, 2) AS VARCHAR(10)) || '%'
FROM v_internal.vs_license_audits a
JOIN (SELECT MAX(audit_start_timestamp) AS audit_start_timestamp
FROM v_internal.vs_license_audits) b
ON b.audit_start_timestamp = a.audit_start_timestamp)
UNION ALL
-- Nodes in the Cluster
(SELECT 'Node Count', CAST(node_count AS VARCHAR(10))
FROM v_internal.system)
UNION ALL
-- Down Nodes in the Cluster
(SELECT 'Down Nodes', CAST(node_down_count AS VARCHAR(10))
FROM v_internal.system)
UNION ALL
-- K-Safety Level
(SELECT 'K-Safety Level', CAST(designed_fault_tolerance AS VARCHAR(5))
FROM v_internal.system)
UNION ALL
-- Number of Node Failures Before Automatic Shut Down
(SELECT 'Node Fault Tolerance', CAST(current_fault_tolerance AS VARCHAR(5))
FROM v_internal.system)
UNION ALL
-- Data Collector Status
(SELECT 'Data Collector Enabled',
CASE
WHEN MAX(current_value) = 1 THEN 'Yes'
ELSE 'No'
END
FROM v_internal.vs_configuration_parameters
WHERE parameter_name = 'EnableDataCollector')
UNION ALL
-- Changed Configuration Parameters
(SELECT 'Changed Parameters',
CAST(COUNT(*) AS VARCHAR(10))
FROM v_internal.vs_configuration_parameters
WHERE current_value <> default_value);