-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_queries.py
114 lines (101 loc) · 6.1 KB
/
db_queries.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
create_chassis_summary_sql = """CREATE TABLE IF NOT EXISTS chassis_summary_details (
ip VARCHAR(255) NOT NULL,
chassisSN TEXT,
controllerSN TEXT,
type_of_chassis TEXT,
physicalCards TEXT,
status_status TEXT,
ixOS TEXT,
ixNetwork_Protocols TEXT,
ixOS_REST TEXT,
tags TEXT,
lastUpdatedAt_UTC TEXT,
mem_bytes TEXT,
mem_bytes_total TEXT,
cpu_pert_usage TEXT,
os TEXT
);"""
create_card_details_records_sql = """CREATE TABLE IF NOT EXISTS chassis_card_details (
'chassisIp' VARCHAR(255) NOT NULL,
'typeOfChassis' TEXT,
'cardNumber' TEXT,
'serialNumber' TEXT,
'cardType' TEXT,
'cardState' TEXT,
'numberOfPorts' TEXT,
'tags' TEXT,
'lastUpdatedAt_UTC' TEXT
);"""
create_port_details_records_sql = """CREATE TABLE IF NOT EXISTS chassis_port_details (
'chassisIp' VARCHAR(255) NOT NULL,
'typeOfChassis' TEXT,
'cardNumber' TEXT,
'portNumber' TEXT,
'phyMode' TEXT,
'linkState' TEXT,
'transceiverModel' TEXT,
'transceiverManufacturer' TEXT,
'owner' TEXT,
'speed' TEXT,
'type' TEXT,
'totalPorts' TEXT,
'ownedPorts' TEXT,
'freePorts' TEXT,
'transmitState' TEXT,
'lastUpdatedAt_UTC' TEXT
);"""
create_license_details_records_sql = """CREATE TABLE IF NOT EXISTS license_details_records (
'chassisIp'VARCHAR(255) NOT NULL,
'typeOfChassis' TEXT,
'hostId' TEXT,
'partNumber' TEXT,
'activationCode' TEXT,
'quantity' TEXT,
'description' TEXT,
'maintenanceDate' TEXT,
'expiryDate' TEXT,
'isExpired' TEXT,
'lastUpdatedAt_UTC' TEXT
);"""
create_sensor_details_sql = """CREATE TABLE IF NOT EXISTS chassis_sensor_details (
chassisIp VARCHAR(255) NOT NULL,
typeOfChassis TEXT ,
sensorType TEXT ,
sensorName TEXT,
sensorValue TEXT,
unit TEXT,
lastUpdatedAt_UTC TEXT
);"""
create_usage_metrics = """CREATE TABLE IF NOT EXISTS chassis_utilization_details (
chassisIp VARCHAR(255) NOT NULL,
mem_utilization TEXT,
cpu_utilization TEXT,
lastUpdatedAt_UTC TEXT
);"""
create_ip_tags_sql = """CREATE TABLE IF NOT EXISTS user_ip_tags (
ip VARCHAR(255) NOT NULL,
tags TEXT
);"""
create_card_tags_sql = """CREATE TABLE IF NOT EXISTS user_card_tags (
serialNumber VARCHAR(255) NOT NULL,
tags TEXT
);"""
create_perf_metrics_sql = """CREATE TABLE IF NOT EXISTS perf_metrics (
ip VARCHAR(255) NOT NULL,
mem_bytes TEXT ,
mem_bytes_total TEXT ,
cpu_pert_usage TEXT
);"""
create_usenname_password_table = """CREATE TABLE IF NOT EXISTS user_db (
ixia_servers_json TEXT
);"""
create_poll_settings_table = """CREATE TABLE IF NOT EXISTS poll_setting (
chassis INTEGER,
cards INTEGER ,
ports INTEGER,
sensors INTEGER ,
perf INTEGER,
licensing INTEGER,
data_purge INTEGER,
alertMonitor INTEGER
);"""