| 9 | | 1. '''Tenants''' – ентитет кој претставува логички изолирана организација (tenant) во системот. |
| 10 | | * ''id'' (integer, PK) |
| 11 | | * ''name'' (text, not null) |
| 12 | | * ''owner_email'' (text, not null) |
| 13 | | * ''created_at'' (datetime, not null) |
| 14 | | |
| 15 | | 2. '''Users''' – ентитет кој чува информации за корисници автентицирани преку Google OAuth. |
| 16 | | * ''id'' (integer, PK) |
| 17 | | * ''email'' (text, not null, UNIQUE) |
| 18 | | * ''name'' (text) |
| 19 | | * ''picture'' (text) |
| 20 | | * ''created_at'' (datetime, not null) |
| 21 | | |
| 22 | | 3. '''Memberships''' – асоцијативен ентитет кој поврзува корисници со tenants и дефинира нивна улога. |
| 23 | | * ''user_id''* (integer, PK, FK → Users.id) |
| 24 | | * ''tenant_id''* (integer, PK, FK → Tenants.id) |
| 25 | | * ''role'' (text, not null) |
| 26 | | * ''created_at'' (datetime, not null) |
| 27 | | |
| 28 | | 4. '''Environments''' – ентитет кој чува информации за логички околини во рамки на еден tenant. |
| 29 | | * ''id'' (integer, PK) |
| 30 | | * ''name'' (text, not null) |
| 31 | | * ''created_at'' (datetime, not null) |
| 32 | | * ''tenant_id''* (integer, FK → Tenants.id, not null) |
| 33 | | * (UNIQUE: tenant_id + name) |
| 34 | | |
| 35 | | 5. '''ENV_Tokens''' – ентитет кој чува токени за пристап на клиентите во конкретно environment. |
| 36 | | * ''id'' (integer, PK) |
| 37 | | * ''env_name''* (text, FK → Environments.name, not null) |
| 38 | | * ''tenant_id''* (integer, FK → Tenants.id, not null) |
| 39 | | * ''token'' (text, not null, UNIQUE) |
| 40 | | * ''created_at'' (datetime, not null) |
| 41 | | * ''expires_at'' (datetime) |
| 42 | | |
| 43 | | 6. '''Admin_sessions''' – ентитет кој чува администраторски сесии за управување со системот. |
| 44 | | * ''id'' (integer, PK) |
| 45 | | * ''token'' (text, not null, UNIQUE) |
| 46 | | * ''tenant_id''* (integer, FK → Tenants.id, not null) |
| 47 | | * ''created_at'' (datetime, not null) |
| 48 | | |
| 49 | | 7. '''Computers''' – ентитет кој чува податоци за уредите (клиенти) што испраќаат логови до серверот. |
| 50 | | * ''id'' (integer, PK) |
| 51 | | * ''name'' (text, not null) |
| 52 | | * ''user'' (text) |
| 53 | | * ''ip'' (text) |
| 54 | | * ''os'' (text) |
| 55 | | * ''first_seen'' (datetime) |
| 56 | | * ''last_seen'' (datetime) |
| 57 | | * ''sysmon_available'' (boolean, default 0) |
| 58 | | * ''env_name''* (text, FK → Environments.name, not null) |
| 59 | | * ''tenant_id''* (integer, FK → Tenants.id, not null) |
| 60 | | * (UNIQUE: tenant_id + name) |
| 61 | | |
| 62 | | 8. '''Computer_history''' – ентитет кој чува временски перформансни метрики за компјутерот. |
| 63 | | * ''id'' (integer, PK) |
| 64 | | * ''computer_id''* (integer, FK → Computers.id, not null) |
| 65 | | * ''cpu_usage'' (real) |
| 66 | | * ''ram_usage'' (real) |
| 67 | | * ''disk_usage'' (real) |
| 68 | | * ''network_sent_mb'' (real) |
| 69 | | * ''network_recv_mb'' (real) |
| 70 | | * ''timestamp'' (datetime) |
| 71 | | |
| 72 | | 9. '''Computer_processes''' – ентитет кој чува податоци за процеси на компјутерот. |
| 73 | | * ''id'' (integer, PK) |
| 74 | | * ''computer_id''* (integer, FK → Computers.id, not null) |
| 75 | | * ''pid'' (integer) |
| 76 | | * ''name'' (text) |
| 77 | | * ''cpu_percent'' (real) |
| 78 | | * ''memory_mb'' (real) |
| 79 | | * ''username'' (text) |
| 80 | | * ''cmdline'' (text) |
| 81 | | * ''timestamp'' (datetime) |
| 82 | | |
| 83 | | 10. '''Sysmon_events''' – ентитет кој чува Sysmon/безбедносни настани испратени од клиентот. |
| 84 | | * ''id'' (integer, PK) |
| 85 | | * ''computer_id''* (integer, FK → Computers.id, not null) |
| 86 | | * ''event_id'' (integer) |
| 87 | | * ''event_type'' (text) |
| 88 | | * ''message'' (text) |
| 89 | | * ''timestamp'' (datetime) |
| 90 | | * ''details'' (text) (JSON како string) |
| 91 | | |
| 92 | | 11. '''Network_connections''' – ентитет кој чува мрежни конекции детектирани на компјутерот. |
| 93 | | * ''id'' (integer, PK) |
| 94 | | * ''computer_id''* (integer, FK → Computers.id, not null) |
| 95 | | * ''pid'' (integer) |
| 96 | | * ''local_address'' (text) |
| 97 | | * ''remote_address'' (text) |
| 98 | | * ''status'' (text) |
| 99 | | * ''process_name'' (text) |
| 100 | | * ''timestamp'' (datetime) |
| 101 | | |
| 102 | | 12. '''Security_alerts''' – ентитет кој чува аларми за потенцијални безбедносни инциденти. |
| 103 | | * ''id'' (integer, PK) |
| 104 | | * ''computer_id''* (integer, FK → Computers.id, not null) |
| 105 | | * ''alert_type'' (text) |
| 106 | | * ''severity'' (text) |
| 107 | | * ''description'' (text) |
| 108 | | * ''timestamp'' (datetime) |
| 109 | | * ''resolved'' (boolean, default 0) |
| | 9 | ==== 1. Tenants ==== |
| | 10 | Ентитет кој претставува логички изолирана организација (tenant) во системот. |
| | 11 | |
| | 12 | * ''id'' (integer, PK) |
| | 13 | * ''name'' (text, NOT NULL) |
| | 14 | * ''owner_email'' (text, NOT NULL) |
| | 15 | * ''created_at'' (datetime) |
| | 16 | |
| | 17 | ---- |
| | 18 | |
| | 19 | ==== 2. Users ==== |
| | 20 | Ентитет кој чува информации за корисници автентицирани преку Google OAuth. |
| | 21 | |
| | 22 | * ''id'' (integer, PK) |
| | 23 | * ''email'' (text, NOT NULL, UNIQUE) |
| | 24 | * ''name'' (text) |
| | 25 | * ''picture'' (text) |
| | 26 | * ''created_at'' (datetime) |
| | 27 | |
| | 28 | ---- |
| | 29 | |
| | 30 | ==== 3. Memberships ==== |
| | 31 | Асоцијативен ентитет кој поврзува корисници со tenants и ја дефинира нивната улога. |
| | 32 | |
| | 33 | * ''user_id''* (integer, PK, FK → Users.id) |
| | 34 | * ''tenant_id''* (integer, PK, FK → Tenants.id) |
| | 35 | * ''role'' (text, DEFAULT 'admin') |
| | 36 | * ''created_at'' (datetime) |
| | 37 | |
| | 38 | ---- |
| | 39 | |
| | 40 | ==== 4. Environments ==== |
| | 41 | Ентитет кој дефинира логички околини во рамки на еден tenant (пример: default, staging, prod). |
| | 42 | |
| | 43 | * ''id'' (integer, PK) |
| | 44 | * ''tenant_id''* (integer, FK → Tenants.id, NOT NULL) |
| | 45 | * ''name'' (text, NOT NULL) |
| | 46 | * ''created_at'' (datetime) |
| | 47 | |
| | 48 | *Ограничување:* UNIQUE (tenant_id, name) |
| | 49 | |
| | 50 | ---- |
| | 51 | |
| | 52 | ==== 5. ENV_Tokens ==== |
| | 53 | Ентитет кој чува токени за пристап на клиентските агенти во конкретно environment. |
| | 54 | |
| | 55 | * ''id'' (integer, PK) |
| | 56 | * ''tenant_id''* (integer, FK → Tenants.id, NOT NULL) |
| | 57 | * ''env_name'' (text, NOT NULL) |
| | 58 | * ''token'' (text, NOT NULL, UNIQUE) |
| | 59 | * ''created_at'' (datetime) |
| | 60 | * ''expires_at'' (datetime) |
| | 61 | |
| | 62 | ---- |
| | 63 | |
| | 64 | ==== 6. Computers ==== |
| | 65 | Ентитет кој чува податоци за клиентските компјутери што испраќаат логови до серверот. |
| | 66 | |
| | 67 | * ''id'' (integer, PK) |
| | 68 | * ''tenant_id''* (integer, FK → Tenants.id, NOT NULL) |
| | 69 | * ''env_name'' (text, NOT NULL) |
| | 70 | * ''name'' (text, NOT NULL) |
| | 71 | * ''user'' (text) |
| | 72 | * ''ip'' (text) |
| | 73 | * ''os'' (text) |
| | 74 | * ''first_seen'' (datetime) |
| | 75 | * ''last_seen'' (datetime) |
| | 76 | * ''sysmon_available'' (boolean, DEFAULT 0) |
| | 77 | |
| | 78 | *Ограничување:* UNIQUE (tenant_id, name) |
| | 79 | |
| | 80 | ---- |
| | 81 | |
| | 82 | ==== 7. Computer_history ==== |
| | 83 | Ентитет кој чува временски перформансни метрики за компјутерите. |
| | 84 | |
| | 85 | * ''id'' (integer, PK) |
| | 86 | * ''computer_id''* (integer, FK → Computers.id) |
| | 87 | * ''cpu_usage'' (real) |
| | 88 | * ''ram_usage'' (real) |
| | 89 | * ''disk_usage'' (real) |
| | 90 | * ''network_sent_mb'' (real) |
| | 91 | * ''network_recv_mb'' (real) |
| | 92 | * ''timestamp'' (datetime) |
| | 93 | |
| | 94 | ---- |
| | 95 | |
| | 96 | ==== 8. Computer_processes_current ==== |
| | 97 | Ентитет кој чува тековна snapshot состојба на процеси за секој компјутер. |
| | 98 | |
| | 99 | * ''id'' (integer, PK) |
| | 100 | * ''computer_id''* (integer, FK → Computers.id) |
| | 101 | * ''pid'' (integer) |
| | 102 | * ''name'' (text) |
| | 103 | * ''cpu_percent'' (real) |
| | 104 | * ''memory_mb'' (real) |
| | 105 | * ''username'' (text) |
| | 106 | * ''cmdline'' (text) |
| | 107 | * ''timestamp'' (datetime) |
| | 108 | |
| | 109 | ---- |
| | 110 | |
| | 111 | ==== 9. Computer_processes_history ==== |
| | 112 | Ентитет кој чува историски податоци за процеси (опционално, контролирано по environment). |
| | 113 | |
| | 114 | * ''id'' (integer, PK) |
| | 115 | * ''computer_id''* (integer, FK → Computers.id) |
| | 116 | * ''pid'' (integer) |
| | 117 | * ''name'' (text) |
| | 118 | * ''cpu_percent'' (real) |
| | 119 | * ''memory_mb'' (real) |
| | 120 | * ''username'' (text) |
| | 121 | * ''cmdline'' (text) |
| | 122 | * ''timestamp'' (datetime) |
| | 123 | |
| | 124 | ---- |
| | 125 | |
| | 126 | ==== 10. Sysmon_events ==== |
| | 127 | Ентитет кој чува Sysmon и безбедносни настани испратени од клиентите. |
| | 128 | |
| | 129 | * ''id'' (integer, PK) |
| | 130 | * ''computer_id''* (integer, FK → Computers.id) |
| | 131 | * ''event_id'' (integer) |
| | 132 | * ''event_type'' (text) |
| | 133 | * ''message'' (text) |
| | 134 | * ''timestamp'' (datetime) |
| | 135 | * ''details'' (text – JSON како string) |
| | 136 | |
| | 137 | ---- |
| | 138 | |
| | 139 | ==== 11. Network_connections ==== |
| | 140 | Ентитет кој чува информации за мрежни конекции на компјутерите. |
| | 141 | |
| | 142 | * ''id'' (integer, PK) |
| | 143 | * ''computer_id''* (integer, FK → Computers.id) |
| | 144 | * ''pid'' (integer) |
| | 145 | * ''local_address'' (text) |
| | 146 | * ''remote_address'' (text) |
| | 147 | * ''status'' (text) |
| | 148 | * ''process_name'' (text) |
| | 149 | * ''timestamp'' (datetime) |
| | 150 | |
| | 151 | ---- |
| | 152 | |
| | 153 | ==== 12. Security_alerts ==== |
| | 154 | Ентитет кој чува аларми за потенцијални безбедносни инциденти. |
| | 155 | |
| | 156 | * ''id'' (integer, PK) |
| | 157 | * ''computer_id''* (integer, FK → Computers.id) |
| | 158 | * ''alert_type'' (text) |
| | 159 | * ''severity'' (text) |
| | 160 | * ''description'' (text) |
| | 161 | * ''timestamp'' (datetime) |
| | 162 | * ''resolved'' (boolean, DEFAULT 0) |
| | 163 | |
| | 164 | ---- |
| | 165 | |
| | 166 | ==== 13. Env_settings ==== |
| | 167 | Ентитет кој чува конфигурации по environment. |
| | 168 | |
| | 169 | * ''tenant_id''* (integer, PK, FK → Tenants.id) |
| | 170 | * ''env_name''* (text, PK) |
| | 171 | * ''save_process_history'' (boolean, DEFAULT 0) |
| | 172 | * ''created_at'' (datetime) |
| | 173 | * ''updated_at'' (datetime) |
| | 174 | |
| | 175 | --- |
| | 176 | |
| | 177 | === Релации === |
| | 178 | |
| | 179 | # Tenants ⟶ Environments (1:N) |
| | 180 | Еден tenant може да има повеќе environments. |
| | 181 | |
| | 182 | # Tenants ⟷ Users (M:N преку Memberships) |
| | 183 | Корисник може да припаѓа на повеќе tenants со различни улоги. |
| | 184 | |
| | 185 | # Environments ⟶ ENV_Tokens (1:N) |
| | 186 | Едно environment може да има повеќе токени за клиентски агенти. |
| | 187 | |
| | 188 | # Environments ⟶ Computers (1:N) |
| | 189 | Едно environment содржи повеќе компјутери. |
| | 190 | |
| | 191 | # Computers ⟶ Computer_history (1:N) |
| | 192 | Еден компјутер има повеќе временски перформансни записи. |
| | 193 | |
| | 194 | # Computers ⟶ Computer_processes_current (1:N) |
| | 195 | Еден компјутер има повеќе тековни процеси. |
| | 196 | |
| | 197 | # Computers ⟶ Computer_processes_history (1:N) |
| | 198 | Еден компјутер може да има историски процеси (ако е овозможено). |
| | 199 | |
| | 200 | # Computers ⟶ Sysmon_events (1:N) |
| | 201 | Еден компјутер генерира повеќе Sysmon безбедносни настани. |
| | 202 | |
| | 203 | # Computers ⟶ Network_connections (1:N) |
| | 204 | Еден компјутер има повеќе активни мрежни конекции. |
| | 205 | |
| | 206 | # Computers ⟶ Security_alerts (1:N) |
| | 207 | Еден компјутер може да активира повеќе безбедносни аларми. |