Merge pull request #1560 from netalertx/next_release

Next release
This commit is contained in:
Jokob @NetAlertX
2026-03-22 08:43:21 +11:00
committed by GitHub
112 changed files with 2722 additions and 2208 deletions

View File

@@ -12,6 +12,7 @@ description: NetAlertX coding standards and conventions. Use this when writing c
- code has to be maintainable, no duplicate code - code has to be maintainable, no duplicate code
- follow DRY principle - maintainability of code is more important than speed of implementation - follow DRY principle - maintainability of code is more important than speed of implementation
- code files should be less than 500 LOC for better maintainability - code files should be less than 500 LOC for better maintainability
- DB columns must not contain underscores, use camelCase instead (e.g., deviceInstanceId, not device_instance_id)
## File Length ## File Length

View File

@@ -58,12 +58,12 @@ The Events API provides access to **device event logs**, allowing creation, retr
"success": true, "success": true,
"events": [ "events": [
{ {
"eve_MAC": "00:11:22:33:44:55", "eveMac": "00:11:22:33:44:55",
"eve_IP": "192.168.1.10", "eveIp": "192.168.1.10",
"eve_DateTime": "2025-08-24T12:00:00Z", "eveDateTime": "2025-08-24T12:00:00Z",
"eve_EventType": "Device Down", "eveEventType": "Device Down",
"eve_AdditionalInfo": "", "eveAdditionalInfo": "",
"eve_PendingAlertEmail": 1 "evePendingAlertEmail": 1
} }
] ]
} }
@@ -102,11 +102,11 @@ The Events API provides access to **device event logs**, allowing creation, retr
"count": 5, "count": 5,
"events": [ "events": [
{ {
"eve_DateTime": "2025-12-07 12:00:00", "eveDateTime": "2025-12-07 12:00:00",
"eve_EventType": "New Device", "eveEventType": "New Device",
"eve_MAC": "AA:BB:CC:DD:EE:FF", "eveMac": "AA:BB:CC:DD:EE:FF",
"eve_IP": "192.168.1.100", "eveIp": "192.168.1.100",
"eve_AdditionalInfo": "Device detected" "eveAdditionalInfo": "Device detected"
} }
] ]
} }
@@ -127,9 +127,9 @@ The Events API provides access to **device event logs**, allowing creation, retr
"count": 10, "count": 10,
"events": [ "events": [
{ {
"eve_DateTime": "2025-12-07 12:00:00", "eveDateTime": "2025-12-07 12:00:00",
"eve_EventType": "Device Down", "eveEventType": "Device Down",
"eve_MAC": "AA:BB:CC:DD:EE:FF" "eveMac": "AA:BB:CC:DD:EE:FF"
} }
] ]
} }
@@ -159,9 +159,9 @@ The Events API provides access to **device event logs**, allowing creation, retr
1. Total events in the period 1. Total events in the period
2. Total sessions 2. Total sessions
3. Missing sessions 3. Missing sessions
4. Voided events (`eve_EventType LIKE 'VOIDED%'`) 4. Voided events (`eveEventType LIKE 'VOIDED%'`)
5. New device events (`eve_EventType LIKE 'New Device'`) 5. New device events (`eveEventType LIKE 'New Device'`)
6. Device down events (`eve_EventType LIKE 'Device Down'`) 6. Device down events (`eveEventType LIKE 'Device Down'`)
--- ---
@@ -187,7 +187,7 @@ Event endpoints are available as **MCP Tools** for AI assistant integration:
``` ```
* Events are stored in the **Events table** with the following fields: * Events are stored in the **Events table** with the following fields:
`eve_MAC`, `eve_IP`, `eve_DateTime`, `eve_EventType`, `eve_AdditionalInfo`, `eve_PendingAlertEmail`. `eveMac`, `eveIp`, `eveDateTime`, `eveEventType`, `eveAdditionalInfo`, `evePendingAlertEmail`.
* Event creation automatically logs activity for debugging. * Event creation automatically logs activity for debugging.

View File

@@ -106,12 +106,12 @@ curl -X DELETE "http://<server_ip>:<GRAPHQL_PORT>/sessions/delete" \
"success": true, "success": true,
"sessions": [ "sessions": [
{ {
"ses_MAC": "AA:BB:CC:DD:EE:FF", "sesMac": "AA:BB:CC:DD:EE:FF",
"ses_Connection": "2025-08-01 10:00", "sesDateTimeConnection": "2025-08-01 10:00",
"ses_Disconnection": "2025-08-01 12:00", "sesDateTimeDisconnection": "2025-08-01 12:00",
"ses_Duration": "2h 0m", "sesDuration": "2h 0m",
"ses_IP": "192.168.1.10", "sesIp": "192.168.1.10",
"ses_Info": "" "sesAdditionalInfo": ""
} }
] ]
} }
@@ -194,12 +194,12 @@ curl -X GET "http://<server_ip>:<GRAPHQL_PORT>/sessions/calendar?start=2025-08-0
"success": true, "success": true,
"sessions": [ "sessions": [
{ {
"ses_MAC": "AA:BB:CC:DD:EE:FF", "sesMac": "AA:BB:CC:DD:EE:FF",
"ses_Connection": "2025-08-01 10:00", "sesDateTimeConnection": "2025-08-01 10:00",
"ses_Disconnection": "2025-08-01 12:00", "sesDateTimeDisconnection": "2025-08-01 12:00",
"ses_Duration": "2h 0m", "sesDuration": "2h 0m",
"ses_IP": "192.168.1.10", "sesIp": "192.168.1.10",
"ses_Info": "" "sesAdditionalInfo": ""
} }
] ]
} }

View File

@@ -43,7 +43,7 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo
17:31:05 [Scheduler] run for PIHOLE: YES 17:31:05 [Scheduler] run for PIHOLE: YES
17:31:05 [Plugin utils] --------------------------------------------- 17:31:05 [Plugin utils] ---------------------------------------------
17:31:05 [Plugin utils] display_name: PiHole (Device sync) 17:31:05 [Plugin utils] display_name: PiHole (Device sync)
17:31:05 [Plugins] CMD: SELECT n.hwaddr AS Object_PrimaryID, {s-quote}null{s-quote} AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr is not {s-quote}00:00:00:00:00:00{s-quote} AND na.ip is not null 17:31:05 [Plugins] CMD: SELECT n.hwaddr AS objectPrimaryId, {s-quote}null{s-quote} AS objectSecondaryId, datetime() AS DateTime, na.ip AS watchedValue1, n.lastQuery AS watchedValue2, na.name AS watchedValue3, n.macVendor AS watchedValue4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr is not {s-quote}00:00:00:00:00:00{s-quote} AND na.ip is not null
17:31:05 [Plugins] setTyp: subnets 17:31:05 [Plugins] setTyp: subnets
17:31:05 [Plugin utils] Flattening the below array 17:31:05 [Plugin utils] Flattening the below array
17:31:05 ['192.168.1.0/24 --interface=eth1'] 17:31:05 ['192.168.1.0/24 --interface=eth1']
@@ -52,7 +52,7 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo
17:31:05 [Plugins] Convert to Base64: True 17:31:05 [Plugins] Convert to Base64: True
17:31:05 [Plugins] base64 value: b'MTkyLjE2OC4xLjAvMjQgLS1pbnRlcmZhY2U9ZXRoMQ==' 17:31:05 [Plugins] base64 value: b'MTkyLjE2OC4xLjAvMjQgLS1pbnRlcmZhY2U9ZXRoMQ=='
17:31:05 [Plugins] Timeout: 10 17:31:05 [Plugins] Timeout: 10
17:31:05 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr is not '00:00:00:00:00:00' AND na.ip is not null 17:31:05 [Plugins] Executing: SELECT n.hwaddr AS objectPrimaryId, 'null' AS objectSecondaryId, datetime() AS DateTime, na.ip AS watchedValue1, n.lastQuery AS watchedValue2, na.name AS watchedValue3, n.macVendor AS watchedValue4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr is not '00:00:00:00:00:00' AND na.ip is not null
🔻 🔻
17:31:05 [Plugins] SUCCESS, received 2 entries 17:31:05 [Plugins] SUCCESS, received 2 entries
17:31:05 [Plugins] sqlParam entries: [(0, 'PIHOLE', '01:01:01:01:01:01', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'not-processed', 'null', 'null', '01:01:01:01:01:01'), (0, 'PIHOLE', '02:42:ac:1e:00:02', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'not-processed', 'null', 'null', '02:42:ac:1e:00:02')] 17:31:05 [Plugins] sqlParam entries: [(0, 'PIHOLE', '01:01:01:01:01:01', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'not-processed', 'null', 'null', '01:01:01:01:01:01'), (0, 'PIHOLE', '02:42:ac:1e:00:02', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'not-processed', 'null', 'null', '02:42:ac:1e:00:02')]

View File

@@ -36,7 +36,7 @@ The following device properties influence notifications. You can:
On almost all plugins there are 2 core settings, `<plugin>_WATCH` and `<plugin>_REPORT_ON`. On almost all plugins there are 2 core settings, `<plugin>_WATCH` and `<plugin>_REPORT_ON`.
1. `<plugin>_WATCH` specifies the columns which the app should watch. If watched columns change the device state is considered changed. This changed status is then used to decide to send out notifications based on the `<plugin>_REPORT_ON` setting. 1. `<plugin>_WATCH` specifies the columns which the app should watch. If watched columns change the device state is considered changed. This changed status is then used to decide to send out notifications based on the `<plugin>_REPORT_ON` setting.
2. `<plugin>_REPORT_ON` let's you specify on which events the app should notify you. This is related to the `<plugin>_WATCH` setting. So if you select `watched-changed` and in `<plugin>_WATCH` you only select `Watched_Value1`, then a notification is triggered if `Watched_Value1` is changed from the previous value, but no notification is send if `Watched_Value2` changes. 2. `<plugin>_REPORT_ON` let's you specify on which events the app should notify you. This is related to the `<plugin>_WATCH` setting. So if you select `watched-changed` and in `<plugin>_WATCH` you only select `watchedValue1`, then a notification is triggered if `watchedValue1` is changed from the previous value, but no notification is send if `watchedValue2` changes.
Click the **Read more in the docs.** Link at the top of each plugin to get more details on how the given plugin works. Click the **Read more in the docs.** Link at the top of each plugin to get more details on how the given plugin works.

View File

@@ -10,22 +10,23 @@ HTML email tables are **not affected** by these templates.
1. Go to **Settings → Notification Processing**. 1. Go to **Settings → Notification Processing**.
2. Set a template string for the section you want to customize, e.g.: 2. Set a template string for the section you want to customize, e.g.:
- **Text Template: New Devices** → `{Device name} ({MAC}) - {IP}` - **Text Template: New Devices** → `{devName} ({eveMac}) - {eveIp}`
3. Save. The next notification will use your format. 3. Save. The next notification will use your format.
**Before (default):** **Before (default):**
``` ```
🆕 New devices 🆕 New devices
--------- ---------
MAC: aa:bb:cc:dd:ee:ff devName: MyPhone
Datetime: 2025-01-15 10:30:00 eveMac: aa:bb:cc:dd:ee:ff
IP: 192.168.1.42 devVendor: Apple
Event Type: New Device eveIp: 192.168.1.42
Device name: MyPhone eveDateTime: 2025-01-15 10:30:00
Comments: eveEventType: New Device
devComments:
``` ```
**After (with template `{Device name} ({MAC}) - {IP}`):** **After (with template `{devName} ({eveMac}) - {eveIp}`):**
``` ```
🆕 New devices 🆕 New devices
--------- ---------
@@ -50,7 +51,7 @@ When a template is **empty**, the section uses the original vertical `Header: Va
Use `{FieldName}` to insert a value from the notification data. Field names are **case-sensitive** and must match the column names exactly. Use `{FieldName}` to insert a value from the notification data. Field names are **case-sensitive** and must match the column names exactly.
``` ```
{Device name} ({MAC}) connected at {Datetime} {devName} ({eveMac}) connected at {eveDateTime}
``` ```
- No loops, conditionals, or nesting — just simple string replacement. - No loops, conditionals, or nesting — just simple string replacement.
@@ -58,52 +59,41 @@ Use `{FieldName}` to insert a value from the notification data. Field names are
## Variable Availability by Section ## Variable Availability by Section
Each section has different available fields because they come from different database queries. All four device sections (`new_devices`, `down_devices`, `down_reconnected`, `events`) share the same unified field names.
### `new_devices` and `events` ### `new_devices`, `down_devices`, `down_reconnected`, and `events`
| Variable | Description |
|----------|-------------|
| `{MAC}` | Device MAC address |
| `{Datetime}` | Event timestamp |
| `{IP}` | Device IP address |
| `{Event Type}` | Type of event (e.g. `New Device`, `Connected`) |
| `{Device name}` | Device display name |
| `{Comments}` | Device comments |
**Example:** `{Device name} ({MAC}) - {IP} [{Event Type}]`
### `down_devices` and `down_reconnected`
| Variable | Description | | Variable | Description |
|----------|-------------| |----------|-------------|
| `{devName}` | Device display name | | `{devName}` | Device display name |
| `{eve_MAC}` | Device MAC address | | `{eveMac}` | Device MAC address |
| `{devVendor}` | Device vendor/manufacturer | | `{devVendor}` | Device vendor/manufacturer |
| `{eve_IP}` | Device IP address | | `{eveIp}` | Device IP address |
| `{eve_DateTime}` | Event timestamp | | `{eveDateTime}` | Event timestamp |
| `{eve_EventType}` | Type of event | | `{eveEventType}` | Type of event (e.g. `New Device`, `Connected`, `Device Down`) |
| `{devComments}` | Device comments |
**Example:** `{devName} ({eve_MAC}) {devVendor} - went down at {eve_DateTime}` **Example (new_devices/events):** `{devName} ({eveMac}) - {eveIp} [{eveEventType}]`
**Example (down_devices):** `{devName} ({eveMac}) {devVendor} - went down at {eveDateTime}`
**Example (down_reconnected):** `{devName} ({eveMac}) reconnected at {eveDateTime}`
### `plugins` ### `plugins`
| Variable | Description | | Variable | Description |
|----------|-------------| |----------|-------------|
| `{Plugin}` | Plugin code name | | `{plugin}` | Plugin code name |
| `{Object_PrimaryId}` | Primary identifier of the object | | `{objectPrimaryId}` | Primary identifier of the object |
| `{Object_SecondaryId}` | Secondary identifier | | `{objectSecondaryId}` | Secondary identifier |
| `{DateTimeChanged}` | Timestamp of change | | `{dateTimeChanged}` | Timestamp of change |
| `{Watched_Value1}` | First watched value | | `{watchedValue1}` | First watched value |
| `{Watched_Value2}` | Second watched value | | `{watchedValue2}` | Second watched value |
| `{Watched_Value3}` | Third watched value | | `{watchedValue3}` | Third watched value |
| `{Watched_Value4}` | Fourth watched value | | `{watchedValue4}` | Fourth watched value |
| `{Status}` | Plugin event status | | `{status}` | Plugin event status |
**Example:** `{Plugin}: {Object_PrimaryId} - {Status}` **Example:** `{plugin}: {objectPrimaryId} - {status}`
> [!NOTE]
> Field names differ between sections because they come from different SQL queries. A template configured for `new_devices` cannot use `{devName}` — that field is only available in `down_devices` and `down_reconnected`.
## Section Headers Toggle ## Section Headers Toggle

View File

@@ -179,13 +179,13 @@ Quick reference:
| Column | Name | Required | Example | | Column | Name | Required | Example |
|--------|------|----------|---------| |--------|------|----------|---------|
| 0 | Object_PrimaryID | **YES** | `"device_name"` or `"192.168.1.1"` | | 0 | objectPrimaryId | **YES** | `"device_name"` or `"192.168.1.1"` |
| 1 | Object_SecondaryID | no | `"secondary_id"` or `null` | | 1 | objectSecondaryId | no | `"secondary_id"` or `null` |
| 2 | DateTime | **YES** | `"2023-01-02 15:56:30"` | | 2 | DateTime | **YES** | `"2023-01-02 15:56:30"` |
| 3 | Watched_Value1 | **YES** | `"online"` or `"200"` | | 3 | watchedValue1 | **YES** | `"online"` or `"200"` |
| 4 | Watched_Value2 | no | `"ip_address"` or `null` | | 4 | watchedValue2 | no | `"ip_address"` or `null` |
| 5 | Watched_Value3 | no | `null` | | 5 | watchedValue3 | no | `null` |
| 6 | Watched_Value4 | no | `null` | | 6 | watchedValue4 | no | `null` |
| 7 | Extra | no | `"additional data"` or `null` | | 7 | Extra | no | `"additional data"` or `null` |
| 8 | ForeignKey | no | `"aa:bb:cc:dd:ee:ff"` or `null` | | 8 | ForeignKey | no | `"aa:bb:cc:dd:ee:ff"` or `null` |
@@ -243,7 +243,7 @@ Control which rows display in the UI:
{ {
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -267,7 +267,7 @@ To import plugin data into NetAlertX tables for device discovery or notification
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -345,7 +345,7 @@ See [PLUGINS_DEV_SETTINGS.md](PLUGINS_DEV_SETTINGS.md) for complete settings doc
### Plugin Output Format ### Plugin Output Format
``` ```
Object_PrimaryID|Object_SecondaryID|DateTime|Watched_Value1|Watched_Value2|Watched_Value3|Watched_Value4|Extra|ForeignKey objectPrimaryId|objectSecondaryId|DateTime|watchedValue1|watchedValue2|watchedValue3|watchedValue4|Extra|ForeignKey
``` ```
9 required columns, 4 optional helpers = 13 max 9 required columns, 4 optional helpers = 13 max

View File

@@ -77,7 +77,7 @@ It also describes plugin output expectations and the main plugin categories.
* `database_column_definitions` * `database_column_definitions`
* `mapped_to_table` * `mapped_to_table`
**Example:** `Object_PrimaryID → devMAC` **Example:** `objectPrimaryId → devMAC`
--- ---
@@ -88,9 +88,9 @@ Output values are pipe-delimited in a fixed order.
#### Identifiers #### Identifiers
* `Object_PrimaryID` and `Object_SecondaryID` uniquely identify records (for example, `MAC|IP`). * `objectPrimaryId` and `objectSecondaryId` uniquely identify records (for example, `MAC|IP`).
#### Watched Values (`Watched_Value14`) #### Watched Values (`watchedValue14`)
* Used by the core to detect changes between runs. * Used by the core to detect changes between runs.
* Changes in these fields can trigger notifications. * Changes in these fields can trigger notifications.
@@ -114,7 +114,7 @@ Output values are pipe-delimited in a fixed order.
### 7. Persistence ### 7. Persistence
* Parsed data is **upserted** into the database. * Parsed data is **upserted** into the database.
* Conflicts are resolved using the combined key: `Object_PrimaryID + Object_SecondaryID`. * Conflicts are resolved using the combined key: `objectPrimaryId + objectSecondaryId`.
--- ---

View File

@@ -107,7 +107,7 @@ Query the NetAlertX SQLite database and display results.
{ {
"function": "CMD", "function": "CMD",
"type": {"dataType": "string", "elements": [{"elementType": "input", "elementOptions": [], "transformers": []}]}, "type": {"dataType": "string", "elements": [{"elementType": "input", "elementOptions": [], "transformers": []}]},
"default_value": "SELECT dv.devName as Object_PrimaryID, cast(dv.devLastIP as VARCHAR(100)) || ':' || cast(SUBSTR(ns.Port, 0, INSTR(ns.Port, '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, null as Watched_Value3, null as Watched_Value4, ns.Extra as Extra, dv.devMac as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT devName, devMac, devLastIP FROM Devices) dv ON ns.MAC = dv.devMac", "default_value": "SELECT dv.devName as objectPrimaryId, cast(dv.devLastIP as VARCHAR(100)) || ':' || cast(SUBSTR(ns.Port, 0, INSTR(ns.Port, '/')) as VARCHAR(100)) as objectSecondaryId, datetime() as DateTime, ns.Service as watchedValue1, ns.State as watchedValue2, null as watchedValue3, null as watchedValue4, ns.Extra as Extra, dv.devMac as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT devName, devMac, devLastIP FROM Devices) dv ON ns.MAC = dv.devMac",
"localized": ["name"], "localized": ["name"],
"name": [{"language_code": "en_us", "string": "SQL to run"}], "name": [{"language_code": "en_us", "string": "SQL to run"}],
"description": [{"language_code": "en_us", "string": "This SQL query populates the plugin table"}] "description": [{"language_code": "en_us", "string": "This SQL query populates the plugin table"}]
@@ -118,13 +118,13 @@ Query the NetAlertX SQLite database and display results.
```sql ```sql
SELECT SELECT
e.EventValue as Object_PrimaryID, e.EventValue as objectPrimaryId,
d.devName as Object_SecondaryID, d.devName as objectSecondaryId,
e.EventDateTime as DateTime, e.EventDateTime as DateTime,
e.EventType as Watched_Value1, e.EventType as watchedValue1,
d.devLastIP as Watched_Value2, d.devLastIP as watchedValue2,
null as Watched_Value3, null as watchedValue3,
null as Watched_Value4, null as watchedValue4,
e.EventDetails as Extra, e.EventDetails as Extra,
d.devMac as ForeignKey d.devMac as ForeignKey
FROM FROM
@@ -181,7 +181,7 @@ Then set data source and query:
```json ```json
{ {
"function": "CMD", "function": "CMD",
"default_value": "SELECT hwaddr as Object_PrimaryID, cast('http://' || (SELECT ip FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1) as VARCHAR(100)) || ':' || cast(SUBSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1), 0, INSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1), '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, macVendor as Watched_Value1, lastQuery as Watched_Value2, (SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1) as Watched_Value3, null as Watched_Value4, '' as Extra, hwaddr as ForeignKey FROM EXTERNAL_PIHOLE.network WHERE hwaddr NOT LIKE 'ip-%' AND hwaddr <> '00:00:00:00:00:00'", "default_value": "SELECT hwaddr as objectPrimaryId, cast('http://' || (SELECT ip FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1) as VARCHAR(100)) || ':' || cast(SUBSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1), 0, INSTR((SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1), '/')) as VARCHAR(100)) as objectSecondaryId, datetime() as DateTime, macVendor as watchedValue1, lastQuery as watchedValue2, (SELECT name FROM EXTERNAL_PIHOLE.network_addresses WHERE network_id = id ORDER BY lastseen DESC LIMIT 1) as watchedValue3, null as watchedValue4, '' as Extra, hwaddr as ForeignKey FROM EXTERNAL_PIHOLE.network WHERE hwaddr NOT LIKE 'ip-%' AND hwaddr <> '00:00:00:00:00:00'",
"localized": ["name"], "localized": ["name"],
"name": [{"language_code": "en_us", "string": "SQL to run"}] "name": [{"language_code": "en_us", "string": "SQL to run"}]
} }

View File

@@ -18,19 +18,19 @@ Plugins communicate with NetAlertX by writing results to a **pipe-delimited log
## Column Specification ## Column Specification
> [!NOTE] > [!NOTE]
> The order of columns is **FIXED** and cannot be changed. All 9 mandatory columns must be provided. If you use any optional column (`HelpVal1`), you must supply all optional columns (`HelpVal1` through `HelpVal4`). > The order of columns is **FIXED** and cannot be changed. All 9 mandatory columns must be provided. If you use any optional column (`helpVal1`), you must supply all optional columns (`helpVal1` through `helpVal4`).
### Mandatory Columns (08) ### Mandatory Columns (08)
| Order | Column Name | Type | Required | Description | | Order | Column Name | Type | Required | Description |
|-------|-------------|------|----------|-------------| |-------|-------------|------|----------|-------------|
| 0 | `Object_PrimaryID` | string | **YES** | The primary identifier for grouping. Examples: device MAC, hostname, service name, or any unique ID | | 0 | `objectPrimaryId` | string | **YES** | The primary identifier for grouping. Examples: device MAC, hostname, service name, or any unique ID |
| 1 | `Object_SecondaryID` | string | no | Secondary identifier for relationships (e.g., IP address, port, sub-ID). Use `null` if not needed | | 1 | `objectSecondaryId` | string | no | Secondary identifier for relationships (e.g., IP address, port, sub-ID). Use `null` if not needed |
| 2 | `DateTime` | string | **YES** | Timestamp when the event/data was collected. Format: `YYYY-MM-DD HH:MM:SS` | | 2 | `DateTime` | string | **YES** | Timestamp when the event/data was collected. Format: `YYYY-MM-DD HH:MM:SS` |
| 3 | `Watched_Value1` | string | **YES** | Primary watched value. Changes trigger notifications. Examples: IP address, status, version | | 3 | `watchedValue1` | string | **YES** | Primary watched value. Changes trigger notifications. Examples: IP address, status, version |
| 4 | `Watched_Value2` | string | no | Secondary watched value. Use `null` if not needed | | 4 | `watchedValue2` | string | no | Secondary watched value. Use `null` if not needed |
| 5 | `Watched_Value3` | string | no | Tertiary watched value. Use `null` if not needed | | 5 | `watchedValue3` | string | no | Tertiary watched value. Use `null` if not needed |
| 6 | `Watched_Value4` | string | no | Quaternary watched value. Use `null` if not needed | | 6 | `watchedValue4` | string | no | Quaternary watched value. Use `null` if not needed |
| 7 | `Extra` | string | no | Any additional metadata to display in UI and notifications. Use `null` if not needed | | 7 | `Extra` | string | no | Any additional metadata to display in UI and notifications. Use `null` if not needed |
| 8 | `ForeignKey` | string | no | Foreign key linking to parent object (usually MAC address for device relationship). Use `null` if not needed | | 8 | `ForeignKey` | string | no | Foreign key linking to parent object (usually MAC address for device relationship). Use `null` if not needed |
@@ -38,10 +38,10 @@ Plugins communicate with NetAlertX by writing results to a **pipe-delimited log
| Order | Column Name | Type | Required | Description | | Order | Column Name | Type | Required | Description |
|-------|-------------|------|----------|-------------| |-------|-------------|------|----------|-------------|
| 9 | `HelpVal1` | string | *conditional* | Helper value 1. If used, all help values must be supplied | | 9 | `helpVal1` | string | *conditional* | Helper value 1. If used, all help values must be supplied |
| 10 | `HelpVal2` | string | *conditional* | Helper value 2. If used, all help values must be supplied | | 10 | `helpVal2` | string | *conditional* | Helper value 2. If used, all help values must be supplied |
| 11 | `HelpVal3` | string | *conditional* | Helper value 3. If used, all help values must be supplied | | 11 | `helpVal3` | string | *conditional* | Helper value 3. If used, all help values must be supplied |
| 12 | `HelpVal4` | string | *conditional* | Helper value 4. If used, all help values must be supplied | | 12 | `helpVal4` | string | *conditional* | Helper value 4. If used, all help values must be supplied |
## Usage Guide ## Usage Guide
@@ -58,15 +58,15 @@ Watched values are fields that the NetAlertX core monitors for **changes between
**How to use them:** **How to use them:**
- `Watched_Value1`: Always required; primary indicator of status/state - `watchedValue1`: Always required; primary indicator of status/state
- `Watched_Value24`: Optional; use for secondary/tertiary state information - `watchedValue24`: Optional; use for secondary/tertiary state information
- Leave unused ones as `null` - Leave unused ones as `null`
**Example:** **Example:**
- Device scanner: `Watched_Value1 = "online"` or `"offline"` - Device scanner: `watchedValue1 = "online"` or `"offline"`
- Port scanner: `Watched_Value1 = "80"` (port number), `Watched_Value2 = "open"` (state) - Port scanner: `watchedValue1 = "80"` (port number), `watchedValue2 = "open"` (state)
- Service monitor: `Watched_Value1 = "200"` (HTTP status), `Watched_Value2 = "0.45"` (response time) - Service monitor: `watchedValue1 = "200"` (HTTP status), `watchedValue2 = "0.45"` (response time)
### Foreign Key ### Foreign Key
@@ -110,14 +110,14 @@ https://google.com|null|2023-01-02 15:56:30|200|0.7898||null|null
Missing pipe Missing pipe
``` ```
**Missing mandatory Watched_Value1** (column 3): **Missing mandatory watchedValue1** (column 3):
```csv ```csv
https://duckduckgo.com|192.168.1.1|2023-01-02 15:56:30|null|0.9898|null|null|Best|null https://duckduckgo.com|192.168.1.1|2023-01-02 15:56:30|null|0.9898|null|null|Best|null
Must not be null Must not be null
``` ```
**Incomplete optional columns** (has HelpVal1 but missing HelpVal24): **Incomplete optional columns** (has helpVal1 but missing helpVal24):
```csv ```csv
device|null|2023-01-02 15:56:30|status|null|null|null|null|null|helper1 device|null|2023-01-02 15:56:30|status|null|null|null|null|null|helper1
@@ -146,19 +146,19 @@ plugin_objects = Plugin_Objects("YOURPREFIX")
# Add objects # Add objects
plugin_objects.add_object( plugin_objects.add_object(
Object_PrimaryID="device_id", objectPrimaryId="device_id",
Object_SecondaryID="192.168.1.1", objectSecondaryId="192.168.1.1",
DateTime="2023-01-02 15:56:30", DateTime="2023-01-02 15:56:30",
Watched_Value1="online", watchedValue1="online",
Watched_Value2=None, watchedValue2=None,
Watched_Value3=None, watchedValue3=None,
Watched_Value4=None, watchedValue4=None,
Extra="Additional data", Extra="Additional data",
ForeignKey="aa:bb:cc:dd:ee:ff", ForeignKey="aa:bb:cc:dd:ee:ff",
HelpVal1=None, helpVal1=None,
HelpVal2=None, helpVal2=None,
HelpVal3=None, helpVal3=None,
HelpVal4=None helpVal4=None
) )
# Write results (handles formatting, sanitization, and file creation) # Write results (handles formatting, sanitization, and file creation)
@@ -177,7 +177,7 @@ The library automatically:
The core runs **de-duplication once per hour** on the `Plugins_Objects` table: The core runs **de-duplication once per hour** on the `Plugins_Objects` table:
- **Duplicate Detection Key:** Combination of `Object_PrimaryID`, `Object_SecondaryID`, `Plugin` (auto-filled from `unique_prefix`), and `UserData` - **Duplicate Detection Key:** Combination of `objectPrimaryId`, `objectSecondaryId`, `Plugin` (auto-filled from `unique_prefix`), and `UserData`
- **Resolution:** Oldest duplicate entries are removed, newest are kept - **Resolution:** Oldest duplicate entries are removed, newest are kept
- **Use Case:** Prevents duplicate notifications when the same object is detected multiple times - **Use Case:** Prevents duplicate notifications when the same object is detected multiple times
@@ -213,9 +213,9 @@ Before writing your plugin's `script.py`, ensure:
- [ ] **9 or 13 columns** in each output line (8 or 12 pipe separators) - [ ] **9 or 13 columns** in each output line (8 or 12 pipe separators)
- [ ] **Mandatory columns filled:** - [ ] **Mandatory columns filled:**
- Column 0: `Object_PrimaryID` (not null) - Column 0: `objectPrimaryId` (not null)
- Column 2: `DateTime` in `YYYY-MM-DD HH:MM:SS` format - Column 2: `DateTime` in `YYYY-MM-DD HH:MM:SS` format
- Column 3: `Watched_Value1` (not null) - Column 3: `watchedValue1` (not null)
- [ ] **Null values as literal string** `null` (not empty string or special chars) - [ ] **Null values as literal string** `null` (not empty string or special chars)
- [ ] **No extra pipes or misaligned columns** - [ ] **No extra pipes or misaligned columns**
- [ ] **If using optional helpers** (columns 912), all 4 must be present - [ ] **If using optional helpers** (columns 912), all 4 must be present

View File

@@ -68,13 +68,13 @@ try:
# Add an object to results # Add an object to results
plugin_objects.add_object( plugin_objects.add_object(
Object_PrimaryID="example_id", objectPrimaryId="example_id",
Object_SecondaryID=None, objectSecondaryId=None,
DateTime="2023-01-02 15:56:30", DateTime="2023-01-02 15:56:30",
Watched_Value1="value1", watchedValue1="value1",
Watched_Value2=None, watchedValue2=None,
Watched_Value3=None, watchedValue3=None,
Watched_Value4=None, watchedValue4=None,
Extra="additional_data", Extra="additional_data",
ForeignKey=None ForeignKey=None
) )

View File

@@ -16,7 +16,7 @@ Each column definition specifies:
```json ```json
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "devMac", "mapped_to_column": "devMac",
"mapped_to_column_data": null, "mapped_to_column_data": null,
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
@@ -39,7 +39,7 @@ Each column definition specifies:
| Property | Type | Required | Description | | Property | Type | Required | Description |
|----------|------|----------|-------------| |----------|------|----------|-------------|
| `column` | string | **YES** | Source column name from data contract (e.g., `Object_PrimaryID`, `Watched_Value1`) | | `column` | string | **YES** | Source column name from data contract (e.g., `objectPrimaryId`, `watchedValue1`) |
| `mapped_to_column` | string | no | Target database column if mapping to a table like `CurrentScan` | | `mapped_to_column` | string | no | Target database column if mapping to a table like `CurrentScan` |
| `mapped_to_column_data` | object | no | Static value to map instead of using column data | | `mapped_to_column_data` | object | no | Static value to map instead of using column data |
| `css_classes` | string | no | Bootstrap CSS classes for width/spacing (e.g., `"col-sm-2"`, `"col-sm-6"`) | | `css_classes` | string | no | Bootstrap CSS classes for width/spacing (e.g., `"col-sm-2"`, `"col-sm-6"`) |
@@ -64,7 +64,7 @@ Plain text display (read-only).
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "label", "type": "label",
"localized": ["name"], "localized": ["name"],
@@ -99,7 +99,7 @@ Resolves an IP address to a MAC address and creates a device link.
```json ```json
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
"localized": ["name"], "localized": ["name"],
@@ -117,7 +117,7 @@ Creates a device link with the target device's name as the link label.
```json ```json
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
"localized": ["name"], "localized": ["name"],
@@ -135,7 +135,7 @@ Renders as a clickable HTTP/HTTPS link.
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "url", "type": "url",
"localized": ["name"], "localized": ["name"],
@@ -153,7 +153,7 @@ Creates two links (HTTP and HTTPS) as lock icons for the given IP/hostname.
```json ```json
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"show": true, "show": true,
"type": "url_http_https", "type": "url_http_https",
"localized": ["name"], "localized": ["name"],
@@ -207,7 +207,7 @@ Color-codes values based on ranges. Useful for status codes, latency, capacity p
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "threshold", "type": "threshold",
"options": [ "options": [
@@ -252,7 +252,7 @@ Replaces specific values with display strings or HTML.
```json ```json
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"show": true, "show": true,
"type": "replace", "type": "replace",
"options": [ "options": [
@@ -286,7 +286,7 @@ Applies a regular expression to extract/transform values.
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "regex", "type": "regex",
"options": [ "options": [
@@ -310,7 +310,7 @@ Evaluates JavaScript code with access to the column value (use `${value}` or `{v
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "eval", "type": "eval",
"default_value": "", "default_value": "",
@@ -322,7 +322,7 @@ Evaluates JavaScript code with access to the column value (use `${value}` or `{v
**Example with custom formatting:** **Example with custom formatting:**
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "eval", "type": "eval",
"options": [ "options": [
@@ -347,7 +347,7 @@ You can chain multiple transformations with dot notation:
```json ```json
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"show": true, "show": true,
"type": "regex.url_http_https", "type": "regex.url_http_https",
"options": [ "options": [
@@ -376,7 +376,7 @@ Use SQL query results to populate dropdown options:
```json ```json
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"show": true, "show": true,
"type": "select", "type": "select",
"options": ["{value}"], "options": ["{value}"],
@@ -405,7 +405,7 @@ Use plugin settings to populate options:
```json ```json
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"show": true, "show": true,
"type": "select", "type": "select",
"options": ["{value}"], "options": ["{value}"],
@@ -439,7 +439,7 @@ To import plugin data into the device scan pipeline (for notifications, heuristi
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -447,7 +447,7 @@ To import plugin data into the device scan pipeline (for notifications, heuristi
"name": [{"language_code": "en_us", "string": "MAC Address"}] "name": [{"language_code": "en_us", "string": "MAC Address"}]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -501,7 +501,7 @@ Control which rows are displayed based on filter conditions. Filters are applied
{ {
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -545,7 +545,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
{ {
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -555,7 +555,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
"name": [{"language_code": "en_us", "string": "MAC Address"}] "name": [{"language_code": "en_us", "string": "MAC Address"}]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -574,7 +574,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
"name": [{"language_code": "en_us", "string": "Last Seen"}] "name": [{"language_code": "en_us", "string": "Last Seen"}]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "threshold", "type": "threshold",
@@ -589,7 +589,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
"name": [{"language_code": "en_us", "string": "HTTP Status"}] "name": [{"language_code": "en_us", "string": "HTTP Status"}]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "label", "type": "label",

View File

@@ -61,16 +61,16 @@ $(document).ready(function () {
appEvents(options: $options) { appEvents(options: $options) {
count count
appEvents { appEvents {
DateTimeCreated dateTimeCreated
AppEventProcessed appEventProcessed
AppEventType appEventType
ObjectType objectType
ObjectPrimaryID objectPrimaryId
ObjectSecondaryID objectSecondaryId
ObjectStatus objectStatus
ObjectPlugin objectPlugin
ObjectGUID objectGuid
GUID guid
} }
} }
} }
@@ -128,16 +128,16 @@ $(document).ready(function () {
}, },
columns: [ columns: [
{ data: 'DateTimeCreated', title: getString('AppEvents_DateTimeCreated') }, { data: 'dateTimeCreated', title: getString('AppEvents_DateTimeCreated') },
{ data: 'AppEventProcessed', title: getString('AppEvents_AppEventProcessed') }, { data: 'appEventProcessed', title: getString('AppEvents_AppEventProcessed') },
{ data: 'AppEventType', title: getString('AppEvents_Type') }, { data: 'appEventType', title: getString('AppEvents_Type') },
{ data: 'ObjectType', title: getString('AppEvents_ObjectType') }, { data: 'objectType', title: getString('AppEvents_ObjectType') },
{ data: 'ObjectPrimaryID', title: getString('AppEvents_ObjectPrimaryID') }, { data: 'objectPrimaryId', title: getString('AppEvents_ObjectPrimaryID') },
{ data: 'ObjectSecondaryID', title: getString('AppEvents_ObjectSecondaryID') }, { data: 'objectSecondaryId', title: getString('AppEvents_ObjectSecondaryID') },
{ data: 'ObjectStatus', title: getString('AppEvents_ObjectStatus') }, { data: 'objectStatus', title: getString('AppEvents_ObjectStatus') },
{ data: 'ObjectPlugin', title: getString('AppEvents_Plugin') }, { data: 'objectPlugin', title: getString('AppEvents_Plugin') },
{ data: 'ObjectGUID', title: 'Object GUID' }, { data: 'objectGuid', title: 'Object GUID' },
{ data: 'GUID', title: 'Event GUID' } { data: 'guid', title: 'Event GUID' }
], ],
columnDefs: [ columnDefs: [

View File

@@ -38,12 +38,12 @@ function loadEventsData() {
let { start, end } = getPeriodStartEnd(period); let { start, end } = getPeriodStartEnd(period);
const rawSql = ` const rawSql = `
SELECT eve_DateTime, eve_EventType, eve_IP, eve_AdditionalInfo SELECT eveDateTime, eveEventType, eveIp, eveAdditionalInfo
FROM Events FROM Events
WHERE eve_MAC = "${mac}" WHERE eveMac = "${mac}"
AND eve_DateTime BETWEEN "${start}" AND "${end}" AND eveDateTime BETWEEN "${start}" AND "${end}"
AND ( AND (
(eve_EventType NOT IN ("Connected", "Disconnected", "VOIDED - Connected", "VOIDED - Disconnected")) (eveEventType NOT IN ("Connected", "Disconnected", "VOIDED - Connected", "VOIDED - Disconnected"))
OR "${hideConnectionsStr}" = "false" OR "${hideConnectionsStr}" = "false"
) )
`; `;
@@ -66,15 +66,15 @@ function loadEventsData() {
success: function (data) { success: function (data) {
// assuming read_query returns rows directly // assuming read_query returns rows directly
const rows = data["results"].map(row => { const rows = data["results"].map(row => {
const rawDate = row.eve_DateTime; const rawDate = row.eveDateTime;
const formattedDate = rawDate ? localizeTimestamp(rawDate) : '-'; const formattedDate = rawDate ? localizeTimestamp(rawDate) : '-';
return [ return [
formattedDate, formattedDate,
row.eve_DateTime, row.eveDateTime,
row.eve_EventType, row.eveEventType,
row.eve_IP, row.eveIp,
row.eve_AdditionalInfo row.eveAdditionalInfo
]; ];
}); });

View File

@@ -121,12 +121,12 @@ function loadSessionsData() {
if (data.success && data.sessions.length) { if (data.success && data.sessions.length) {
data.sessions.forEach(session => { data.sessions.forEach(session => {
table.row.add([ table.row.add([
session.ses_DateTimeOrder, session.sesDateTimeOrder,
session.ses_Connection, session.sesConnection,
session.ses_Disconnection, session.sesDisconnection,
session.ses_Duration, session.sesDuration,
session.ses_IP, session.sesIp,
session.ses_Info session.sesInfo
]); ]);
}); });
} }

View File

@@ -16,7 +16,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
var completedCalls = [] var completedCalls = []
var completedCalls_final = ['cacheApiConfig', 'cacheSettings', 'cacheStrings', 'cacheDevices']; var completedCalls_final = ['cacheApiConfig', 'cacheSettings', 'cacheStrings_v2', 'cacheDevices'];
var lang_completedCalls = 0; var lang_completedCalls = 0;

View File

@@ -290,7 +290,7 @@ function getSetting (key) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function cacheStrings() { function cacheStrings() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(getCache(CACHE_KEYS.initFlag('cacheStrings')) === "true") if(getCache(CACHE_KEYS.initFlag('cacheStrings_v2')) === "true")
{ {
// Core strings are cached, but plugin strings may have failed silently on // Core strings are cached, but plugin strings may have failed silently on
// the first load (non-fatal fetch). Always re-fetch them so that plugin // the first load (non-fatal fetch). Always re-fetch them so that plugin
@@ -304,7 +304,7 @@ function cacheStrings() {
.then((data) => { .then((data) => {
if (!Array.isArray(data)) { data = []; } if (!Array.isArray(data)) { data = []; }
data.forEach((langString) => { data.forEach((langString) => {
setCache(CACHE_KEYS.langString(langString.String_Key, langString.Language_Code), langString.String_Value); setCache(CACHE_KEYS.langString(langString.stringKey, langString.languageCode), langString.stringValue);
}); });
resolve(); resolve();
}); });
@@ -347,11 +347,11 @@ function cacheStrings() {
if (!Array.isArray(data)) { data = []; } if (!Array.isArray(data)) { data = []; }
// Store plugin translations // Store plugin translations
data.forEach((langString) => { data.forEach((langString) => {
setCache(CACHE_KEYS.langString(langString.String_Key, langString.Language_Code), langString.String_Value); setCache(CACHE_KEYS.langString(langString.stringKey, langString.languageCode), langString.stringValue);
}); });
// Handle successful completion of language processing // Handle successful completion of language processing
handleSuccess('cacheStrings'); handleSuccess('cacheStrings_v2');
resolveLang(); resolveLang();
}); });
}) })
@@ -370,7 +370,7 @@ function cacheStrings() {
}) })
.catch((error) => { .catch((error) => {
// Handle failure in any of the language processing // Handle failure in any of the language processing
handleFailure('cacheStrings'); handleFailure('cacheStrings_v2');
reject(error); reject(error);
}); });

View File

@@ -2,6 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// check if authenticated // check if authenticated
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/security.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/security.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/server/db.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/language/lang.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/language/lang.php';
?> ?>

View File

@@ -28,13 +28,13 @@ function initOnlineHistoryGraph() {
res.data.forEach(function(entry) { res.data.forEach(function(entry) {
var formattedTime = localizeTimestamp(entry.Scan_Date).slice(11, 17); var formattedTime = localizeTimestamp(entry.scanDate).slice(11, 17);
timeStamps.push(formattedTime); timeStamps.push(formattedTime);
onlineCounts.push(entry.Online_Devices); onlineCounts.push(entry.onlineDevices);
downCounts.push(entry.Down_Devices); downCounts.push(entry.downDevices);
offlineCounts.push(entry.Offline_Devices); offlineCounts.push(entry.offlineDevices);
archivedCounts.push(entry.Archived_Devices); archivedCounts.push(entry.archivedDevices);
}); });
// Call your presenceOverTime function after data is ready // Call your presenceOverTime function after data is ready

View File

@@ -24,7 +24,7 @@ $pia_lang_selected = isset($_langMatch[1]) ? strtolower($_langMatch[1]) : $defau
$result = $db->query("SELECT * FROM Plugins_Language_Strings"); $result = $db->query("SELECT * FROM Plugins_Language_Strings");
$strings = array(); $strings = array();
while ($row = $result->fetchArray(SQLITE3_ASSOC)) { while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$strings[$row['String_Key']] = $row['String_Value']; $strings[$row['stringKey']] = $row['stringValue'];
} }

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -403,7 +403,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -418,7 +418,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -434,7 +434,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -450,7 +450,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -466,7 +466,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -482,7 +482,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -498,7 +498,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -532,7 +532,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -547,7 +547,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -562,7 +562,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -50,7 +50,7 @@ def main():
# make sure the below mapping is mapped in config.json, for example: # make sure the below mapping is mapped in config.json, for example:
# "database_column_definitions": [ # "database_column_definitions": [
# { # {
# "column": "Object_PrimaryID", <--------- the value I save into primaryId # "column": "objectPrimaryId", <--------- the value I save into primaryId
# "mapped_to_column": "scanMac", <--------- gets inserted into the CurrentScan DB # "mapped_to_column": "scanMac", <--------- gets inserted into the CurrentScan DB
# table column scanMac # table column scanMac
# #

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "url", "type": "url",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -99,7 +99,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -114,7 +114,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -133,7 +133,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -153,7 +153,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-8", "css_classes": "col-sm-8",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -168,7 +168,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -187,7 +187,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -206,7 +206,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -225,7 +225,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -261,7 +261,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "url", "type": "url",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -99,7 +99,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -114,7 +114,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -133,7 +133,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -153,7 +153,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-8", "css_classes": "col-sm-8",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -168,7 +168,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -187,7 +187,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -206,7 +206,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -225,7 +225,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -261,7 +261,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -7,7 +7,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Watched_Value4", "compare_column": "watchedValue4",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -47,7 +47,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -62,7 +62,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -81,7 +81,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -96,7 +96,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -111,7 +111,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -126,7 +126,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -145,7 +145,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -160,7 +160,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -175,7 +175,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -190,7 +190,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -205,7 +205,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -224,7 +224,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -260,7 +260,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -212,14 +212,14 @@ class sensor_config:
already known. If not, it marks the sensor as new and logs relevant information. already known. If not, it marks the sensor as new and logs relevant information.
""" """
# Retrieve the plugin object based on the sensor's hash # Retrieve the plugin object based on the sensor's hash
plugObj = getPluginObject({"Plugin": "MQTT", "Watched_Value3": self.hash}) plugObj = getPluginObject({"plugin": "MQTT", "watchedValue3": self.hash})
# Check if the plugin object is new # Check if the plugin object is new
if not plugObj: if not plugObj:
self.isNew = True self.isNew = True
mylog('verbose', [f"[{pluginName}] New sensor entry (name|mac|hash) : ({self.deviceName}|{self.mac}|{self.hash}"]) mylog('verbose', [f"[{pluginName}] New sensor entry (name|mac|hash) : ({self.deviceName}|{self.mac}|{self.hash}"])
else: else:
device_name = plugObj.get("Watched_Value1", "Unknown") device_name = plugObj.get("watchedValue1", "Unknown")
mylog('verbose', [f"[{pluginName}] Existing, skip Device Name: {device_name}"]) mylog('verbose', [f"[{pluginName}] Existing, skip Device Name: {device_name}"])
self.isNew = False self.isNew = False

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -95,7 +95,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -115,7 +115,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -130,7 +130,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -145,7 +145,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "device_mac", "type": "device_mac",
@@ -160,7 +160,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -179,7 +179,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -215,7 +215,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -95,7 +95,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -115,7 +115,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -130,7 +130,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -145,7 +145,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "device_mac", "type": "device_mac",
@@ -160,7 +160,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -179,7 +179,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -215,7 +215,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -95,7 +95,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -115,7 +115,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -130,7 +130,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -145,7 +145,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "device_mac", "type": "device_mac",
@@ -160,7 +160,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -179,7 +179,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -215,7 +215,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -27,7 +27,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -42,7 +42,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -61,7 +61,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "url", "type": "url",
@@ -76,7 +76,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -95,7 +95,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -110,7 +110,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -129,7 +129,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -149,7 +149,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-8", "css_classes": "col-sm-8",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -164,7 +164,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -183,7 +183,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -202,7 +202,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -221,7 +221,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -257,7 +257,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -31,7 +31,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -46,7 +46,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -65,7 +65,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -95,7 +95,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "eval", "type": "eval",
@@ -115,7 +115,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -130,7 +130,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -145,7 +145,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "device_mac", "type": "device_mac",
@@ -160,7 +160,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -179,7 +179,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -215,7 +215,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -378,7 +378,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -393,7 +393,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -409,7 +409,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -425,7 +425,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -441,7 +441,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -457,7 +457,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -472,7 +472,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -506,7 +506,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -521,7 +521,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -536,7 +536,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -338,17 +338,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1", "Watched_Value2"], "default_value": ["watchedValue1", "watchedValue2"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -368,15 +368,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is IP</li><li><code>Watched_Value2</code> is Vendor</li><li><code>Watched_Value3</code> is Interface </li><li><code>Watched_Value4</code> is N/A </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is IP</li><li><code>watchedValue2</code> is Vendor</li><li><code>watchedValue3</code> is Interface </li><li><code>watchedValue4</code> is N/A </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envía una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Valor_observado1</code> es IP</li><li><code>Valor_observado2</code> es Proveedor</li><li><code>Valor_observado3</code> es Interfaz </li><li><code>Valor_observado4</code> es N/A </li></ul>" "string": "Envía una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es IP</li><li><code>watchedValue2</code> es Proveedor</li><li><code>watchedValue3</code> es Interfaz </li><li><code>watchedValue4</code> es N/A </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist die IP</li><li><code>Watched_Value2</code> ist der Hersteller</li><li><code>Watched_Value3</code> ist das Interface </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist die IP</li><li><code>watchedValue2</code> ist der Hersteller</li><li><code>watchedValue3</code> ist das Interface </li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -387,7 +387,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -484,7 +484,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -499,7 +499,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -515,7 +515,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -531,7 +531,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -582,7 +582,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -605,7 +605,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -628,7 +628,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -9,7 +9,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -431,7 +431,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -448,7 +448,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": [ "localized": [
@@ -474,7 +474,7 @@
"type": "device_mac" "type": "device_mac"
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": [ "localized": [
@@ -500,7 +500,7 @@
"type": "device_ip" "type": "device_ip"
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": [ "localized": [
@@ -526,7 +526,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
@@ -573,7 +573,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -590,7 +590,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -607,7 +607,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -291,7 +291,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -306,7 +306,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -325,7 +325,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -344,7 +344,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -359,7 +359,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -374,7 +374,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -389,7 +389,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -404,7 +404,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -82,16 +82,16 @@ def cleanup_database(
# Cleanup Online History # Cleanup Online History
mylog("verbose", [f"[{pluginName}] Online_History: Delete all but keep latest 150 entries"]) mylog("verbose", [f"[{pluginName}] Online_History: Delete all but keep latest 150 entries"])
cursor.execute( cursor.execute(
"""DELETE from Online_History where "Index" not in ( """DELETE from Online_History where "index" not in (
SELECT "Index" from Online_History SELECT "index" from Online_History
order by Scan_Date desc limit 150)""" order by scanDate desc limit 150)"""
) )
mylog("verbose", [f"[{pluginName}] Online_History deleted rows: {cursor.rowcount}"]) mylog("verbose", [f"[{pluginName}] Online_History deleted rows: {cursor.rowcount}"])
# ----------------------------------------------------- # -----------------------------------------------------
# Cleanup Events # Cleanup Events
mylog("verbose", f"[{pluginName}] Events: Delete all older than {str(DAYS_TO_KEEP_EVENTS)} days (DAYS_TO_KEEP_EVENTS setting)") mylog("verbose", f"[{pluginName}] Events: Delete all older than {str(DAYS_TO_KEEP_EVENTS)} days (DAYS_TO_KEEP_EVENTS setting)")
sql = f"""DELETE FROM Events WHERE eve_DateTime <= date('now', '-{str(DAYS_TO_KEEP_EVENTS)} day')""" sql = f"""DELETE FROM Events WHERE eveDateTime <= date('now', '-{str(DAYS_TO_KEEP_EVENTS)} day')"""
mylog("verbose", [f"[{pluginName}] SQL : {sql}"]) mylog("verbose", [f"[{pluginName}] SQL : {sql}"])
cursor.execute(sql) cursor.execute(sql)
mylog("verbose", [f"[{pluginName}] Events deleted rows: {cursor.rowcount}"]) mylog("verbose", [f"[{pluginName}] Events deleted rows: {cursor.rowcount}"])
@@ -100,7 +100,7 @@ def cleanup_database(
# Sessions (derived snapshot — trimmed to the same window as Events so the # Sessions (derived snapshot — trimmed to the same window as Events so the
# two tables stay in sync without introducing a separate setting) # two tables stay in sync without introducing a separate setting)
mylog("verbose", f"[{pluginName}] Sessions: Delete all older than {str(DAYS_TO_KEEP_EVENTS)} days (reuses DAYS_TO_KEEP_EVENTS)") mylog("verbose", f"[{pluginName}] Sessions: Delete all older than {str(DAYS_TO_KEEP_EVENTS)} days (reuses DAYS_TO_KEEP_EVENTS)")
sql = f"""DELETE FROM Sessions WHERE ses_DateTimeConnection <= date('now', '-{str(DAYS_TO_KEEP_EVENTS)} day')""" sql = f"""DELETE FROM Sessions WHERE sesDateTimeConnection <= date('now', '-{str(DAYS_TO_KEEP_EVENTS)} day')"""
mylog("verbose", [f"[{pluginName}] SQL : {sql}"]) mylog("verbose", [f"[{pluginName}] SQL : {sql}"])
cursor.execute(sql) cursor.execute(sql)
mylog("verbose", [f"[{pluginName}] Sessions deleted rows: {cursor.rowcount}"]) mylog("verbose", [f"[{pluginName}] Sessions deleted rows: {cursor.rowcount}"])
@@ -113,7 +113,7 @@ def cleanup_database(
SELECT "Index" SELECT "Index"
FROM ( FROM (
SELECT "Index", SELECT "Index",
ROW_NUMBER() OVER(PARTITION BY "Plugin" ORDER BY DateTimeChanged DESC) AS row_num ROW_NUMBER() OVER(PARTITION BY plugin ORDER BY dateTimeChanged DESC) AS row_num
FROM Plugins_History FROM Plugins_History
) AS ranked_objects ) AS ranked_objects
WHERE row_num <= {str(PLUGINS_KEEP_HIST)} WHERE row_num <= {str(PLUGINS_KEEP_HIST)}
@@ -130,7 +130,7 @@ def cleanup_database(
SELECT "Index" SELECT "Index"
FROM ( FROM (
SELECT "Index", SELECT "Index",
ROW_NUMBER() OVER(PARTITION BY "Notifications" ORDER BY DateTimeCreated DESC) AS row_num ROW_NUMBER() OVER(PARTITION BY "index" ORDER BY dateTimeCreated DESC) AS row_num
FROM Notifications FROM Notifications
) AS ranked_objects ) AS ranked_objects
WHERE row_num <= {histCount} WHERE row_num <= {histCount}
@@ -147,7 +147,7 @@ def cleanup_database(
SELECT "Index" SELECT "Index"
FROM ( FROM (
SELECT "Index", SELECT "Index",
ROW_NUMBER() OVER(PARTITION BY "AppEvents" ORDER BY DateTimeCreated DESC) AS row_num ROW_NUMBER() OVER(PARTITION BY "index" ORDER BY dateTimeCreated DESC) AS row_num
FROM AppEvents FROM AppEvents
) AS ranked_objects ) AS ranked_objects
WHERE row_num <= {histCount} WHERE row_num <= {histCount}
@@ -192,10 +192,10 @@ def cleanup_database(
DELETE FROM Plugins_Objects DELETE FROM Plugins_Objects
WHERE rowid > ( WHERE rowid > (
SELECT MIN(rowid) FROM Plugins_Objects p2 SELECT MIN(rowid) FROM Plugins_Objects p2
WHERE Plugins_Objects.Plugin = p2.Plugin WHERE Plugins_Objects.plugin = p2.plugin
AND Plugins_Objects.Object_PrimaryID = p2.Object_PrimaryID AND Plugins_Objects.objectPrimaryId = p2.objectPrimaryId
AND Plugins_Objects.Object_SecondaryID = p2.Object_SecondaryID AND Plugins_Objects.objectSecondaryId = p2.objectSecondaryId
AND Plugins_Objects.UserData = p2.UserData AND Plugins_Objects.userData = p2.userData
) )
""" """
) )

View File

@@ -5,7 +5,7 @@
"enabled": true, "enabled": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -432,17 +432,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -462,11 +462,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Previous IP (not recommended)</li><li><code>Watched_Value2</code> unused</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Previous IP (not recommended)</li><li><code>watchedValue2</code> unused</li><li><code>watchedValue3</code> unused </li><li><code>watchedValue4</code> unused </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist die Vorige IP (nicht empfohlen)</li><li><code>Watched_Value2</code> ist nicht in Verwendung</li><li><code>Watched_Value3</code> ist nicht in Verwendung </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist die Vorige IP (nicht empfohlen)</li><li><code>watchedValue2</code> ist nicht in Verwendung</li><li><code>watchedValue3</code> ist nicht in Verwendung </li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -477,7 +477,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -507,22 +507,22 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert." "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>watchedValueN</code>-Spalte hat sich geändert."
} }
] ]
} }
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -537,7 +537,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -560,7 +560,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -583,7 +583,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -628,7 +628,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -651,7 +651,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -674,7 +674,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -93,8 +93,8 @@ DHCPLSS_CMD: 'python3 /app/front/plugins/dhcp_leases/script.py paths={paths}'
DHCPLSS_paths_to_check: ['/etc/dnsmasq/dnsmasq.leases'] DHCPLSS_paths_to_check: ['/etc/dnsmasq/dnsmasq.leases']
DHCPLSS_RUN_SCHD: '*/5 * * * *' DHCPLSS_RUN_SCHD: '*/5 * * * *'
DHCPLSS_TUN_TIMEOUT: 5 DHCPLSS_TUN_TIMEOUT: 5
DHCPLSS_WATCH: ['Watched_Value1', 'Watched_Value4'] DHCPLSS_WATCH: ['watchedValue1', 'watchedValue4']
DHCPLSS_REPORT_ON: ['new', 'watched_changed'] DHCPLSS_REPORT_ON: ['new', 'watched-changed']
``` ```
You can check the the `dnsmasq.leases` file in the container by running `ls /etc/dnsmasq/`: You can check the the `dnsmasq.leases` file in the container by running `ls /etc/dnsmasq/`:

View File

@@ -7,7 +7,7 @@
"data_source": "script", "data_source": "script",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -64,7 +64,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -79,7 +79,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -102,7 +102,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -126,7 +126,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -150,7 +150,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -173,7 +173,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"mapped_to_column": "scanLastConnection", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -197,7 +197,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -220,7 +220,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -244,7 +244,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -267,7 +267,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -290,7 +290,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -313,7 +313,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -363,7 +363,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -753,17 +753,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1", "Watched_Value4"], "default_value": ["watchedValue1", "watchedValue4"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -783,15 +783,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Active </li><li><code>Watched_Value2</code> is Hostname </li><li><code>Watched_Value3</code> is hardware </li><li><code>Watched_Value4</code> is State </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Active </li><li><code>watchedValue2</code> is Hostname </li><li><code>watchedValue3</code> is hardware </li><li><code>watchedValue4</code> is State </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Enviar una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> está activo </li><li><code>Watched_Value2</code> es el nombre de host </li><li><code>Watched_Value3</code > es hardware </li><li><code>Watched_Value4</code> es Estado </li></ul>" "string": "Enviar una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> está activo </li><li><code>watchedValue2</code> es el nombre de host </li><li><code>watchedValue3</code > es hardware </li><li><code>watchedValue4</code> es Estado </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist der Aktivstatus</li><li><code>Watched_Value2</code> ist der Hostname</li><li><code>Watched_Value3</code> ist die Hardware</li><li><code>Watched_Value4</code> ist der Zustand </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist der Aktivstatus</li><li><code>watchedValue2</code> ist der Hostname</li><li><code>watchedValue3</code> ist die Hardware</li><li><code>watchedValue4</code> ist der Zustand </li></ul>"
} }
] ]
}, },
@@ -802,7 +802,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -832,15 +832,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert." "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>watchedValueN</code>-Spalte hat sich geändert."
} }
] ]
} }

View File

@@ -40,7 +40,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -55,7 +55,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -74,7 +74,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -93,7 +93,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -112,7 +112,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -131,7 +131,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -150,7 +150,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -169,7 +169,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -188,7 +188,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -207,7 +207,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -226,7 +226,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textbox_save", "type": "textbox_save",
@@ -245,7 +245,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -281,7 +281,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -478,17 +478,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -504,11 +504,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Domain Name Server</li><li><code>Watched_Value2</code> is IP Offered</li><li><code>Watched_Value3</code> is Interface </li><li><code>Watched_Value4</code> is Router </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Domain Name Server</li><li><code>watchedValue2</code> is IP Offered</li><li><code>watchedValue3</code> is Interface </li><li><code>watchedValue4</code> is Router </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es servidor de nombres de dominio</li><li><code>Watched_Value2</code> es IP ofrecida</li><li><code>Watched_Value3</code> es Interfaz </li><li><code>Watched_Value4</code> es enrutador </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es servidor de nombres de dominio</li><li><code>watchedValue2</code> es IP ofrecida</li><li><code>watchedValue3</code> es Interfaz </li><li><code>watchedValue4</code> es enrutador </li></ul>"
} }
] ]
}, },
@@ -519,7 +519,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -540,11 +540,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
} }
] ]
} }

View File

@@ -8,7 +8,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -299,7 +299,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -314,7 +314,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -333,7 +333,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -352,7 +352,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -367,7 +367,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -382,7 +382,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -397,7 +397,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -412,7 +412,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -376,7 +376,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -393,7 +393,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -411,7 +411,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -429,7 +429,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -447,7 +447,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -465,7 +465,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -483,7 +483,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -521,7 +521,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -538,7 +538,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -555,7 +555,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -9,7 +9,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -364,7 +364,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -381,7 +381,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -399,7 +399,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -417,7 +417,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -434,7 +434,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -451,7 +451,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -468,7 +468,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -506,7 +506,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -523,7 +523,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -540,7 +540,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -7,7 +7,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -324,17 +324,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -354,11 +354,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Previous IP (not recommended)</li><li><code>Watched_Value2</code> unused</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> type </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Previous IP (not recommended)</li><li><code>watchedValue2</code> unused</li><li><code>watchedValue3</code> unused </li><li><code>watchedValue4</code> type </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist die Vorige IP (nicht empfohlen)</li><li><code>Watched_Value2</code> ist nicht in Verwendung</li><li><code>Watched_Value3</code> ist nicht in Verwendung </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist die Vorige IP (nicht empfohlen)</li><li><code>watchedValue2</code> ist nicht in Verwendung</li><li><code>watchedValue3</code> ist nicht in Verwendung </li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -369,7 +369,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -399,15 +399,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert." "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>watchedValueN</code>-Spalte hat sich geändert."
} }
] ]
}, },
@@ -478,7 +478,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -493,7 +493,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -517,7 +517,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -541,7 +541,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -560,7 +560,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textarea_readonly", "type": "textarea_readonly",
@@ -575,7 +575,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -590,7 +590,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
@@ -633,7 +633,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -656,7 +656,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"mapped_to_column": "scanLastConnection", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -680,7 +680,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -43,9 +43,9 @@ Inside the container, a Python version of speedtest often exists in the virtual
### Data Mapping ### Data Mapping
- **Watched_Value1** — Download Speed (Mbps). - **watchedValue1** — Download Speed (Mbps).
- **Watched_Value2** — Upload Speed (Mbps). - **watchedValue2** — Upload Speed (Mbps).
- **Watched_Value3** — Full JSON payload (useful for n8n or detailed webhooks). - **watchedValue3** — Full JSON payload (useful for n8n or detailed webhooks).
### Notes ### Notes

View File

@@ -39,7 +39,7 @@
"params": [], "params": [],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -54,7 +54,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -77,7 +77,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "url", "type": "url",
@@ -96,7 +96,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -119,7 +119,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -138,7 +138,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -161,7 +161,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "threshold", "type": "threshold",
@@ -197,7 +197,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "threshold", "type": "threshold",
@@ -233,7 +233,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -256,7 +256,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -279,7 +279,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -302,7 +302,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "replace", "type": "replace",
@@ -342,7 +342,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -561,17 +561,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": [], "default_value": [],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -591,15 +591,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Download speed (not recommended)</li><li><code>Watched_Value2</code> is Upload speed (not recommended)</li><li><code>Watched_Value3</code> is JSON payload for webhooks (schema varies by engine)</li><li><code>Watched_Value4</code> unused </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Download speed (not recommended)</li><li><code>watchedValue2</code> is Upload speed (not recommended)</li><li><code>watchedValue3</code> is JSON payload for webhooks (schema varies by engine)</li><li><code>watchedValue4</code> unused </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es la velocidad de descarga (no recomendado)</li><li><code>Watched_Value2</code> es la velocidad de carga (no recomendado)</li><li><code>Watched_Value3</code> es la carga útil JSON para webhooks (el esquema varía según el motor)</li><li><code>Watched_Value4</code> no se usa </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es la velocidad de descarga (no recomendado)</li><li><code>watchedValue2</code> es la velocidad de carga (no recomendado)</li><li><code>watchedValue3</code> es la carga útil JSON para webhooks (el esquema varía según el motor)</li><li><code>watchedValue4</code> no se usa </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist die Download-Geschwindigkeit (nicht empfohlen)</li><li><code>Watched_Value2</code> ist die Upload-Geschwindigkeit (nicht empfohlen)</li><li><code>Watched_Value3</code> ist JSON-Payload für Webhooks (Schema variiert je nach Engine)</li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist die Download-Geschwindigkeit (nicht empfohlen)</li><li><code>watchedValue2</code> ist die Upload-Geschwindigkeit (nicht empfohlen)</li><li><code>watchedValue3</code> ist JSON-Payload für Webhooks (Schema variiert je nach Engine)</li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -610,7 +610,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -640,15 +640,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert." "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>watchedValueN</code>-Spalte hat sich geändert."
} }
] ]
} }

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -273,7 +273,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -290,7 +290,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -308,7 +308,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -326,7 +326,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -344,7 +344,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -362,7 +362,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -380,7 +380,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -418,7 +418,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -435,7 +435,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -452,7 +452,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -9,7 +9,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -450,7 +450,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -469,7 +469,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -489,7 +489,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -509,7 +509,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -528,7 +528,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -571,7 +571,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -590,7 +590,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -609,7 +609,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -336,7 +336,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -351,7 +351,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -382,7 +382,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -398,7 +398,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -413,7 +413,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -429,7 +429,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -444,7 +444,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -459,7 +459,7 @@
] ]
}, },
{ {
"column": "HelpVal1", "column": "helpVal1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -493,7 +493,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -512,7 +512,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",

View File

@@ -8,7 +8,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -299,7 +299,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -314,7 +314,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -333,7 +333,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -352,7 +352,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -367,7 +367,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -382,7 +382,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -397,7 +397,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -412,7 +412,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -290,10 +290,10 @@
}, },
"default_value": [], "default_value": [],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": [ "localized": [
"name", "name",
@@ -316,15 +316,15 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Name</li><li><code>Watched_Value2</code> is Vendor</li><li><code>Watched_Value3</code> is Interface </li><li><code>Watched_Value4</code> is N/A </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Name</li><li><code>watchedValue2</code> is Vendor</li><li><code>watchedValue3</code> is Interface </li><li><code>watchedValue4</code> is N/A </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envía una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Valor_observado1</code> es Name</li><li><code>Valor_observado2</code> es Proveedor</li><li><code>Valor_observado3</code> es Interfaz </li><li><code>Valor_observado4</code> es N/A </li></ul>" "string": "Envía una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es Name</li><li><code>watchedValue2</code> es Proveedor</li><li><code>watchedValue3</code> es Interfaz </li><li><code>watchedValue4</code> es N/A </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist der Namen</li><li><code>Watched_Value2</code> ist der Hersteller</li><li><code>Watched_Value3</code> ist das Interface </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist der Namen</li><li><code>watchedValue2</code> ist der Hersteller</li><li><code>watchedValue3</code> ist das Interface </li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -522,7 +522,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -539,7 +539,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -557,7 +557,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -575,7 +575,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -593,7 +593,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -619,7 +619,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanLastQuery", "mapped_to_column": "scanLastQuery",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -670,7 +670,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -695,7 +695,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -720,7 +720,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -72,7 +72,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -87,7 +87,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -102,7 +102,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -121,7 +121,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -140,7 +140,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -159,7 +159,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -178,7 +178,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -197,7 +197,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -215,7 +215,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "regex.url_http_https", "type": "regex.url_http_https",
@@ -239,7 +239,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -258,7 +258,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -277,7 +277,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "textbox_save", "type": "textbox_save",
@@ -315,7 +315,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -553,17 +553,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -579,11 +579,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is service type (e.g.: http, ssh)</li><li><code>Watched_Value2</code> is Status (open or closed)</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is service type (e.g.: http, ssh)</li><li><code>watchedValue2</code> is Status (open or closed)</li><li><code>watchedValue3</code> unused </li><li><code>watchedValue4</code> unused </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es el tipo de servicio (p. ej., http, ssh)</li><li><code>Watched_Value2</code> es el estado (abierto o cerrado)</li> <li><code>Watched_Value3</code> no utilizado </li><li><code>Watched_Value4</code> no utilizado </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es el tipo de servicio (p. ej., http, ssh)</li><li><code>watchedValue2</code> es el estado (abierto o cerrado)</li> <li><code>watchedValue3</code> no utilizado </li><li><code>watchedValue4</code> no utilizado </li></ul>"
} }
] ]
}, },
@@ -594,7 +594,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -615,11 +615,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
} }
] ]
} }

View File

@@ -38,7 +38,7 @@ The following notification types are available based on the `NTFPRCS_INCLUDED_SE
### `plugins` ### `plugins`
- Notifies when an event is triggered by a plugin. - Notifies when an event is triggered by a plugin.
- These notifications depend on the plugin's configuration of the `Watched_Value1-4` values and the `<plugin>_REPORT_ON` settings. - These notifications depend on the plugin's configuration of the `watchedValue1-4` values and the `<plugin>_REPORT_ON` settings.
## Device-Specific Overrides ## Device-Specific Overrides

View File

@@ -225,7 +225,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Custom text template for new device notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{Device name} ({MAC}) - {IP}</code>. Leave empty for default formatting. Available fields: <code>{MAC}</code>, <code>{Datetime}</code>, <code>{IP}</code>, <code>{Event Type}</code>, <code>{Device name}</code>, <code>{Comments}</code>." "string": "Custom text template for new device notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{devName} ({eveMac}) - {eveIp}</code>. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eveMac}</code>, <code>{devVendor}</code>, <code>{eveIp}</code>, <code>{eveDateTime}</code>, <code>{eveEventType}</code>, <code>{devComments}</code>."
} }
] ]
}, },
@@ -249,7 +249,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Custom text template for down device notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{devName} ({eve_MAC}) - {eve_IP}</code>. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eve_MAC}</code>, <code>{devVendor}</code>, <code>{eve_IP}</code>, <code>{eve_DateTime}</code>, <code>{eve_EventType}</code>." "string": "Custom text template for down device notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{devName} ({eveMac}) - {eveIp}</code>. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eveMac}</code>, <code>{devVendor}</code>, <code>{eveIp}</code>, <code>{eveDateTime}</code>, <code>{eveEventType}</code>, <code>{devComments}</code>."
} }
] ]
}, },
@@ -273,7 +273,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Custom text template for reconnected device notifications. Use <code>{FieldName}</code> placeholders. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eve_MAC}</code>, <code>{devVendor}</code>, <code>{eve_IP}</code>, <code>{eve_DateTime}</code>, <code>{eve_EventType}</code>." "string": "Custom text template for reconnected device notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{devName} ({eveMac}) reconnected at {eveDateTime}</code>. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eveMac}</code>, <code>{devVendor}</code>, <code>{eveIp}</code>, <code>{eveDateTime}</code>, <code>{eveEventType}</code>, <code>{devComments}</code>."
} }
] ]
}, },
@@ -297,7 +297,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Custom text template for event notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{Device name} ({MAC}) {Event Type} at {Datetime}</code>. Leave empty for default formatting. Available fields: <code>{MAC}</code>, <code>{Datetime}</code>, <code>{IP}</code>, <code>{Event Type}</code>, <code>{Device name}</code>, <code>{Comments}</code>." "string": "Custom text template for event notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{devName} ({eveMac}) {eveEventType} at {eveDateTime}</code>. Leave empty for default formatting. Available fields: <code>{devName}</code>, <code>{eveMac}</code>, <code>{devVendor}</code>, <code>{eveIp}</code>, <code>{eveDateTime}</code>, <code>{eveEventType}</code>, <code>{devComments}</code>."
} }
] ]
}, },
@@ -321,7 +321,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Custom text template for plugin event notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{Plugin}: {Object_PrimaryId} - {Status}</code>. Leave empty for default formatting. Available fields: <code>{Plugin}</code>, <code>{Object_PrimaryId}</code>, <code>{Object_SecondaryId}</code>, <code>{DateTimeChanged}</code>, <code>{Watched_Value1}</code>, <code>{Watched_Value2}</code>, <code>{Watched_Value3}</code>, <code>{Watched_Value4}</code>, <code>{Status}</code>." "string": "Custom text template for plugin event notifications. Use <code>{FieldName}</code> placeholders, e.g. <code>{plugin}: {objectPrimaryId} - {status}</code>. Leave empty for default formatting. Available fields: <code>{plugin}</code>, <code>{objectPrimaryId}</code>, <code>{objectSecondaryId}</code>, <code>{dateTimeChanged}</code>, <code>{watchedValue1}</code>, <code>{watchedValue2}</code>, <code>{watchedValue3}</code>, <code>{watchedValue4}</code>, <code>{status}</code>."
} }
] ]
} }

View File

@@ -8,7 +8,7 @@
"show_ui": true, "show_ui": true,
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -299,7 +299,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -314,7 +314,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -329,7 +329,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -344,7 +344,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -359,7 +359,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -374,7 +374,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -393,7 +393,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -412,7 +412,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -403,7 +403,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Hostname </li><li><code>Watched_Value2</code> is Parent Node </li><li><code>Watched_Value3</code> is Port </li><li><code>Watched_Value4</code> is SSID </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Hostname </li><li><code>watchedValue2</code> is Parent Node </li><li><code>watchedValue3</code> is Port </li><li><code>watchedValue4</code> is SSID </li></ul>"
} }
], ],
"function": "WATCH", "function": "WATCH",
@@ -419,17 +419,17 @@
} }
], ],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"type": { "type": {
"dataType": "array", "dataType": "array",
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -440,7 +440,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
} }
], ],
"function": "REPORT_ON", "function": "REPORT_ON",
@@ -462,7 +462,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -542,7 +542,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -557,7 +557,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -581,7 +581,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -605,7 +605,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -621,7 +621,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanParentMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -637,7 +637,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanParentPort", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -653,7 +653,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"mapped_to_column": "scanSSID", "mapped_to_column": "scanSSID",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -669,7 +669,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
@@ -712,7 +712,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -735,7 +735,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -758,7 +758,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -319,7 +319,7 @@ def main():
# make sure the below mapping is mapped in config.json, for example: # make sure the below mapping is mapped in config.json, for example:
# "database_column_definitions": [ # "database_column_definitions": [
# { # {
# "column": "Object_PrimaryID", <--------- the value I save into primaryId # "column": "objectPrimaryId", <--------- the value I save into primaryId
# "mapped_to_column": "scanMac", <--------- gets unserted into the CurrentScan DB table column scanMac # "mapped_to_column": "scanMac", <--------- gets unserted into the CurrentScan DB table column scanMac
# watched1 = 'null' , # watched1 = 'null' ,
# figure a way to run my udpate script delayed # figure a way to run my udpate script delayed

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -380,7 +380,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Device Name </li><li><code>Watched_Value2</code> is Parent Node MAC</li><li><code>Watched_Value3</code> is Parent Node Port </li><li><code>Watched_Value4</code> is Parent Node SSID </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Device Name </li><li><code>watchedValue2</code> is Parent Node MAC</li><li><code>watchedValue3</code> is Parent Node Port </li><li><code>watchedValue4</code> is Parent Node SSID </li></ul>"
} }
], ],
"function": "WATCH", "function": "WATCH",
@@ -392,17 +392,17 @@
} }
], ],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"type": { "type": {
"dataType": "array", "dataType": "array",
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -413,7 +413,7 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
} }
], ],
"function": "REPORT_ON", "function": "REPORT_ON",
@@ -435,7 +435,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -517,7 +517,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -532,7 +532,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -548,7 +548,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -564,7 +564,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -580,7 +580,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanParentMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -596,7 +596,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanParentPort", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -612,7 +612,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"mapped_to_column": "scanSSID", "mapped_to_column": "scanSSID",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -628,7 +628,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
@@ -663,7 +663,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -678,7 +678,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -693,7 +693,7 @@
] ]
}, },
{ {
"column": "HelpVal1", "column": "helpVal1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -708,7 +708,7 @@
] ]
}, },
{ {
"column": "HelpVal2", "column": "helpVal2",
"mapped_to_column": "scanSite", "mapped_to_column": "scanSite",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -724,7 +724,7 @@
] ]
}, },
{ {
"column": "HelpVal3", "column": "helpVal3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -441,7 +441,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -456,7 +456,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -472,7 +472,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -488,7 +488,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -504,7 +504,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -520,7 +520,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -535,7 +535,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -569,7 +569,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -584,7 +584,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -599,7 +599,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -105,7 +105,7 @@
{ "elementType": "input", "elementOptions": [], "transformers": [] } { "elementType": "input", "elementOptions": [], "transformers": [] }
] ]
}, },
"default_value": "SELECT n.hwaddr AS Object_PrimaryID, {s-quote}null{s-quote} AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, {s-quote}null{s-quote} AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr is not {s-quote}00:00:00:00:00:00{s-quote} AND na.ip is not null", "default_value": "SELECT n.hwaddr AS objectPrimaryId, {s-quote}null{s-quote} AS objectSecondaryId, datetime() AS dateTimeChanged, na.ip AS watchedValue1, n.lastQuery AS watchedValue2, na.name AS watchedValue3, n.macVendor AS watchedValue4, {s-quote}null{s-quote} AS extra, n.hwaddr AS foreignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE {s-quote}ip-%{s-quote} AND n.hwaddr is not {s-quote}00:00:00:00:00:00{s-quote} AND na.ip is not null",
"options": [], "options": [],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -290,17 +290,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1", "Watched_Value2"], "default_value": ["watchedValue1", "watchedValue2"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -316,11 +316,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is IP</li><li><code>Watched_Value2</code> is Last Query</li><li><code>Watched_Value3</code> is Name </li><li><code>Watched_Value4</code> is N/A </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is IP</li><li><code>watchedValue2</code> is Last Query</li><li><code>watchedValue3</code> is Name </li><li><code>watchedValue4</code> is N/A </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es IP</li><li><code>Watched_Value2</code> es Proveedor</li><li><code>Watched_Value3</code> is es Interfaz</li><li><code>Watched_Value4</code> es N/A</li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es IP</li><li><code>watchedValue2</code> es Proveedor</li><li><code>watchedValue3</code> is es Interfaz</li><li><code>watchedValue4</code> es N/A</li></ul>"
} }
] ]
}, },
@@ -331,7 +331,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -369,7 +369,7 @@
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -384,7 +384,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -404,7 +404,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -419,7 +419,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -439,7 +439,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanLastQuery", "mapped_to_column": "scanLastQuery",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -455,7 +455,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -471,7 +471,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -510,7 +510,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -529,7 +529,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",

View File

@@ -7,7 +7,7 @@
"data_source": "script", "data_source": "script",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -65,7 +65,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -80,7 +80,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -99,7 +99,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -119,7 +119,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -139,7 +139,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"mapped_to_column": "scanLastConnection", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -159,7 +159,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -179,7 +179,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -198,7 +198,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -217,7 +217,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -236,7 +236,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -255,7 +255,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -297,7 +297,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -658,17 +658,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -684,11 +684,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Hostname (not discoverable) </li><li><code>Watched_Value2</code> is Router IP </li><li><code>Watched_Value3</code> is not used </li><li><code>Watched_Value4</code> is not used </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Hostname (not discoverable) </li><li><code>watchedValue2</code> is Router IP </li><li><code>watchedValue3</code> is not used </li><li><code>watchedValue4</code> is not used </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es el nombre de host (no detectable) </li><li><code>Watched_Value2</code> es la IP del enrutador </li><li><code>Watched_Value3< /code> no se utiliza </li><li><code>Watched_Value4</code> no se utiliza </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es el nombre de host (no detectable) </li><li><code>watchedValue2</code> es la IP del enrutador </li><li><code>watchedValue3</code> no se utiliza </li><li><code>watchedValue4</code> no se utiliza </li></ul>"
} }
] ]
}, },
@@ -699,7 +699,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -725,11 +725,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
} }
] ]
} }

View File

@@ -7,7 +7,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -667,7 +667,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -684,7 +684,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -710,7 +710,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -736,7 +736,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -754,7 +754,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -772,7 +772,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanSyncHubNode", "mapped_to_column": "scanSyncHubNode",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -790,7 +790,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -836,7 +836,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -861,7 +861,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -886,7 +886,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -8,7 +8,7 @@
"mapped_to_table": "CurrentScan", "mapped_to_table": "CurrentScan",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -569,7 +569,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -586,7 +586,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
@@ -604,7 +604,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -622,7 +622,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -640,7 +640,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -658,7 +658,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -675,7 +675,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"mapped_to_column": "scanParentMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -714,7 +714,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -731,7 +731,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -748,7 +748,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -72,7 +72,7 @@
], ],
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
"compare_operator": "==", "compare_operator": "==",
@@ -81,7 +81,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -96,7 +96,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -119,7 +119,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -143,7 +143,7 @@
"type": "device_mac" "type": "device_mac"
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -167,7 +167,7 @@
"type": "device_ip" "type": "device_ip"
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -190,7 +190,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -214,7 +214,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -238,7 +238,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
@@ -262,7 +262,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"mapped_to_column": "scanType", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
@@ -286,7 +286,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -309,7 +309,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -359,7 +359,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -382,7 +382,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "HelpVal1", "column": "helpVal1",
"mapped_to_column": "scanParentMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
@@ -398,7 +398,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "HelpVal2", "column": "helpVal2",
"mapped_to_column": "scanParentPort", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
@@ -414,7 +414,7 @@
"type": "label" "type": "label"
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -992,15 +992,15 @@
] ]
}, },
{ {
"default_value": ["Watched_Value1", "Watched_Value4"], "default_value": ["watchedValue1", "watchedValue4"],
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is Hostname </li><li><code>Watched_Value2</code> is Vendor </li><li><code>Watched_Value3</code> is Type </li><li><code>Watched_Value4</code> is Online </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is Hostname </li><li><code>watchedValue2</code> is Vendor </li><li><code>watchedValue3</code> is Type </li><li><code>watchedValue4</code> is Online </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es el nombre de host </li><li><code>Watched_Value2</code> es el proveedor </li><li><code>Watched_Value3</code> es el tipo </li><li><code>Watched_Value4</code> es Online </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Utilice <code>CTRL + clic</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es el nombre de host </li><li><code>watchedValue2</code> es el proveedor </li><li><code>watchedValue3</code> es el tipo </li><li><code>watchedValue4</code> es Online </li></ul>"
} }
], ],
"function": "WATCH", "function": "WATCH",
@@ -1016,17 +1016,17 @@
} }
], ],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"type": { "type": {
"dataType": "array", "dataType": "array",
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -1037,11 +1037,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>Watched_ValueN</code> seleccionadas cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (una combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
} }
], ],
"function": "REPORT_ON", "function": "REPORT_ON",
@@ -1067,7 +1067,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]

View File

@@ -299,17 +299,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -329,11 +329,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is vendor name</li><li><code>Watched_Value2</code> is device name</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is vendor name</li><li><code>watchedValue2</code> is device name</li><li><code>watchedValue3</code> unused </li><li><code>watchedValue4</code> unused </li></ul>"
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>Watched_Value1</code> ist der Herstellername</li><li><code>Watched_Value2</code> ist der Gerätename</li><li><code>Watched_Value3</code> ist nicht in Verwendung </li><li><code>Watched_Value4</code> ist nicht in Verwendung </li></ul>" "string": "Sende eine Benachrichtigung, wenn ein ausgwählter Wert sich ändert. <code>STRG + klicken</code> zum aus-/abwählen. <ul> <li><code>watchedValue1</code> ist der Herstellername</li><li><code>watchedValue2</code> ist der Gerätename</li><li><code>watchedValue3</code> ist nicht in Verwendung </li><li><code>watchedValue4</code> ist nicht in Verwendung </li></ul>"
} }
] ]
}, },
@@ -344,7 +344,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -374,22 +374,22 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que las columnas <code>watchedValueN</code> seleccionadas cambiaron."
}, },
{ {
"language_code": "de_de", "language_code": "de_de",
"string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>Watched_ValueN</code>-Spalte hat sich geändert." "string": "Benachrichtige nur bei diesen Status. <code>new</code> bedeutet ein neues eindeutiges (einzigartige Kombination aus PrimaryId und SecondaryId) Objekt wurde erkennt. <code>watched-changed</code> bedeutet eine ausgewählte <code>watchedValueN</code>-Spalte hat sich geändert."
} }
] ]
} }
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -404,7 +404,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -427,7 +427,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"mapped_to_column": "scanMac", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -451,7 +451,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"mapped_to_column": "scanLastIP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -475,7 +475,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -498,7 +498,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"mapped_to_column": "scanLastConnection", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -549,7 +549,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"mapped_to_column": "scanVendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -569,7 +569,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"mapped_to_column": "scanName", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
@@ -593,7 +593,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -612,7 +612,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -631,7 +631,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "textbox_save", "type": "textbox_save",
@@ -654,7 +654,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -673,7 +673,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -7,7 +7,7 @@
"data_source": "script", "data_source": "script",
"data_filters": [ "data_filters": [
{ {
"compare_column": "Object_PrimaryID", "compare_column": "objectPrimaryId",
"compare_operator": "==", "compare_operator": "==",
"compare_field_id": "txtMacFilter", "compare_field_id": "txtMacFilter",
"compare_js_template": "'{value}'.toString()", "compare_js_template": "'{value}'.toString()",
@@ -356,7 +356,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -371,7 +371,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -386,7 +386,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -401,7 +401,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -416,7 +416,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -431,7 +431,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -446,7 +446,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -476,7 +476,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -491,7 +491,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -506,7 +506,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",

View File

@@ -51,7 +51,7 @@
], ],
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Index", "column": "index",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "none", "type": "none",
@@ -66,7 +66,7 @@
] ]
}, },
{ {
"column": "Plugin", "column": "plugin",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -85,7 +85,7 @@
] ]
}, },
{ {
"column": "Object_PrimaryID", "column": "objectPrimaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "url", "type": "url",
@@ -104,7 +104,7 @@
] ]
}, },
{ {
"column": "Object_SecondaryID", "column": "objectSecondaryId",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -123,7 +123,7 @@
] ]
}, },
{ {
"column": "DateTimeCreated", "column": "dateTimeCreated",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -142,7 +142,7 @@
] ]
}, },
{ {
"column": "DateTimeChanged", "column": "dateTimeChanged",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -161,7 +161,7 @@
] ]
}, },
{ {
"column": "Watched_Value1", "column": "watchedValue1",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "threshold", "type": "threshold",
@@ -201,7 +201,7 @@
] ]
}, },
{ {
"column": "Watched_Value2", "column": "watchedValue2",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -220,7 +220,7 @@
] ]
}, },
{ {
"column": "Watched_Value3", "column": "watchedValue3",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -239,7 +239,7 @@
] ]
}, },
{ {
"column": "Watched_Value4", "column": "watchedValue4",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -258,7 +258,7 @@
] ]
}, },
{ {
"column": "UserData", "column": "userData",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "textbox_save", "type": "textbox_save",
@@ -277,7 +277,7 @@
] ]
}, },
{ {
"column": "Status", "column": "status",
"css_classes": "col-sm-1", "css_classes": "col-sm-1",
"show": true, "show": true,
"type": "replace", "type": "replace",
@@ -313,7 +313,7 @@
] ]
}, },
{ {
"column": "Extra", "column": "extra",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -538,17 +538,17 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
}, },
"default_value": ["Watched_Value1"], "default_value": ["watchedValue1"],
"options": [ "options": [
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4" "watchedValue4"
], ],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [
@@ -564,11 +564,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is response status code (e.g.: 200, 404)</li><li><code>Watched_Value2</code> is Latency (not recommended)</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>" "string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>watchedValue1</code> is response status code (e.g.: 200, 404)</li><li><code>watchedValue2</code> is Latency (not recommended)</li><li><code>watchedValue3</code> unused </li><li><code>watchedValue4</code> unused </li></ul>"
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Click</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es un código de estado de respuesta (por ejemplo: 200, 404) </li><li><code>Valor_observado2</code> es Latencia (no recomendado)</li><li><code>Valor_observado3</code> no utilizado </li><li><code>Valor_observado4 </ code> sin usar </li></ul>" "string": "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Click</code> para seleccionar/deseleccionar. <ul> <li><code>watchedValue1</code> es un código de estado de respuesta (por ejemplo: 200, 404) </li><li><code>watchedValue2</code> es Latencia (no recomendado)</li><li><code>watchedValue3</code> no utilizado </li><li><code>watchedValue4</code> sin usar </li></ul>"
} }
] ]
}, },
@@ -579,7 +579,7 @@
"elements": [ "elements": [
{ {
"elementType": "select", "elementType": "select",
"elementOptions": [{ "multiple": "true" }], "elementOptions": [{ "multiple": "true", "ordeable": "true"}],
"transformers": [] "transformers": []
} }
] ]
@@ -605,11 +605,11 @@
"description": [ "description": [
{ {
"language_code": "en_us", "language_code": "en_us",
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed." "string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of objectPrimaryId and objectSecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>watchedValueN</code> columns changed."
}, },
{ {
"language_code": "es_es", "language_code": "es_es",
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron." "string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>watchedValueN Las columnas </code> cambiaron."
} }
] ]
}, },

View File

@@ -246,9 +246,9 @@ function genericSaveData (id) {
headers: { "Authorization": `Bearer ${apiToken}` }, headers: { "Authorization": `Bearer ${apiToken}` },
data: JSON.stringify({ data: JSON.stringify({
dbtable: "Plugins_Objects", dbtable: "Plugins_Objects",
columnName: "Index", columnName: "index",
id: index, id: index,
columns: "UserData", columns: "userData",
values: columnValue values: columnValue
}), }),
contentType: "application/json", contentType: "application/json",
@@ -413,26 +413,26 @@ function getColumnDefinitions(pluginObj) {
function getEventData(prefix, colDefinitions, pluginObj) { function getEventData(prefix, colDefinitions, pluginObj) {
// Extract event data specific to the plugin and format it for DataTables // Extract event data specific to the plugin and format it for DataTables
return pluginUnprocessedEvents return pluginUnprocessedEvents
.filter(event => event.Plugin === prefix && shouldBeShown(event, pluginObj)) // Filter events for the specific plugin .filter(event => event.plugin === prefix && shouldBeShown(event, pluginObj)) // Filter events for the specific plugin
.map(event => colDefinitions.map(colDef => event[colDef.column] || '')); // Map to the defined columns .map(event => colDefinitions.map(colDef => event[colDef.column] || '')); // Map to the defined columns
} }
function getObjectData(prefix, colDefinitions, pluginObj) { function getObjectData(prefix, colDefinitions, pluginObj) {
// Extract object data specific to the plugin and format it for DataTables // Extract object data specific to the plugin and format it for DataTables
return pluginObjects return pluginObjects
.filter(object => object.Plugin === prefix && shouldBeShown(object, pluginObj)) // Filter objects for the specific plugin .filter(object => object.plugin === prefix && shouldBeShown(object, pluginObj)) // Filter objects for the specific plugin
.map(object => colDefinitions.map(colDef => getFormControl(colDef, object[colDef.column], object["Index"], colDefinitions, object))); // Map to the defined columns .map(object => colDefinitions.map(colDef => getFormControl(colDef, object[colDef.column], object["index"], colDefinitions, object))); // Map to the defined columns
} }
function getHistoryData(prefix, colDefinitions, pluginObj) { function getHistoryData(prefix, colDefinitions, pluginObj) {
return pluginHistory return pluginHistory
.filter(history => history.Plugin === prefix && shouldBeShown(history, pluginObj)) // First, filter based on the plugin prefix .filter(history => history.plugin === prefix && shouldBeShown(history, pluginObj)) // First, filter based on the plugin prefix
.sort((a, b) => b.Index - a.Index) // Then, sort by the Index field in descending order .sort((a, b) => b.index - a.index) // Then, sort by the Index field in descending order
.slice(0, 50) // Limit the result to the first 50 entries .slice(0, 50) // Limit the result to the first 50 entries
.map(object => .map(object =>
colDefinitions.map(colDef => colDefinitions.map(colDef =>
getFormControl(colDef, object[colDef.column], object["Index"], colDefinitions, object) getFormControl(colDef, object[colDef.column], object["index"], colDefinitions, object)
) )
); );
} }

View File

@@ -43,9 +43,9 @@
<?= lang('report_select_format') ;?> <?= lang('report_select_format') ;?>
</label> </label>
<select id="formatSelect" class="pointer"> <select id="formatSelect" class="pointer">
<option value="HTML">HTML</option> <option value="html">HTML</option>
<option value="JSON">JSON</option> <option value="json">JSON</option>
<option value="Text">Text</option> <option value="text">Text</option>
</select> </select>
</div> </div>
@@ -100,23 +100,23 @@
// Display the selected format data and update timestamp // Display the selected format data and update timestamp
switch (format) { switch (format) {
case 'HTML': case 'html':
notificationData.innerHTML = formatData; notificationData.innerHTML = formatData;
break; break;
case 'JSON': case 'json':
notificationData.innerHTML = `<pre class="logs" cols="70" rows="10" wrap="off" readonly=""> notificationData.innerHTML = `<pre class="logs" cols="70" rows="10" wrap="off" readonly="">
${jsonSyntaxHighlight(JSON.stringify(JSON.parse(formatData), undefined, 4))} ${jsonSyntaxHighlight(JSON.stringify(JSON.parse(formatData), undefined, 4))}
</pre>`; </pre>`;
break; break;
case 'Text': case 'text':
notificationData.innerHTML = `<pre class="logs" cols="70" rows="10" wrap="off" readonly">${formatData}</pre>`; notificationData.innerHTML = `<pre class="logs" cols="70" rows="10" wrap="off" readonly="">${formatData}</pre>`;
break; break;
} }
// console.log(notification) // console.log(notification)
timestamp.textContent = localizeTimestamp(notification.DateTimeCreated); timestamp.textContent = localizeTimestamp(notification.dateTimeCreated);
notiGuid.textContent = notification.GUID; notiGuid.textContent = notification.guid;
currentIndex = index; currentIndex = index;
$("#notificationOutOff").html(`${currentIndex + 1}/${data.data.length}`); $("#notificationOutOff").html(`${currentIndex + 1}/${data.data.length}`);
@@ -131,7 +131,7 @@
// Function to find the index of a notification by GUID // Function to find the index of a notification by GUID
function findIndexByGUID(data, guid) { function findIndexByGUID(data, guid) {
return data.findIndex(notification => notification.GUID == guid); return data.findIndex(notification => notification.guid == guid);
} }
// Listen for format selection changes // Listen for format selection changes
@@ -174,7 +174,7 @@
} else { } else {
// Initial data load // Initial data load
updateData('HTML', -1); // Default format to HTML and load the latest report updateData('html', -1); // Default format to HTML and load the latest report
} }
}); });

View File

@@ -42,11 +42,11 @@
"title": "🔴 Down devices", "title": "🔴 Down devices",
"columnNames": [ "columnNames": [
"devName", "devName",
"eve_MAC", "eveMac",
"devVendor", "devVendor",
"eve_IP", "eveIp",
"eve_DateTime", "eveDateTime",
"eve_EventType" "eveEventType"
] ]
}, },
"down_devices": [], "down_devices": [],
@@ -64,22 +64,22 @@
"down_reconnected": [ "down_reconnected": [
{ {
"devName": "Phone - Moto 82", "devName": "Phone - Moto 82",
"eve_MAC": "74:ac:74:ac:74:ac", "eveMac": "74:ac:74:ac:74:ac",
"devVendor": "Motorola Mobility LLC, a Lenovo Company", "devVendor": "Motorola Mobility LLC, a Lenovo Company",
"eve_IP": "192.168.1.167", "eveIp": "192.168.1.167",
"eve_DateTime": "2025-01-11 10:05:01+11:00", "eveDateTime": "2025-01-11 10:05:01+11:00",
"eve_EventType": "Down Reconnected" "eveEventType": "Down Reconnected"
} }
], ],
"down_reconnected_meta": { "down_reconnected_meta": {
"title": "🔁 Reconnected down devices", "title": "🔁 Reconnected down devices",
"columnNames": [ "columnNames": [
"devName", "devName",
"eve_MAC", "eveMac",
"devVendor", "devVendor",
"eve_IP", "eveIp",
"eve_DateTime", "eveDateTime",
"eve_EventType" "eveEventType"
] ]
}, },
"events": [ "events": [
@@ -103,28 +103,28 @@
"plugins_meta": { "plugins_meta": {
"title": "🔌 Plugins", "title": "🔌 Plugins",
"columnNames": [ "columnNames": [
"Plugin", "plugin",
"Object_PrimaryID", "objectPrimaryId",
"Object_SecondaryID", "objectSecondaryId",
"DateTimeChanged", "dateTimeChanged",
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4", "watchedValue4",
"Status" "status"
] ]
}, },
"plugins": [ "plugins": [
{ {
"Plugin": "ARPSCAN", "plugin": "ARPSCAN",
"Object_PrimaryID": "74:ac:74:ac:74:ac", "objectPrimaryId": "74:ac:74:ac:74:ac",
"Object_SecondaryID": "192.168.1.114", "objectSecondaryId": "192.168.1.114",
"DateTimeChanged": "2025-01-11 12:21:00", "dateTimeChanged": "2025-01-11 12:21:00",
"Watched_Value1": "192.168.1.114", "watchedValue1": "192.168.1.114",
"Watched_Value2": "Microsoft Corporation", "watchedValue2": "Microsoft Corporation",
"Watched_Value3": "192.168.1.0/24 --interface=eth1", "watchedValue3": "192.168.1.0/24 --interface=eth1",
"Watched_Value4": "", "watchedValue4": "",
"Status": "new" "status": "new"
} }
] ]
} }

View File

@@ -34,12 +34,12 @@ def check_and_clean_device():
# Check all tables for MAC # Check all tables for MAC
tables_checks = [ tables_checks = [
f"SELECT 'Events' as source, * FROM Events WHERE eve_MAC='{mac}'", f"SELECT 'Events' as source, * FROM Events WHERE eveMac='{mac}'",
f"SELECT 'Devices' as source, * FROM Devices WHERE dev_MAC='{mac}'", f"SELECT 'Devices' as source, * FROM Devices WHERE devMac='{mac}'",
f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanMac='{mac}'", f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanMac='{mac}'",
f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{mac}%'", f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{mac}%'",
f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'", f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE objectPrimaryId LIKE '%{mac}%' OR objectSecondaryId LIKE '%{mac}%'",
f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'" f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE objectPrimaryId LIKE '%{mac}%'"
] ]
found = False found = False
@@ -54,12 +54,12 @@ def check_and_clean_device():
if confirm.lower() == 'y': if confirm.lower() == 'y':
# Delete from all tables # Delete from all tables
deletes = [ deletes = [
f"DELETE FROM Events WHERE eve_MAC='{mac}'", f"DELETE FROM Events WHERE eveMac='{mac}'",
f"DELETE FROM Devices WHERE dev_MAC='{mac}'", f"DELETE FROM Devices WHERE devMac='{mac}'",
f"DELETE FROM CurrentScan WHERE scanMac='{mac}'", f"DELETE FROM CurrentScan WHERE scanMac='{mac}'",
f"DELETE FROM Notifications WHERE JSON LIKE '%{mac}%'", f"DELETE FROM Notifications WHERE JSON LIKE '%{mac}%'",
f"DELETE FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'", f"DELETE FROM AppEvents WHERE objectPrimaryId LIKE '%{mac}%' OR objectSecondaryId LIKE '%{mac}%'",
f"DELETE FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'" f"DELETE FROM Plugins_Objects WHERE objectPrimaryId LIKE '%{mac}%'"
] ]
for delete in deletes: for delete in deletes:
@@ -73,12 +73,12 @@ def check_and_clean_device():
# Check all tables for IP # Check all tables for IP
tables_checks = [ tables_checks = [
f"SELECT 'Events' as source, * FROM Events WHERE eve_IP='{ip}'", f"SELECT 'Events' as source, * FROM Events WHERE eveIp='{ip}'",
f"SELECT 'Devices' as source, * FROM Devices WHERE dev_LastIP='{ip}'", f"SELECT 'Devices' as source, * FROM Devices WHERE devLastIp='{ip}'",
f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanLastIP='{ip}'", f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanLastIP='{ip}'",
f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{ip}%'", f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{ip}%'",
f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'", f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE objectSecondaryId LIKE '%{ip}%'",
f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'" f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE objectSecondaryId LIKE '%{ip}%'"
] ]
found = False found = False
@@ -93,12 +93,12 @@ def check_and_clean_device():
if confirm.lower() == 'y': if confirm.lower() == 'y':
# Delete from all tables # Delete from all tables
deletes = [ deletes = [
f"DELETE FROM Events WHERE eve_IP='{ip}'", f"DELETE FROM Events WHERE eveIp='{ip}'",
f"DELETE FROM Devices WHERE dev_LastIP='{ip}'", f"DELETE FROM Devices WHERE devLastIp='{ip}'",
f"DELETE FROM CurrentScan WHERE scanLastIP='{ip}'", f"DELETE FROM CurrentScan WHERE scanLastIP='{ip}'",
f"DELETE FROM Notifications WHERE JSON LIKE '%{ip}%'", f"DELETE FROM Notifications WHERE JSON LIKE '%{ip}%'",
f"DELETE FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'", f"DELETE FROM AppEvents WHERE objectSecondaryId LIKE '%{ip}%'",
f"DELETE FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'" f"DELETE FROM Plugins_Objects WHERE objectSecondaryId LIKE '%{ip}%'"
] ]
for delete in deletes: for delete in deletes:

View File

@@ -18,9 +18,9 @@ from const import (
sql_language_strings, sql_language_strings,
sql_notifications_all, sql_notifications_all,
sql_online_history, sql_online_history,
sql_devices_tiles,
sql_devices_filters, sql_devices_filters,
) )
from db.db_helper import get_sql_devices_tiles
from logger import mylog from logger import mylog
from helper import write_file, get_setting_value from helper import write_file, get_setting_value
from utils.datetime_utils import timeNowUTC from utils.datetime_utils import timeNowUTC
@@ -67,7 +67,7 @@ def update_api(
["plugins_language_strings", sql_language_strings], ["plugins_language_strings", sql_language_strings],
["notifications", sql_notifications_all], ["notifications", sql_notifications_all],
["online_history", sql_online_history], ["online_history", sql_online_history],
["devices_tiles", sql_devices_tiles], ["devices_tiles", get_sql_devices_tiles()],
["devices_filters", sql_devices_filters], ["devices_filters", sql_devices_filters],
["custom_endpoint", conf.API_CUSTOM_SQL], ["custom_endpoint", conf.API_CUSTOM_SQL],
] ]

View File

@@ -154,30 +154,30 @@ class LangStringResult(ObjectType):
# --- APP EVENTS --- # --- APP EVENTS ---
class AppEvent(ObjectType): class AppEvent(ObjectType):
Index = Int(description="Internal index") index = Int(description="Internal index")
GUID = String(description="Unique event GUID") guid = String(description="Unique event GUID")
AppEventProcessed = Int(description="Processing status (0 or 1)") appEventProcessed = Int(description="Processing status (0 or 1)")
DateTimeCreated = String(description="Event creation timestamp") dateTimeCreated = String(description="Event creation timestamp")
ObjectType = String(description="Type of the related object (Device, Setting, etc.)") objectType = String(description="Type of the related object (Device, Setting, etc.)")
ObjectGUID = String(description="GUID of the related object") objectGuid = String(description="GUID of the related object")
ObjectPlugin = String(description="Plugin associated with the object") objectPlugin = String(description="Plugin associated with the object")
ObjectPrimaryID = String(description="Primary identifier of the object") objectPrimaryId = String(description="Primary identifier of the object")
ObjectSecondaryID = String(description="Secondary identifier of the object") objectSecondaryId = String(description="Secondary identifier of the object")
ObjectForeignKey = String(description="Foreign key reference") objectForeignKey = String(description="Foreign key reference")
ObjectIndex = Int(description="Object index") objectIndex = Int(description="Object index")
ObjectIsNew = Int(description="Is the object new? (0 or 1)") objectIsNew = Int(description="Is the object new? (0 or 1)")
ObjectIsArchived = Int(description="Is the object archived? (0 or 1)") objectIsArchived = Int(description="Is the object archived? (0 or 1)")
ObjectStatusColumn = String(description="Column used for status") objectStatusColumn = String(description="Column used for status")
ObjectStatus = String(description="Object status value") objectStatus = String(description="Object status value")
AppEventType = String(description="Type of application event") appEventType = String(description="Type of application event")
Helper1 = String(description="Generic helper field 1") helper1 = String(description="Generic helper field 1")
Helper2 = String(description="Generic helper field 2") helper2 = String(description="Generic helper field 2")
Helper3 = String(description="Generic helper field 3") helper3 = String(description="Generic helper field 3")
Extra = String(description="Additional JSON data") extra = String(description="Additional JSON data")
class AppEventResult(ObjectType): class AppEventResult(ObjectType):
@@ -499,18 +499,18 @@ class Query(ObjectType):
search_term = options.search.lower() search_term = options.search.lower()
searchable_fields = [ searchable_fields = [
"GUID", "guid",
"ObjectType", "objectType",
"ObjectGUID", "objectGuid",
"ObjectPlugin", "objectPlugin",
"ObjectPrimaryID", "objectPrimaryId",
"ObjectSecondaryID", "objectSecondaryId",
"ObjectStatus", "objectStatus",
"AppEventType", "appEventType",
"Helper1", "helper1",
"Helper2", "helper2",
"Helper3", "helper3",
"Extra", "extra",
] ]
events_data = [ events_data = [
@@ -616,9 +616,9 @@ class Query(ObjectType):
plugin_data = json.load(f).get("data", []) plugin_data = json.load(f).get("data", [])
plugin_list = [ plugin_list = [
LangString( LangString(
langCode=entry.get("Language_Code"), langCode=entry.get("languageCode"),
langStringKey=entry.get("String_Key"), langStringKey=entry.get("stringKey"),
langStringText=entry.get("String_Value") langStringText=entry.get("stringValue")
) for entry in plugin_data ) for entry in plugin_data
] ]
_langstrings_cache[cache_key] = plugin_list _langstrings_cache[cache_key] = plugin_list

View File

@@ -33,8 +33,8 @@ def create_session(
cur.execute( cur.execute(
""" """
INSERT INTO Sessions (ses_MAC, ses_IP, ses_DateTimeConnection, ses_DateTimeDisconnection, INSERT INTO Sessions (sesMac, sesIp, sesDateTimeConnection, sesDateTimeDisconnection,
ses_EventTypeConnection, ses_EventTypeDisconnection) sesEventTypeConnection, sesEventTypeDisconnection)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
""", """,
(mac, ip, start_time, end_time, event_type_conn, event_type_disc), (mac, ip, start_time, end_time, event_type_conn, event_type_disc),
@@ -52,7 +52,7 @@ def delete_session(mac):
conn = get_temp_db_connection() conn = get_temp_db_connection()
cur = conn.cursor() cur = conn.cursor()
cur.execute("DELETE FROM Sessions WHERE ses_MAC = ?", (mac,)) cur.execute("DELETE FROM Sessions WHERE sesMac = ?", (mac,))
conn.commit() conn.commit()
conn.close() conn.close()
@@ -69,13 +69,13 @@ def get_sessions(mac=None, start_date=None, end_date=None):
params = [] params = []
if mac: if mac:
sql += " AND ses_MAC = ?" sql += " AND sesMac = ?"
params.append(mac) params.append(mac)
if start_date: if start_date:
sql += " AND ses_DateTimeConnection >= ?" sql += " AND sesDateTimeConnection >= ?"
params.append(start_date) params.append(start_date)
if end_date: if end_date:
sql += " AND ses_DateTimeDisconnection <= ?" sql += " AND sesDateTimeDisconnection <= ?"
params.append(end_date) params.append(end_date)
cur.execute(sql, tuple(params)) cur.execute(sql, tuple(params))
@@ -106,49 +106,49 @@ def get_sessions_calendar(start_date, end_date, mac):
sql = """ sql = """
SELECT SELECT
SES1.ses_MAC, SES1.sesMac,
SES1.ses_EventTypeConnection, SES1.sesEventTypeConnection,
SES1.ses_DateTimeConnection, SES1.sesDateTimeConnection,
SES1.ses_EventTypeDisconnection, SES1.sesEventTypeDisconnection,
SES1.ses_DateTimeDisconnection, SES1.sesDateTimeDisconnection,
SES1.ses_IP, SES1.sesIp,
SES1.ses_AdditionalInfo, SES1.sesAdditionalInfo,
SES1.ses_StillConnected, SES1.sesStillConnected,
CASE CASE
WHEN SES1.ses_EventTypeConnection = '<missing event>' THEN WHEN SES1.sesEventTypeConnection = '<missing event>' THEN
IFNULL( IFNULL(
( (
SELECT MAX(SES2.ses_DateTimeDisconnection) SELECT MAX(SES2.sesDateTimeDisconnection)
FROM Sessions AS SES2 FROM Sessions AS SES2
WHERE SES2.ses_MAC = SES1.ses_MAC WHERE SES2.sesMac = SES1.sesMac
AND SES2.ses_DateTimeDisconnection < SES1.ses_DateTimeDisconnection AND SES2.sesDateTimeDisconnection < SES1.sesDateTimeDisconnection
AND SES2.ses_DateTimeDisconnection BETWEEN Date(?) AND Date(?) AND SES2.sesDateTimeDisconnection BETWEEN Date(?) AND Date(?)
), ),
DATETIME(SES1.ses_DateTimeDisconnection, '-1 hour') DATETIME(SES1.sesDateTimeDisconnection, '-1 hour')
) )
ELSE SES1.ses_DateTimeConnection ELSE SES1.sesDateTimeConnection
END AS ses_DateTimeConnectionCorrected, END AS sesDateTimeConnectionCorrected,
CASE CASE
WHEN SES1.ses_EventTypeDisconnection = '<missing event>' THEN WHEN SES1.sesEventTypeDisconnection = '<missing event>' THEN
( (
SELECT MIN(SES2.ses_DateTimeConnection) SELECT MIN(SES2.sesDateTimeConnection)
FROM Sessions AS SES2 FROM Sessions AS SES2
WHERE SES2.ses_MAC = SES1.ses_MAC WHERE SES2.sesMac = SES1.sesMac
AND SES2.ses_DateTimeConnection > SES1.ses_DateTimeConnection AND SES2.sesDateTimeConnection > SES1.sesDateTimeConnection
AND SES2.ses_DateTimeConnection BETWEEN Date(?) AND Date(?) AND SES2.sesDateTimeConnection BETWEEN Date(?) AND Date(?)
) )
ELSE SES1.ses_DateTimeDisconnection ELSE SES1.sesDateTimeDisconnection
END AS ses_DateTimeDisconnectionCorrected END AS sesDateTimeDisconnectionCorrected
FROM Sessions AS SES1 FROM Sessions AS SES1
WHERE ( WHERE (
(SES1.ses_DateTimeConnection BETWEEN Date(?) AND Date(?)) (SES1.sesDateTimeConnection BETWEEN Date(?) AND Date(?))
OR (SES1.ses_DateTimeDisconnection BETWEEN Date(?) AND Date(?)) OR (SES1.sesDateTimeDisconnection BETWEEN Date(?) AND Date(?))
OR SES1.ses_StillConnected = 1 OR SES1.sesStillConnected = 1
) )
AND (? IS NULL OR SES1.ses_MAC = ?) AND (? IS NULL OR SES1.sesMac = ?)
""" """
cur.execute( cur.execute(
@@ -173,31 +173,31 @@ def get_sessions_calendar(start_date, end_date, mac):
# Color logic (unchanged from PHP) # Color logic (unchanged from PHP)
if ( if (
row["ses_EventTypeConnection"] == "<missing event>" or row["ses_EventTypeDisconnection"] == "<missing event>" row["sesEventTypeConnection"] == "<missing event>" or row["sesEventTypeDisconnection"] == "<missing event>"
): ):
color = "#f39c12" color = "#f39c12"
elif row["ses_StillConnected"] == 1: elif row["sesStillConnected"] == 1:
color = "#00a659" color = "#00a659"
else: else:
color = "#0073b7" color = "#0073b7"
# --- IMPORTANT FIX --- # --- IMPORTANT FIX ---
# FullCalendar v3 CANNOT handle end = null # FullCalendar v3 CANNOT handle end = null
end_dt = row["ses_DateTimeDisconnectionCorrected"] end_dt = row["sesDateTimeDisconnectionCorrected"]
if not end_dt and row["ses_StillConnected"] == 1: if not end_dt and row["sesStillConnected"] == 1:
end_dt = now_iso end_dt = now_iso
tooltip = ( tooltip = (
f"Connection: {format_event_date(row['ses_DateTimeConnection'], row['ses_EventTypeConnection'])}\n" f"Connection: {format_event_date(row['sesDateTimeConnection'], row['sesEventTypeConnection'])}\n"
f"Disconnection: {format_event_date(row['ses_DateTimeDisconnection'], row['ses_EventTypeDisconnection'])}\n" f"Disconnection: {format_event_date(row['sesDateTimeDisconnection'], row['sesEventTypeDisconnection'])}\n"
f"IP: {row['ses_IP']}" f"IP: {row['sesIp']}"
) )
events.append( events.append(
{ {
"resourceId": row["ses_MAC"], "resourceId": row["sesMac"],
"title": "", "title": "",
"start": format_date_iso(row["ses_DateTimeConnectionCorrected"]), "start": format_date_iso(row["sesDateTimeConnectionCorrected"]),
"end": format_date_iso(end_dt), "end": format_date_iso(end_dt),
"color": color, "color": color,
"tooltip": tooltip, "tooltip": tooltip,
@@ -219,20 +219,20 @@ def get_device_sessions(mac, period):
sql = f""" sql = f"""
SELECT SELECT
IFNULL(ses_DateTimeConnection, ses_DateTimeDisconnection) AS ses_DateTimeOrder, IFNULL(sesDateTimeConnection, sesDateTimeDisconnection) AS sesDateTimeOrder,
ses_EventTypeConnection, sesEventTypeConnection,
ses_DateTimeConnection, sesDateTimeConnection,
ses_EventTypeDisconnection, sesEventTypeDisconnection,
ses_DateTimeDisconnection, sesDateTimeDisconnection,
ses_StillConnected, sesStillConnected,
ses_IP, sesIp,
ses_AdditionalInfo sesAdditionalInfo
FROM Sessions FROM Sessions
WHERE ses_MAC = ? WHERE sesMac = ?
AND ( AND (
ses_DateTimeConnection >= {period_date} sesDateTimeConnection >= {period_date}
OR ses_DateTimeDisconnection >= {period_date} OR sesDateTimeDisconnection >= {period_date}
OR ses_StillConnected = 1 OR sesStillConnected = 1
) )
""" """
@@ -245,44 +245,44 @@ def get_device_sessions(mac, period):
for row in rows: for row in rows:
# Connection DateTime # Connection DateTime
if row["ses_EventTypeConnection"] == "<missing event>": if row["sesEventTypeConnection"] == "<missing event>":
ini = row["ses_EventTypeConnection"] ini = row["sesEventTypeConnection"]
else: else:
ini = format_date(row["ses_DateTimeConnection"]) ini = format_date(row["sesDateTimeConnection"])
# Disconnection DateTime # Disconnection DateTime
if row["ses_StillConnected"]: if row["sesStillConnected"]:
end = "..." end = "..."
elif row["ses_EventTypeDisconnection"] == "<missing event>": elif row["sesEventTypeDisconnection"] == "<missing event>":
end = row["ses_EventTypeDisconnection"] end = row["sesEventTypeDisconnection"]
else: else:
end = format_date(row["ses_DateTimeDisconnection"]) end = format_date(row["sesDateTimeDisconnection"])
# Duration # Duration
if row["ses_EventTypeConnection"] in ("<missing event>", None) or row[ if row["sesEventTypeConnection"] in ("<missing event>", None) or row[
"ses_EventTypeDisconnection" "sesEventTypeDisconnection"
] in ("<missing event>", None): ] in ("<missing event>", None):
dur = "..." dur = "..."
elif row["ses_StillConnected"]: elif row["sesStillConnected"]:
dur = format_date_diff(row["ses_DateTimeConnection"], None, tz_name)["text"] dur = format_date_diff(row["sesDateTimeConnection"], None, tz_name)["text"]
else: else:
dur = format_date_diff(row["ses_DateTimeConnection"], row["ses_DateTimeDisconnection"], tz_name)["text"] dur = format_date_diff(row["sesDateTimeConnection"], row["sesDateTimeDisconnection"], tz_name)["text"]
# Additional Info # Additional Info
info = row["ses_AdditionalInfo"] info = row["sesAdditionalInfo"]
if row["ses_EventTypeConnection"] == "New Device": if row["sesEventTypeConnection"] == "New Device":
info = f"{row['ses_EventTypeConnection']}: {info}" info = f"{row['sesEventTypeConnection']}: {info}"
# Push row data # Push row data
table_data["data"].append( table_data["data"].append(
{ {
"ses_MAC": mac, "sesMac": mac,
"ses_DateTimeOrder": row["ses_DateTimeOrder"], "sesDateTimeOrder": row["sesDateTimeOrder"],
"ses_Connection": ini, "sesConnection": ini,
"ses_Disconnection": end, "sesDisconnection": end,
"ses_Duration": dur, "sesDuration": dur,
"ses_IP": row["ses_IP"], "sesIp": row["sesIp"],
"ses_Info": info, "sesInfo": info,
} }
) )
@@ -307,42 +307,42 @@ def get_session_events(event_type, period_date):
# Base SQLs # Base SQLs
sql_events = f""" sql_events = f"""
SELECT SELECT
eve_DateTime AS eve_DateTimeOrder, eveDateTime AS eveDateTimeOrder,
devName, devName,
devOwner, devOwner,
eve_DateTime, eveDateTime,
eve_EventType, eveEventType,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
eve_IP, eveIp,
NULL, NULL,
eve_AdditionalInfo, eveAdditionalInfo,
NULL, NULL,
devMac, devMac,
eve_PendingAlertEmail evePendingAlertEmail
FROM Events_Devices FROM Events_Devices
WHERE eve_DateTime >= {period_date} WHERE eveDateTime >= {period_date}
""" """
sql_sessions = """ sql_sessions = """
SELECT SELECT
IFNULL(ses_DateTimeConnection, ses_DateTimeDisconnection) AS ses_DateTimeOrder, IFNULL(sesDateTimeConnection, sesDateTimeDisconnection) AS sesDateTimeOrder,
devName, devName,
devOwner, devOwner,
NULL, NULL,
NULL, NULL,
ses_DateTimeConnection, sesDateTimeConnection,
ses_DateTimeDisconnection, sesDateTimeDisconnection,
NULL, NULL,
NULL, NULL,
ses_IP, sesIp,
NULL, NULL,
ses_AdditionalInfo, sesAdditionalInfo,
ses_StillConnected, sesStillConnected,
devMac, devMac,
0 AS ses_PendingAlertEmail 0 AS sesPendingAlertEmail
FROM Sessions_Devices FROM Sessions_Devices
""" """
@@ -353,9 +353,9 @@ def get_session_events(event_type, period_date):
sql = ( sql = (
sql_sessions + f""" sql_sessions + f"""
WHERE ( WHERE (
ses_DateTimeConnection >= {period_date} sesDateTimeConnection >= {period_date}
OR ses_DateTimeDisconnection >= {period_date} OR sesDateTimeDisconnection >= {period_date}
OR ses_StillConnected = 1 OR sesStillConnected = 1
) )
""" """
) )
@@ -363,17 +363,17 @@ def get_session_events(event_type, period_date):
sql = ( sql = (
sql_sessions + f""" sql_sessions + f"""
WHERE ( WHERE (
(ses_DateTimeConnection IS NULL AND ses_DateTimeDisconnection >= {period_date}) (sesDateTimeConnection IS NULL AND sesDateTimeDisconnection >= {period_date})
OR (ses_DateTimeDisconnection IS NULL AND ses_StillConnected = 0 AND ses_DateTimeConnection >= {period_date}) OR (sesDateTimeDisconnection IS NULL AND sesStillConnected = 0 AND sesDateTimeConnection >= {period_date})
) )
""" """
) )
elif event_type == "voided": elif event_type == "voided":
sql = sql_events + ' AND eve_EventType LIKE "VOIDED%"' sql = sql_events + ' AND eveEventType LIKE "VOIDED%"'
elif event_type == "new": elif event_type == "new":
sql = sql_events + ' AND eve_EventType = "New Device"' sql = sql_events + ' AND eveEventType = "New Device"'
elif event_type == "down": elif event_type == "down":
sql = sql_events + ' AND eve_EventType = "Device Down"' sql = sql_events + ' AND eveEventType = "Device Down"'
else: else:
sql = sql_events + " AND 1=0" sql = sql_events + " AND 1=0"

View File

@@ -67,42 +67,7 @@ sql_devices_all = """
FROM DevicesView FROM DevicesView
""" """
sql_appevents = """select * from AppEvents order by DateTimeCreated desc""" sql_appevents = """select * from AppEvents order by dateTimeCreated desc"""
# The below query calculates counts of devices in various categories:
# (connected/online, offline, down, new, archived),
# as well as a combined count for devices that match any status listed in the UI_MY_DEVICES setting
sql_devices_tiles = """
WITH Statuses AS (
SELECT setValue
FROM Settings
WHERE setKey = 'UI_MY_DEVICES'
),
MyDevicesFilter AS (
SELECT
-- Build a dynamic filter for devices matching any status in UI_MY_DEVICES
devPresentLastScan, devAlertDown, devIsNew, devIsArchived
FROM Devices
WHERE
(instr((SELECT setValue FROM Statuses), 'online') > 0 AND devPresentLastScan = 1) OR
(instr((SELECT setValue FROM Statuses), 'offline') > 0 AND devPresentLastScan = 0 AND devIsArchived = 0) OR
(instr((SELECT setValue FROM Statuses), 'down') > 0 AND devPresentLastScan = 0 AND devAlertDown = 1) OR
(instr((SELECT setValue FROM Statuses), 'new') > 0 AND devIsNew = 1) OR
(instr((SELECT setValue FROM Statuses), 'archived') > 0 AND devIsArchived = 1)
)
SELECT
-- Counts for each individual status
(SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 1) AS connected,
(SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 0) AS offline,
(SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 0 AND devAlertDown = 1) AS down,
(SELECT COUNT(*) FROM Devices WHERE devIsNew = 1) AS new,
(SELECT COUNT(*) FROM Devices WHERE devIsArchived = 1) AS archived,
(SELECT COUNT(*) FROM Devices WHERE devFavorite = 1) AS favorites,
(SELECT COUNT(*) FROM Devices) AS "all",
(SELECT COUNT(*) FROM Devices) AS "all_devices",
-- My Devices count
(SELECT COUNT(*) FROM MyDevicesFilter) AS my_devices
FROM Statuses;
"""
sql_devices_filters = """ sql_devices_filters = """
SELECT DISTINCT 'devSite' AS columnName, devSite AS columnValue SELECT DISTINCT 'devSite' AS columnName, devSite AS columnValue
FROM Devices WHERE devSite NOT IN ('', 'null') AND devSite IS NOT NULL FROM Devices WHERE devSite NOT IN ('', 'null') AND devSite IS NOT NULL
@@ -141,32 +106,32 @@ sql_devices_filters = """
sql_devices_stats = f""" sql_devices_stats = f"""
SELECT SELECT
Online_Devices as online, onlineDevices as online,
Down_Devices as down, downDevices as down,
All_Devices as 'all', allDevices as 'all',
Archived_Devices as archived, archivedDevices as archived,
(SELECT COUNT(*) FROM Devices a WHERE devIsNew = 1) as new, (SELECT COUNT(*) FROM Devices a WHERE devIsNew = 1) as new,
(SELECT COUNT(*) FROM Devices a WHERE devName IN ({NULL_EQUIVALENTS_SQL}) OR devName IS NULL) as unknown (SELECT COUNT(*) FROM Devices a WHERE devName IN ({NULL_EQUIVALENTS_SQL}) OR devName IS NULL) as unknown
FROM Online_History FROM Online_History
ORDER BY Scan_Date DESC ORDER BY scanDate DESC
LIMIT 1 LIMIT 1
""" """
sql_events_pending_alert = "SELECT * FROM Events where eve_PendingAlertEmail is not 0" sql_events_pending_alert = "SELECT * FROM Events where evePendingAlertEmail is not 0"
sql_settings = "SELECT * FROM Settings" sql_settings = "SELECT * FROM Settings"
sql_plugins_objects = "SELECT * FROM Plugins_Objects" sql_plugins_objects = "SELECT * FROM Plugins_Objects"
sql_language_strings = "SELECT * FROM Plugins_Language_Strings" sql_language_strings = "SELECT * FROM Plugins_Language_Strings"
sql_notifications_all = "SELECT * FROM Notifications" sql_notifications_all = "SELECT * FROM Notifications"
sql_online_history = "SELECT * FROM Online_History" sql_online_history = "SELECT * FROM Online_History"
sql_plugins_events = "SELECT * FROM Plugins_Events" sql_plugins_events = "SELECT * FROM Plugins_Events"
sql_plugins_history = "SELECT * FROM Plugins_History ORDER BY DateTimeChanged DESC" sql_plugins_history = "SELECT * FROM Plugins_History ORDER BY dateTimeChanged DESC"
sql_new_devices = """SELECT * FROM ( sql_new_devices = """SELECT * FROM (
SELECT eve_IP as devLastIP, SELECT eveIp as devLastIP,
eve_MAC as devMac, eveMac as devMac,
MAX(eve_DateTime) as lastEvent MAX(eveDateTime) as lastEvent
FROM Events_Devices FROM Events_Devices
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
AND eve_EventType = 'New Device' AND eveEventType = 'New Device'
GROUP BY eve_MAC GROUP BY eveMac
ORDER BY lastEvent ORDER BY lastEvent
) t1 ) t1
LEFT JOIN LEFT JOIN

View File

@@ -16,6 +16,7 @@ from db.db_upgrade import (
ensure_Settings, ensure_Settings,
ensure_Indexes, ensure_Indexes,
ensure_mac_lowercase_triggers, ensure_mac_lowercase_triggers,
migrate_to_camelcase,
migrate_timestamps_to_utc, migrate_timestamps_to_utc,
) )
@@ -194,6 +195,10 @@ class DB:
if not ensure_column(self.sql, "Devices", "devCanSleep", "INTEGER"): if not ensure_column(self.sql, "Devices", "devCanSleep", "INTEGER"):
raise RuntimeError("ensure_column(devCanSleep) failed") raise RuntimeError("ensure_column(devCanSleep) failed")
# CamelCase column migration (must run before UTC migration and
# before ensure_plugins_tables which uses IF NOT EXISTS with new names)
migrate_to_camelcase(self.sql)
# Settings table setup # Settings table setup
ensure_Settings(self.sql) ensure_Settings(self.sql)

View File

@@ -66,6 +66,55 @@ def get_device_condition_by_status(device_status):
return get_device_conditions().get(device_status, "WHERE 1=0") return get_device_conditions().get(device_status, "WHERE 1=0")
# -------------------------------------------------------------------------------
def get_sql_devices_tiles():
"""Build the device tiles count SQL using get_device_conditions() to avoid duplicating filter logic."""
conds = get_device_conditions()
def f(key):
"""Strip 'WHERE ' prefix for use inside SELECT subqueries."""
return conds[key][len("WHERE "):]
# UI_MY_DEVICES setting values mapped to their device_conditions keys
my_devices_setting_map = [
("online", "connected"),
("offline", "offline"),
("down", "down"),
("new", "new"),
("archived", "archived"),
]
my_devices_clauses = "\n OR ".join(
f"(instr((SELECT setValue FROM Statuses), '{sk}') > 0 AND {f(ck)})"
for sk, ck in my_devices_setting_map
)
return f"""
WITH Statuses AS (
SELECT setValue
FROM Settings
WHERE setKey = 'UI_MY_DEVICES'
),
MyDevicesFilter AS (
SELECT devMac
FROM Devices
WHERE
{my_devices_clauses}
)
SELECT
(SELECT COUNT(*) FROM Devices WHERE {f('connected')}) AS connected,
(SELECT COUNT(*) FROM Devices WHERE {f('offline')}) AS offline,
(SELECT COUNT(*) FROM Devices WHERE {f('down')}) AS down,
(SELECT COUNT(*) FROM Devices WHERE {f('new')}) AS new,
(SELECT COUNT(*) FROM Devices WHERE {f('archived')}) AS archived,
(SELECT COUNT(*) FROM Devices WHERE {f('favorites')}) AS favorites,
(SELECT COUNT(*) FROM Devices WHERE {f('all')}) AS "all",
(SELECT COUNT(*) FROM Devices) AS "all_devices",
(SELECT COUNT(*) FROM MyDevicesFilter) AS my_devices
FROM Statuses;
"""
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# Creates a JSON-like dictionary from a database row # Creates a JSON-like dictionary from a database row
def row_to_json(names, row): def row_to_json(names, row):

View File

@@ -157,7 +157,7 @@ def ensure_views(sql) -> bool:
sql.execute(""" CREATE VIEW Events_Devices AS sql.execute(""" CREATE VIEW Events_Devices AS
SELECT * SELECT *
FROM Events FROM Events
LEFT JOIN Devices ON eve_MAC = devMac; LEFT JOIN Devices ON eveMac = devMac;
""") """)
sql.execute(""" DROP VIEW IF EXISTS LatestEventsPerMAC;""") sql.execute(""" DROP VIEW IF EXISTS LatestEventsPerMAC;""")
@@ -165,7 +165,7 @@ def ensure_views(sql) -> bool:
WITH RankedEvents AS ( WITH RankedEvents AS (
SELECT SELECT
e.*, e.*,
ROW_NUMBER() OVER (PARTITION BY e.eve_MAC ORDER BY e.eve_DateTime DESC) AS row_num ROW_NUMBER() OVER (PARTITION BY e.eveMac ORDER BY e.eveDateTime DESC) AS row_num
FROM Events AS e FROM Events AS e
) )
SELECT SELECT
@@ -173,43 +173,43 @@ def ensure_views(sql) -> bool:
d.*, d.*,
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eveMac = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac INNER JOIN CurrentScan AS c ON e.eveMac = c.scanMac
WHERE e.row_num = 1;""") WHERE e.row_num = 1;""")
sql.execute(""" DROP VIEW IF EXISTS Sessions_Devices;""") sql.execute(""" DROP VIEW IF EXISTS Sessions_Devices;""")
sql.execute( sql.execute(
"""CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac;""" """CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON sesMac = devMac;"""
) )
# handling the Convert_Events_to_Sessions / Sessions screens # handling the Convert_Events_to_Sessions / Sessions screens
sql.execute("""DROP VIEW IF EXISTS Convert_Events_to_Sessions;""") sql.execute("""DROP VIEW IF EXISTS Convert_Events_to_Sessions;""")
sql.execute("""CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC, sql.execute("""CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eveMac,
EVE1.eve_IP, EVE1.eveIp,
EVE1.eve_EventType AS eve_EventTypeConnection, EVE1.eveEventType AS eveEventTypeConnection,
EVE1.eve_DateTime AS eve_DateTimeConnection, EVE1.eveDateTime AS eveDateTimeConnection,
CASE WHEN EVE2.eve_EventType IN ('Disconnected', 'Device Down') OR CASE WHEN EVE2.eveEventType IN ('Disconnected', 'Device Down') OR
EVE2.eve_EventType IS NULL THEN EVE2.eve_EventType ELSE '<missing event>' END AS eve_EventTypeDisconnection, EVE2.eveEventType IS NULL THEN EVE2.eveEventType ELSE '<missing event>' END AS eveEventTypeDisconnection,
CASE WHEN EVE2.eve_EventType IN ('Disconnected', 'Device Down') THEN EVE2.eve_DateTime ELSE NULL END AS eve_DateTimeDisconnection, CASE WHEN EVE2.eveEventType IN ('Disconnected', 'Device Down') THEN EVE2.eveDateTime ELSE NULL END AS eveDateTimeDisconnection,
CASE WHEN EVE2.eve_EventType IS NULL THEN 1 ELSE 0 END AS eve_StillConnected, CASE WHEN EVE2.eveEventType IS NULL THEN 1 ELSE 0 END AS eveStillConnected,
EVE1.eve_AdditionalInfo EVE1.eveAdditionalInfo
FROM Events AS EVE1 FROM Events AS EVE1
LEFT JOIN LEFT JOIN
Events AS EVE2 ON EVE1.eve_PairEventRowID = EVE2.RowID Events AS EVE2 ON EVE1.evePairEventRowid = EVE2.RowID
WHERE EVE1.eve_EventType IN ('New Device', 'Connected','Down Reconnected') WHERE EVE1.eveEventType IN ('New Device', 'Connected','Down Reconnected')
UNION UNION
SELECT eve_MAC, SELECT eveMac,
eve_IP, eveIp,
'<missing event>' AS eve_EventTypeConnection, '<missing event>' AS eveEventTypeConnection,
NULL AS eve_DateTimeConnection, NULL AS eveDateTimeConnection,
eve_EventType AS eve_EventTypeDisconnection, eveEventType AS eveEventTypeDisconnection,
eve_DateTime AS eve_DateTimeDisconnection, eveDateTime AS eveDateTimeDisconnection,
0 AS eve_StillConnected, 0 AS eveStillConnected,
eve_AdditionalInfo eveAdditionalInfo
FROM Events AS EVE1 FROM Events AS EVE1
WHERE (eve_EventType = 'Device Down' OR WHERE (eveEventType = 'Device Down' OR
eve_EventType = 'Disconnected') AND eveEventType = 'Disconnected') AND
EVE1.eve_PairEventRowID IS NULL; EVE1.evePairEventRowid IS NULL;
""") """)
sql.execute(""" DROP VIEW IF EXISTS LatestDeviceScan;""") sql.execute(""" DROP VIEW IF EXISTS LatestDeviceScan;""")
@@ -316,10 +316,10 @@ def ensure_views(sql) -> bool:
WHEN EXISTS ( WHEN EXISTS (
SELECT 1 SELECT 1
FROM Events e FROM Events e
WHERE LOWER(e.eve_MAC) = LOWER(Devices.devMac) WHERE LOWER(e.eveMac) = LOWER(Devices.devMac)
AND e.eve_EventType IN ('Connected','Disconnected','Device Down','Down Reconnected') AND e.eveEventType IN ('Connected','Disconnected','Device Down','Down Reconnected')
AND e.eve_DateTime >= datetime('now', '-{FLAP_WINDOW_HOURS} hours') AND e.eveDateTime >= datetime('now', '-{FLAP_WINDOW_HOURS} hours')
GROUP BY e.eve_MAC GROUP BY e.eveMac
HAVING COUNT(*) >= {FLAP_THRESHOLD} HAVING COUNT(*) >= {FLAP_THRESHOLD}
) )
THEN 1 THEN 1
@@ -360,10 +360,10 @@ def ensure_Indexes(sql) -> bool:
SELECT MIN(rowid) SELECT MIN(rowid)
FROM Events FROM Events
GROUP BY GROUP BY
eve_MAC, eveMac,
eve_IP, eveIp,
eve_EventType, eveEventType,
eve_DateTime eveDateTime
); );
""" """
@@ -373,32 +373,32 @@ def ensure_Indexes(sql) -> bool:
# Sessions # Sessions
( (
"idx_ses_mac_date", "idx_ses_mac_date",
"CREATE INDEX idx_ses_mac_date ON Sessions(ses_MAC, ses_DateTimeConnection, ses_DateTimeDisconnection, ses_StillConnected)", "CREATE INDEX idx_ses_mac_date ON Sessions(sesMac, sesDateTimeConnection, sesDateTimeDisconnection, sesStillConnected)",
), ),
# Events # Events
( (
"idx_eve_mac_date_type", "idx_eve_mac_date_type",
"CREATE INDEX idx_eve_mac_date_type ON Events(eve_MAC, eve_DateTime, eve_EventType)", "CREATE INDEX idx_eve_mac_date_type ON Events(eveMac, eveDateTime, eveEventType)",
), ),
( (
"idx_eve_alert_pending", "idx_eve_alert_pending",
"CREATE INDEX idx_eve_alert_pending ON Events(eve_PendingAlertEmail)", "CREATE INDEX idx_eve_alert_pending ON Events(evePendingAlertEmail)",
), ),
( (
"idx_eve_mac_datetime_desc", "idx_eve_mac_datetime_desc",
"CREATE INDEX idx_eve_mac_datetime_desc ON Events(eve_MAC, eve_DateTime DESC)", "CREATE INDEX idx_eve_mac_datetime_desc ON Events(eveMac, eveDateTime DESC)",
), ),
( (
"idx_eve_pairevent", "idx_eve_pairevent",
"CREATE INDEX idx_eve_pairevent ON Events(eve_PairEventRowID)", "CREATE INDEX idx_eve_pairevent ON Events(evePairEventRowid)",
), ),
( (
"idx_eve_type_date", "idx_eve_type_date",
"CREATE INDEX idx_eve_type_date ON Events(eve_EventType, eve_DateTime)", "CREATE INDEX idx_eve_type_date ON Events(eveEventType, eveDateTime)",
), ),
( (
"idx_events_unique", "idx_events_unique",
"CREATE UNIQUE INDEX idx_events_unique ON Events (eve_MAC, eve_IP, eve_EventType, eve_DateTime)", "CREATE UNIQUE INDEX idx_events_unique ON Events (eveMac, eveIp, eveEventType, eveDateTime)",
), ),
# Devices # Devices
("idx_dev_mac", "CREATE INDEX idx_dev_mac ON Devices(devMac)"), ("idx_dev_mac", "CREATE INDEX idx_dev_mac ON Devices(devMac)"),
@@ -436,15 +436,15 @@ def ensure_Indexes(sql) -> bool:
# Plugins_Objects # Plugins_Objects
( (
"idx_plugins_plugin_mac_ip", "idx_plugins_plugin_mac_ip",
"CREATE INDEX idx_plugins_plugin_mac_ip ON Plugins_Objects(Plugin, Object_PrimaryID, Object_SecondaryID)", "CREATE INDEX idx_plugins_plugin_mac_ip ON Plugins_Objects(plugin, objectPrimaryId, objectSecondaryId)",
), # Issue #1251: Optimize name resolution lookup ), # Issue #1251: Optimize name resolution lookup
# Plugins_History: covers both the db_cleanup window function # Plugins_History: covers both the db_cleanup window function
# (PARTITION BY Plugin ORDER BY DateTimeChanged DESC) and the # (PARTITION BY plugin ORDER BY dateTimeChanged DESC) and the
# API query (SELECT * … ORDER BY DateTimeChanged DESC). # API query (SELECT * … ORDER BY dateTimeChanged DESC).
# Without this, both ops do a full 48k-row table sort on every cycle. # Without this, both ops do a full 48k-row table sort on every cycle.
( (
"idx_plugins_history_plugin_dt", "idx_plugins_history_plugin_dt",
"CREATE INDEX idx_plugins_history_plugin_dt ON Plugins_History(Plugin, DateTimeChanged DESC)", "CREATE INDEX idx_plugins_history_plugin_dt ON Plugins_History(plugin, dateTimeChanged DESC)",
), ),
] ]
@@ -547,94 +547,295 @@ def ensure_plugins_tables(sql) -> bool:
# Plugin state # Plugin state
sql_Plugins_Objects = """ CREATE TABLE IF NOT EXISTS Plugins_Objects( sql_Plugins_Objects = """ CREATE TABLE IF NOT EXISTS Plugins_Objects(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, helpVal4 TEXT,
ObjectGUID TEXT, objectGuid TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); """ ); """
sql.execute(sql_Plugins_Objects) sql.execute(sql_Plugins_Objects)
# Plugin execution results # Plugin execution results
sql_Plugins_Events = """ CREATE TABLE IF NOT EXISTS Plugins_Events( sql_Plugins_Events = """ CREATE TABLE IF NOT EXISTS Plugins_Events(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, helpVal4 TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) objectGuid TEXT,
PRIMARY KEY("index" AUTOINCREMENT)
); """ ); """
sql.execute(sql_Plugins_Events) sql.execute(sql_Plugins_Events)
# Plugin execution history # Plugin execution history
sql_Plugins_History = """ CREATE TABLE IF NOT EXISTS Plugins_History( sql_Plugins_History = """ CREATE TABLE IF NOT EXISTS Plugins_History(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, helpVal4 TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) objectGuid TEXT,
PRIMARY KEY("index" AUTOINCREMENT)
); """ ); """
sql.execute(sql_Plugins_History) sql.execute(sql_Plugins_History)
# Dynamically generated language strings # Dynamically generated language strings
sql.execute("DROP TABLE IF EXISTS Plugins_Language_Strings;") sql.execute("DROP TABLE IF EXISTS Plugins_Language_Strings;")
sql.execute(""" CREATE TABLE IF NOT EXISTS Plugins_Language_Strings( sql.execute(""" CREATE TABLE IF NOT EXISTS Plugins_Language_Strings(
"Index" INTEGER, "index" INTEGER,
Language_Code TEXT NOT NULL, languageCode TEXT NOT NULL,
String_Key TEXT NOT NULL, stringKey TEXT NOT NULL,
String_Value TEXT NOT NULL, stringValue TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); """) ); """)
return True return True
# ===============================================================================
# CamelCase Column Migration
# ===============================================================================
# Mapping of (table_name, old_column_name) → new_column_name.
# Only entries where the name actually changes are listed.
# Columns like "Index" → "index" are cosmetic case changes handled
# implicitly by SQLite's case-insensitive matching.
_CAMELCASE_COLUMN_MAP = {
"Events": {
"eve_MAC": "eveMac",
"eve_IP": "eveIp",
"eve_DateTime": "eveDateTime",
"eve_EventType": "eveEventType",
"eve_AdditionalInfo": "eveAdditionalInfo",
"eve_PendingAlertEmail": "evePendingAlertEmail",
"eve_PairEventRowid": "evePairEventRowid",
"eve_PairEventRowID": "evePairEventRowid",
},
"Sessions": {
"ses_MAC": "sesMac",
"ses_IP": "sesIp",
"ses_EventTypeConnection": "sesEventTypeConnection",
"ses_DateTimeConnection": "sesDateTimeConnection",
"ses_EventTypeDisconnection": "sesEventTypeDisconnection",
"ses_DateTimeDisconnection": "sesDateTimeDisconnection",
"ses_StillConnected": "sesStillConnected",
"ses_AdditionalInfo": "sesAdditionalInfo",
},
"Online_History": {
"Index": "index",
"Scan_Date": "scanDate",
"Online_Devices": "onlineDevices",
"Down_Devices": "downDevices",
"All_Devices": "allDevices",
"Archived_Devices": "archivedDevices",
"Offline_Devices": "offlineDevices",
},
"Plugins_Objects": {
"Index": "index",
"Plugin": "plugin",
"Object_PrimaryID": "objectPrimaryId",
"Object_SecondaryID": "objectSecondaryId",
"DateTimeCreated": "dateTimeCreated",
"DateTimeChanged": "dateTimeChanged",
"Watched_Value1": "watchedValue1",
"Watched_Value2": "watchedValue2",
"Watched_Value3": "watchedValue3",
"Watched_Value4": "watchedValue4",
"Status": "status",
"Extra": "extra",
"UserData": "userData",
"ForeignKey": "foreignKey",
"SyncHubNodeName": "syncHubNodeName",
"HelpVal1": "helpVal1",
"HelpVal2": "helpVal2",
"HelpVal3": "helpVal3",
"HelpVal4": "helpVal4",
"ObjectGUID": "objectGuid",
},
"Plugins_Events": {
"Index": "index",
"Plugin": "plugin",
"Object_PrimaryID": "objectPrimaryId",
"Object_SecondaryID": "objectSecondaryId",
"DateTimeCreated": "dateTimeCreated",
"DateTimeChanged": "dateTimeChanged",
"Watched_Value1": "watchedValue1",
"Watched_Value2": "watchedValue2",
"Watched_Value3": "watchedValue3",
"Watched_Value4": "watchedValue4",
"Status": "status",
"Extra": "extra",
"UserData": "userData",
"ForeignKey": "foreignKey",
"SyncHubNodeName": "syncHubNodeName",
"HelpVal1": "helpVal1",
"HelpVal2": "helpVal2",
"HelpVal3": "helpVal3",
"HelpVal4": "helpVal4",
"ObjectGUID": "objectGuid",
},
"Plugins_History": {
"Index": "index",
"Plugin": "plugin",
"Object_PrimaryID": "objectPrimaryId",
"Object_SecondaryID": "objectSecondaryId",
"DateTimeCreated": "dateTimeCreated",
"DateTimeChanged": "dateTimeChanged",
"Watched_Value1": "watchedValue1",
"Watched_Value2": "watchedValue2",
"Watched_Value3": "watchedValue3",
"Watched_Value4": "watchedValue4",
"Status": "status",
"Extra": "extra",
"UserData": "userData",
"ForeignKey": "foreignKey",
"SyncHubNodeName": "syncHubNodeName",
"HelpVal1": "helpVal1",
"HelpVal2": "helpVal2",
"HelpVal3": "helpVal3",
"HelpVal4": "helpVal4",
"ObjectGUID": "objectGuid",
},
"Plugins_Language_Strings": {
"Index": "index",
"Language_Code": "languageCode",
"String_Key": "stringKey",
"String_Value": "stringValue",
"Extra": "extra",
},
"AppEvents": {
"Index": "index",
"GUID": "guid",
"AppEventProcessed": "appEventProcessed",
"DateTimeCreated": "dateTimeCreated",
"ObjectType": "objectType",
"ObjectGUID": "objectGuid",
"ObjectPlugin": "objectPlugin",
"ObjectPrimaryID": "objectPrimaryId",
"ObjectSecondaryID": "objectSecondaryId",
"ObjectForeignKey": "objectForeignKey",
"ObjectIndex": "objectIndex",
"ObjectIsNew": "objectIsNew",
"ObjectIsArchived": "objectIsArchived",
"ObjectStatusColumn": "objectStatusColumn",
"ObjectStatus": "objectStatus",
"AppEventType": "appEventType",
"Helper1": "helper1",
"Helper2": "helper2",
"Helper3": "helper3",
"Extra": "extra",
},
"Notifications": {
"Index": "index",
"GUID": "guid",
"DateTimeCreated": "dateTimeCreated",
"DateTimePushed": "dateTimePushed",
"Status": "status",
"JSON": "json",
"Text": "text",
"HTML": "html",
"PublishedVia": "publishedVia",
"Extra": "extra",
},
}
def migrate_to_camelcase(sql) -> bool:
"""
Detects legacy (underscore/PascalCase) column names and renames them
to camelCase using ALTER TABLE … RENAME COLUMN (SQLite ≥ 3.25.0).
Idempotent: columns already matching the new name are silently skipped.
"""
# Quick probe: if Events table has 'eveMac' we're already on the new schema
sql.execute('PRAGMA table_info("Events")')
events_cols = {row[1] for row in sql.fetchall()}
if "eveMac" in events_cols:
mylog("verbose", ["[db_upgrade] Schema already uses camelCase — skipping migration"])
return True
if "eve_MAC" not in events_cols:
# Events table doesn't exist or has unexpected schema — skip silently
mylog("verbose", ["[db_upgrade] Events table missing/unrecognised — skipping camelCase migration"])
return True
mylog("none", ["[db_upgrade] Starting camelCase column migration …"])
# Drop views first — ALTER TABLE RENAME COLUMN will fail if a view
# references the old column name and the view SQL cannot be rewritten.
for view_name in ("Events_Devices", "LatestEventsPerMAC", "Sessions_Devices",
"Convert_Events_to_Sessions", "LatestDeviceScan", "DevicesView"):
sql.execute(f"DROP VIEW IF EXISTS {view_name};")
renamed_count = 0
for table, column_map in _CAMELCASE_COLUMN_MAP.items():
# Check table exists
sql.execute("SELECT name FROM sqlite_master WHERE type='table' AND name=?", (table,))
if not sql.fetchone():
mylog("verbose", [f"[db_upgrade] Table '{table}' does not exist — skipping"])
continue
# Get current column names (case-preserved)
sql.execute(f'PRAGMA table_info("{table}")')
current_cols = {row[1] for row in sql.fetchall()}
for old_name, new_name in column_map.items():
if old_name in current_cols and new_name not in current_cols:
sql.execute(f'ALTER TABLE "{table}" RENAME COLUMN "{old_name}" TO "{new_name}"')
renamed_count += 1
mylog("verbose", [f"[db_upgrade] {table}.{old_name}{new_name}"])
mylog("none", [f"[db_upgrade] ✓ camelCase migration complete — {renamed_count} columns renamed"])
return True
# =============================================================================== # ===============================================================================
# UTC Timestamp Migration (added 2026-02-10) # UTC Timestamp Migration (added 2026-02-10)
# =============================================================================== # ===============================================================================
@@ -817,17 +1018,18 @@ def migrate_timestamps_to_utc(sql) -> bool:
mylog("verbose", f"[db_upgrade] Starting UTC timestamp migration (offset: {offset_hours} hours)") mylog("verbose", f"[db_upgrade] Starting UTC timestamp migration (offset: {offset_hours} hours)")
# List of tables and their datetime columns # List of tables and their datetime columns (camelCase names —
# migrate_to_camelcase() runs before this function).
timestamp_columns = { timestamp_columns = {
'Devices': ['devFirstConnection', 'devLastConnection', 'devLastNotification'], 'Devices': ['devFirstConnection', 'devLastConnection', 'devLastNotification'],
'Events': ['eve_DateTime'], 'Events': ['eveDateTime'],
'Sessions': ['ses_DateTimeConnection', 'ses_DateTimeDisconnection'], 'Sessions': ['sesDateTimeConnection', 'sesDateTimeDisconnection'],
'Notifications': ['DateTimeCreated', 'DateTimePushed'], 'Notifications': ['dateTimeCreated', 'dateTimePushed'],
'Online_History': ['Scan_Date'], 'Online_History': ['scanDate'],
'Plugins_Objects': ['DateTimeCreated', 'DateTimeChanged'], 'Plugins_Objects': ['dateTimeCreated', 'dateTimeChanged'],
'Plugins_Events': ['DateTimeCreated', 'DateTimeChanged'], 'Plugins_Events': ['dateTimeCreated', 'dateTimeChanged'],
'Plugins_History': ['DateTimeCreated', 'DateTimeChanged'], 'Plugins_History': ['dateTimeCreated', 'dateTimeChanged'],
'AppEvents': ['DateTimeCreated'], 'AppEvents': ['dateTimeCreated'],
} }
for table, columns in timestamp_columns.items(): for table, columns in timestamp_columns.items():

View File

@@ -1,14 +1,14 @@
CREATE TABLE Events (eve_MAC STRING (50) NOT NULL COLLATE NOCASE, eve_IP STRING (50) NOT NULL COLLATE NOCASE, eve_DateTime DATETIME NOT NULL, eve_EventType STRING (30) NOT NULL COLLATE NOCASE, eve_AdditionalInfo STRING (250) DEFAULT (''), eve_PendingAlertEmail BOOLEAN NOT NULL CHECK (eve_PendingAlertEmail IN (0, 1)) DEFAULT (1), eve_PairEventRowid INTEGER); CREATE TABLE Events (eveMac STRING (50) NOT NULL COLLATE NOCASE, eveIp STRING (50) NOT NULL COLLATE NOCASE, eveDateTime DATETIME NOT NULL, eveEventType STRING (30) NOT NULL COLLATE NOCASE, eveAdditionalInfo STRING (250) DEFAULT (''), evePendingAlertEmail BOOLEAN NOT NULL CHECK (evePendingAlertEmail IN (0, 1)) DEFAULT (1), evePairEventRowid INTEGER);
CREATE TABLE Sessions (ses_MAC STRING (50) COLLATE NOCASE, ses_IP STRING (50) COLLATE NOCASE, ses_EventTypeConnection STRING (30) COLLATE NOCASE, ses_DateTimeConnection DATETIME, ses_EventTypeDisconnection STRING (30) COLLATE NOCASE, ses_DateTimeDisconnection DATETIME, ses_StillConnected BOOLEAN, ses_AdditionalInfo STRING (250)); CREATE TABLE Sessions (sesMac STRING (50) COLLATE NOCASE, sesIp STRING (50) COLLATE NOCASE, sesEventTypeConnection STRING (30) COLLATE NOCASE, sesDateTimeConnection DATETIME, sesEventTypeDisconnection STRING (30) COLLATE NOCASE, sesDateTimeDisconnection DATETIME, sesStillConnected BOOLEAN, sesAdditionalInfo STRING (250));
CREATE TABLE IF NOT EXISTS "Online_History" ( CREATE TABLE IF NOT EXISTS Online_History (
"Index" INTEGER, "index" INTEGER,
"Scan_Date" TEXT, scanDate TEXT,
"Online_Devices" INTEGER, onlineDevices INTEGER,
"Down_Devices" INTEGER, downDevices INTEGER,
"All_Devices" INTEGER, allDevices INTEGER,
"Archived_Devices" INTEGER, archivedDevices INTEGER,
"Offline_Devices" INTEGER, offlineDevices INTEGER,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE TABLE Devices ( CREATE TABLE Devices (
devMac STRING (50) PRIMARY KEY NOT NULL COLLATE NOCASE, devMac STRING (50) PRIMARY KEY NOT NULL COLLATE NOCASE,
@@ -57,96 +57,98 @@ CREATE TABLE Devices (
devParentPortSource TEXT, devParentPortSource TEXT,
devParentRelTypeSource TEXT, devParentRelTypeSource TEXT,
devVlanSource TEXT, devVlanSource TEXT,
"devCustomProps" TEXT); devCustomProps TEXT);
CREATE TABLE IF NOT EXISTS "Settings" ( CREATE TABLE IF NOT EXISTS Settings (
"setKey" TEXT, setKey TEXT,
"setName" TEXT, setName TEXT,
"setDescription" TEXT, setDescription TEXT,
"setType" TEXT, setType TEXT,
"setOptions" TEXT, setOptions TEXT,
"setGroup" TEXT, setGroup TEXT,
"setValue" TEXT, setValue TEXT,
"setEvents" TEXT, setEvents TEXT,
"setOverriddenByEnv" INTEGER setOverriddenByEnv INTEGER
); );
CREATE TABLE IF NOT EXISTS "Parameters" ( CREATE TABLE IF NOT EXISTS Parameters (
"parID" TEXT PRIMARY KEY, parID TEXT PRIMARY KEY,
"parValue" TEXT parValue TEXT
); );
CREATE TABLE Plugins_Objects( CREATE TABLE Plugins_Objects(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, helpVal4 TEXT,
ObjectGUID TEXT, objectGuid TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE TABLE Plugins_Events( CREATE TABLE Plugins_Events(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, "ObjectGUID" TEXT, helpVal4 TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) objectGuid TEXT,
PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE TABLE Plugins_History( CREATE TABLE Plugins_History(
"Index" INTEGER, "index" INTEGER,
Plugin TEXT NOT NULL, plugin TEXT NOT NULL,
Object_PrimaryID TEXT NOT NULL, objectPrimaryId TEXT NOT NULL,
Object_SecondaryID TEXT NOT NULL, objectSecondaryId TEXT NOT NULL,
DateTimeCreated TEXT NOT NULL, dateTimeCreated TEXT NOT NULL,
DateTimeChanged TEXT NOT NULL, dateTimeChanged TEXT NOT NULL,
Watched_Value1 TEXT NOT NULL, watchedValue1 TEXT NOT NULL,
Watched_Value2 TEXT NOT NULL, watchedValue2 TEXT NOT NULL,
Watched_Value3 TEXT NOT NULL, watchedValue3 TEXT NOT NULL,
Watched_Value4 TEXT NOT NULL, watchedValue4 TEXT NOT NULL,
Status TEXT NOT NULL, "status" TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
UserData TEXT NOT NULL, userData TEXT NOT NULL,
ForeignKey TEXT NOT NULL, foreignKey TEXT NOT NULL,
SyncHubNodeName TEXT, syncHubNodeName TEXT,
"HelpVal1" TEXT, helpVal1 TEXT,
"HelpVal2" TEXT, helpVal2 TEXT,
"HelpVal3" TEXT, helpVal3 TEXT,
"HelpVal4" TEXT, "ObjectGUID" TEXT, helpVal4 TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) objectGuid TEXT,
PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE TABLE Plugins_Language_Strings( CREATE TABLE Plugins_Language_Strings(
"Index" INTEGER, "index" INTEGER,
Language_Code TEXT NOT NULL, languageCode TEXT NOT NULL,
String_Key TEXT NOT NULL, stringKey TEXT NOT NULL,
String_Value TEXT NOT NULL, stringValue TEXT NOT NULL,
Extra TEXT NOT NULL, extra TEXT NOT NULL,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
scanMac STRING(50) NOT NULL COLLATE NOCASE, scanMac STRING(50) NOT NULL COLLATE NOCASE,
@@ -165,50 +167,50 @@ CREATE TABLE CurrentScan (
scanType STRING(250), scanType STRING(250),
UNIQUE(scanMac) UNIQUE(scanMac)
); );
CREATE TABLE IF NOT EXISTS "AppEvents" ( CREATE TABLE IF NOT EXISTS AppEvents (
"Index" INTEGER PRIMARY KEY AUTOINCREMENT, "index" INTEGER PRIMARY KEY AUTOINCREMENT,
"GUID" TEXT UNIQUE, guid TEXT UNIQUE,
"AppEventProcessed" BOOLEAN, appEventProcessed BOOLEAN,
"DateTimeCreated" TEXT, dateTimeCreated TEXT,
"ObjectType" TEXT, objectType TEXT,
"ObjectGUID" TEXT, objectGuid TEXT,
"ObjectPlugin" TEXT, objectPlugin TEXT,
"ObjectPrimaryID" TEXT, objectPrimaryId TEXT,
"ObjectSecondaryID" TEXT, objectSecondaryId TEXT,
"ObjectForeignKey" TEXT, objectForeignKey TEXT,
"ObjectIndex" TEXT, objectIndex TEXT,
"ObjectIsNew" BOOLEAN, objectIsNew BOOLEAN,
"ObjectIsArchived" BOOLEAN, objectIsArchived BOOLEAN,
"ObjectStatusColumn" TEXT, objectStatusColumn TEXT,
"ObjectStatus" TEXT, objectStatus TEXT,
"AppEventType" TEXT, appEventType TEXT,
"Helper1" TEXT, helper1 TEXT,
"Helper2" TEXT, helper2 TEXT,
"Helper3" TEXT, helper3 TEXT,
"Extra" TEXT extra TEXT
); );
CREATE TABLE IF NOT EXISTS "Notifications" ( CREATE TABLE IF NOT EXISTS Notifications (
"Index" INTEGER, "index" INTEGER,
"GUID" TEXT UNIQUE, guid TEXT UNIQUE,
"DateTimeCreated" TEXT, dateTimeCreated TEXT,
"DateTimePushed" TEXT, dateTimePushed TEXT,
"Status" TEXT, "status" TEXT,
"JSON" TEXT, "json" TEXT,
"Text" TEXT, "text" TEXT,
"HTML" TEXT, html TEXT,
"PublishedVia" TEXT, publishedVia TEXT,
"Extra" TEXT, extra TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); );
CREATE INDEX IDX_eve_DateTime ON Events (eve_DateTime); CREATE INDEX IDX_eve_DateTime ON Events (eveDateTime);
CREATE INDEX IDX_eve_EventType ON Events (eve_EventType COLLATE NOCASE); CREATE INDEX IDX_eve_EventType ON Events (eveEventType COLLATE NOCASE);
CREATE INDEX IDX_eve_MAC ON Events (eve_MAC COLLATE NOCASE); CREATE INDEX IDX_eve_MAC ON Events (eveMac COLLATE NOCASE);
CREATE INDEX IDX_eve_PairEventRowid ON Events (eve_PairEventRowid); CREATE INDEX IDX_eve_PairEventRowid ON Events (evePairEventRowid);
CREATE INDEX IDX_ses_EventTypeDisconnection ON Sessions (ses_EventTypeDisconnection COLLATE NOCASE); CREATE INDEX IDX_ses_EventTypeDisconnection ON Sessions (sesEventTypeDisconnection COLLATE NOCASE);
CREATE INDEX IDX_ses_EventTypeConnection ON Sessions (ses_EventTypeConnection COLLATE NOCASE); CREATE INDEX IDX_ses_EventTypeConnection ON Sessions (sesEventTypeConnection COLLATE NOCASE);
CREATE INDEX IDX_ses_DateTimeDisconnection ON Sessions (ses_DateTimeDisconnection); CREATE INDEX IDX_ses_DateTimeDisconnection ON Sessions (sesDateTimeDisconnection);
CREATE INDEX IDX_ses_MAC ON Sessions (ses_MAC COLLATE NOCASE); CREATE INDEX IDX_ses_MAC ON Sessions (sesMac COLLATE NOCASE);
CREATE INDEX IDX_ses_DateTimeConnection ON Sessions (ses_DateTimeConnection); CREATE INDEX IDX_ses_DateTimeConnection ON Sessions (sesDateTimeConnection);
CREATE INDEX IDX_dev_PresentLastScan ON Devices (devPresentLastScan); CREATE INDEX IDX_dev_PresentLastScan ON Devices (devPresentLastScan);
CREATE INDEX IDX_dev_FirstConnection ON Devices (devFirstConnection); CREATE INDEX IDX_dev_FirstConnection ON Devices (devFirstConnection);
CREATE INDEX IDX_dev_AlertDeviceDown ON Devices (devAlertDown); CREATE INDEX IDX_dev_AlertDeviceDown ON Devices (devAlertDown);
@@ -220,21 +222,20 @@ CREATE INDEX IDX_dev_NewDevice ON Devices (devIsNew);
CREATE INDEX IDX_dev_Archived ON Devices (devIsArchived); CREATE INDEX IDX_dev_Archived ON Devices (devIsArchived);
CREATE UNIQUE INDEX IF NOT EXISTS idx_events_unique CREATE UNIQUE INDEX IF NOT EXISTS idx_events_unique
ON Events ( ON Events (
eve_MAC, eveMac,
eve_IP, eveIp,
eve_EventType, eveEventType,
eve_DateTime eveDateTime
); );
CREATE VIEW Events_Devices AS CREATE VIEW Events_Devices AS
SELECT * SELECT *
FROM Events FROM Events
LEFT JOIN Devices ON eve_MAC = devMac LEFT JOIN Devices ON eveMac = devMac;
/* Events_Devices(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */;
CREATE VIEW LatestEventsPerMAC AS CREATE VIEW LatestEventsPerMAC AS
WITH RankedEvents AS ( WITH RankedEvents AS (
SELECT SELECT
e.*, e.*,
ROW_NUMBER() OVER (PARTITION BY e.eve_MAC ORDER BY e.eve_DateTime DESC) AS row_num ROW_NUMBER() OVER (PARTITION BY e.eveMac ORDER BY e.eveDateTime DESC) AS row_num
FROM Events AS e FROM Events AS e
) )
SELECT SELECT
@@ -242,192 +243,33 @@ CREATE VIEW LatestEventsPerMAC AS
d.*, d.*,
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eveMac = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac INNER JOIN CurrentScan AS c ON e.eveMac = c.scanMac
WHERE e.row_num = 1 WHERE e.row_num = 1;
/* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,scanMac,scanLastIP,scanVendor,scanSourcePlugin,scanName,scanLastQuery,scanLastConnection,scanSyncHubNode,scanSite,scanSSID,scanParentMAC,scanParentPort,scanType) */; CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN Devices ON sesMac = devMac;
CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eveMac,
/* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */; EVE1.eveIp,
CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC, EVE1.eveEventType AS eveEventTypeConnection,
EVE1.eve_IP, EVE1.eveDateTime AS eveDateTimeConnection,
EVE1.eve_EventType AS eve_EventTypeConnection, CASE WHEN EVE2.eveEventType IN ('Disconnected', 'Device Down') OR
EVE1.eve_DateTime AS eve_DateTimeConnection, EVE2.eveEventType IS NULL THEN EVE2.eveEventType ELSE '<missing event>' END AS eveEventTypeDisconnection,
CASE WHEN EVE2.eve_EventType IN ('Disconnected', 'Device Down') OR CASE WHEN EVE2.eveEventType IN ('Disconnected', 'Device Down') THEN EVE2.eveDateTime ELSE NULL END AS eveDateTimeDisconnection,
EVE2.eve_EventType IS NULL THEN EVE2.eve_EventType ELSE '<missing event>' END AS eve_EventTypeDisconnection, CASE WHEN EVE2.eveEventType IS NULL THEN 1 ELSE 0 END AS eveStillConnected,
CASE WHEN EVE2.eve_EventType IN ('Disconnected', 'Device Down') THEN EVE2.eve_DateTime ELSE NULL END AS eve_DateTimeDisconnection, EVE1.eveAdditionalInfo
CASE WHEN EVE2.eve_EventType IS NULL THEN 1 ELSE 0 END AS eve_StillConnected,
EVE1.eve_AdditionalInfo
FROM Events AS EVE1 FROM Events AS EVE1
LEFT JOIN LEFT JOIN
Events AS EVE2 ON EVE1.eve_PairEventRowID = EVE2.RowID Events AS EVE2 ON EVE1.evePairEventRowid = EVE2.RowID
WHERE EVE1.eve_EventType IN ('New Device', 'Connected','Down Reconnected') WHERE EVE1.eveEventType IN ('New Device', 'Connected','Down Reconnected')
UNION UNION
SELECT eve_MAC, SELECT eveMac,
eve_IP, eveIp,
'<missing event>' AS eve_EventTypeConnection, '<missing event>' AS eveEventTypeConnection,
NULL AS eve_DateTimeConnection, NULL AS eveDateTimeConnection,
eve_EventType AS eve_EventTypeDisconnection, eveEventType AS eveEventTypeDisconnection,
eve_DateTime AS eve_DateTimeDisconnection, eveDateTime AS eveDateTimeDisconnection,
0 AS eve_StillConnected, 0 AS eveStillConnected,
eve_AdditionalInfo eveAdditionalInfo
FROM Events AS EVE1 FROM Events AS EVE1
WHERE (eve_EventType = 'Device Down' OR WHERE (eveEventType = 'Device Down' OR
eve_EventType = 'Disconnected') AND eveEventType = 'Disconnected') AND
EVE1.eve_PairEventRowID IS NULL EVE1.evePairEventRowid IS NULL;
/* Convert_Events_to_Sessions(eve_MAC,eve_IP,eve_EventTypeConnection,eve_DateTimeConnection,eve_EventTypeDisconnection,eve_DateTimeDisconnection,eve_StillConnected,eve_AdditionalInfo) */;
CREATE TRIGGER "trg_insert_devices"
AFTER INSERT ON "Devices"
WHEN NOT EXISTS (
SELECT 1 FROM AppEvents
WHERE AppEventProcessed = 0
AND ObjectType = 'Devices'
AND ObjectGUID = NEW.devGUID
AND ObjectStatus = CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END
AND AppEventType = 'insert'
)
BEGIN
INSERT INTO "AppEvents" (
"GUID",
"DateTimeCreated",
"AppEventProcessed",
"ObjectType",
"ObjectGUID",
"ObjectPrimaryID",
"ObjectSecondaryID",
"ObjectStatus",
"ObjectStatusColumn",
"ObjectIsNew",
"ObjectIsArchived",
"ObjectForeignKey",
"ObjectPlugin",
"AppEventType"
)
VALUES (
lower(
hex(randomblob(4)) || '-' || hex(randomblob(2)) || '-' || '4' ||
substr(hex( randomblob(2)), 2) || '-' ||
substr('AB89', 1 + (abs(random()) % 4) , 1) ||
substr(hex(randomblob(2)), 2) || '-' ||
hex(randomblob(6))
)
,
DATETIME('now'),
FALSE,
'Devices',
NEW.devGUID, -- ObjectGUID
NEW.devMac, -- ObjectPrimaryID
NEW.devLastIP, -- ObjectSecondaryID
CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END, -- ObjectStatus
'devPresentLastScan', -- ObjectStatusColumn
NEW.devIsNew, -- ObjectIsNew
NEW.devIsArchived, -- ObjectIsArchived
NEW.devGUID, -- ObjectForeignKey
'DEVICES', -- ObjectForeignKey
'insert'
);
END;
CREATE TRIGGER "trg_update_devices"
AFTER UPDATE ON "Devices"
WHEN NOT EXISTS (
SELECT 1 FROM AppEvents
WHERE AppEventProcessed = 0
AND ObjectType = 'Devices'
AND ObjectGUID = NEW.devGUID
AND ObjectStatus = CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END
AND AppEventType = 'update'
)
BEGIN
INSERT INTO "AppEvents" (
"GUID",
"DateTimeCreated",
"AppEventProcessed",
"ObjectType",
"ObjectGUID",
"ObjectPrimaryID",
"ObjectSecondaryID",
"ObjectStatus",
"ObjectStatusColumn",
"ObjectIsNew",
"ObjectIsArchived",
"ObjectForeignKey",
"ObjectPlugin",
"AppEventType"
)
VALUES (
lower(
hex(randomblob(4)) || '-' || hex(randomblob(2)) || '-' || '4' ||
substr(hex( randomblob(2)), 2) || '-' ||
substr('AB89', 1 + (abs(random()) % 4) , 1) ||
substr(hex(randomblob(2)), 2) || '-' ||
hex(randomblob(6))
)
,
DATETIME('now'),
FALSE,
'Devices',
NEW.devGUID, -- ObjectGUID
NEW.devMac, -- ObjectPrimaryID
NEW.devLastIP, -- ObjectSecondaryID
CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END, -- ObjectStatus
'devPresentLastScan', -- ObjectStatusColumn
NEW.devIsNew, -- ObjectIsNew
NEW.devIsArchived, -- ObjectIsArchived
NEW.devGUID, -- ObjectForeignKey
'DEVICES', -- ObjectForeignKey
'update'
);
END;
CREATE TRIGGER "trg_delete_devices"
AFTER DELETE ON "Devices"
WHEN NOT EXISTS (
SELECT 1 FROM AppEvents
WHERE AppEventProcessed = 0
AND ObjectType = 'Devices'
AND ObjectGUID = OLD.devGUID
AND ObjectStatus = CASE WHEN OLD.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END
AND AppEventType = 'delete'
)
BEGIN
INSERT INTO "AppEvents" (
"GUID",
"DateTimeCreated",
"AppEventProcessed",
"ObjectType",
"ObjectGUID",
"ObjectPrimaryID",
"ObjectSecondaryID",
"ObjectStatus",
"ObjectStatusColumn",
"ObjectIsNew",
"ObjectIsArchived",
"ObjectForeignKey",
"ObjectPlugin",
"AppEventType"
)
VALUES (
lower(
hex(randomblob(4)) || '-' || hex(randomblob(2)) || '-' || '4' ||
substr(hex( randomblob(2)), 2) || '-' ||
substr('AB89', 1 + (abs(random()) % 4) , 1) ||
substr(hex(randomblob(2)), 2) || '-' ||
hex(randomblob(6))
)
,
DATETIME('now'),
FALSE,
'Devices',
OLD.devGUID, -- ObjectGUID
OLD.devMac, -- ObjectPrimaryID
OLD.devLastIP, -- ObjectSecondaryID
CASE WHEN OLD.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END, -- ObjectStatus
'devPresentLastScan', -- ObjectStatusColumn
OLD.devIsNew, -- ObjectIsNew
OLD.devIsArchived, -- ObjectIsArchived
OLD.devGUID, -- ObjectForeignKey
'DEVICES', -- ObjectForeignKey
'delete'
);
END;

View File

@@ -29,10 +29,10 @@ class SafeConditionBuilder:
# Whitelist of allowed column names for filtering # Whitelist of allowed column names for filtering
ALLOWED_COLUMNS = { ALLOWED_COLUMNS = {
"eve_MAC", "eveMac",
"eve_DateTime", "eveDateTime",
"eve_IP", "eveIp",
"eve_EventType", "eveEventType",
"devName", "devName",
"devComments", "devComments",
"devLastIP", "devLastIP",
@@ -43,15 +43,15 @@ class SafeConditionBuilder:
"devPresentLastScan", "devPresentLastScan",
"devFavorite", "devFavorite",
"devIsNew", "devIsNew",
"Plugin", "plugin",
"Object_PrimaryId", "objectPrimaryId",
"Object_SecondaryId", "objectSecondaryId",
"DateTimeChanged", "dateTimeChanged",
"Watched_Value1", "watchedValue1",
"Watched_Value2", "watchedValue2",
"Watched_Value3", "watchedValue3",
"Watched_Value4", "watchedValue4",
"Status", "status",
} }
# Whitelist of allowed comparison operators # Whitelist of allowed comparison operators
@@ -413,7 +413,7 @@ class SafeConditionBuilder:
This method handles basic patterns like: This method handles basic patterns like:
- devName = 'value' (with optional AND/OR prefix) - devName = 'value' (with optional AND/OR prefix)
- devComments LIKE '%value%' - devComments LIKE '%value%'
- eve_EventType IN ('type1', 'type2') - eveEventType IN ('type1', 'type2')
Args: Args:
condition: Single condition string to parse condition: Single condition string to parse
@@ -648,7 +648,7 @@ class SafeConditionBuilder:
self.parameters[param_name] = event_type self.parameters[param_name] = event_type
param_names.append(f":{param_name}") param_names.append(f":{param_name}")
sql_snippet = f"AND eve_EventType IN ({', '.join(param_names)})" sql_snippet = f"AND eveEventType IN ({', '.join(param_names)})"
return sql_snippet, self.parameters return sql_snippet, self.parameters
def get_safe_condition_legacy( def get_safe_condition_legacy(

View File

@@ -27,7 +27,7 @@ from messaging.in_app import write_notification
# =============================================================================== # ===============================================================================
_LANGUAGES_JSON = os.path.join( _LANGUAGES_JSON = os.path.join(
applicationPath, "front", "php", "templates", "language", "language_definitions" ,"languages.json" applicationPath, "front", "php", "templates", "language", "language_definitions", "languages.json"
) )
@@ -204,6 +204,9 @@ def importConfigs(pm, db, all_plugins):
# rename settings that have changed names due to code cleanup and migration to plugins # rename settings that have changed names due to code cleanup and migration to plugins
# renameSettings(config_file) # renameSettings(config_file)
# rename legacy DB column references in user config values (e.g. templates, WATCH lists)
renameColumnReferences(config_file)
fileModifiedTime = os.path.getmtime(config_file) fileModifiedTime = os.path.getmtime(config_file)
mylog("debug", ["[Import Config] checking config file "]) mylog("debug", ["[Import Config] checking config file "])
@@ -582,7 +585,7 @@ def importConfigs(pm, db, all_plugins):
# bulk-import language strings # bulk-import language strings
sql.executemany( sql.executemany(
"""INSERT INTO Plugins_Language_Strings ("Language_Code", "String_Key", "String_Value", "Extra") VALUES (?, ?, ?, ?)""", """INSERT INTO Plugins_Language_Strings (languageCode, stringKey, stringValue, extra) VALUES (?, ?, ?, ?)""",
stringSqlParams, stringSqlParams,
) )
@@ -845,3 +848,85 @@ def renameSettings(config_file):
else: else:
mylog("debug", "[Config] No old setting names found in the file. No changes made.") mylog("debug", "[Config] No old setting names found in the file. No changes made.")
# -------------------------------------------------------------------------------
# Rename legacy DB column names in user-persisted config values (templates, WATCH lists, etc.)
# Follows the same backup-and-replace pattern as renameSettings().
_column_replacements = {
# Event columns
r"\beve_MAC\b": "eveMac",
r"\beve_IP\b": "eveIp",
r"\beve_DateTime\b": "eveDateTime",
r"\beve_EventType\b": "eveEventType",
r"\beve_AdditionalInfo\b": "eveAdditionalInfo",
r"\beve_PendingAlertEmail\b": "evePendingAlertEmail",
r"\beve_PairEventRowid\b": "evePairEventRowid",
r"\beve_PairEventRowID\b": "evePairEventRowid",
# Session columns
r"\bses_MAC\b": "sesMac",
r"\bses_IP\b": "sesIp",
r"\bses_DateTimeConnection\b": "sesDateTimeConnection",
r"\bses_DateTimeDisconnection\b": "sesDateTimeDisconnection",
r"\bses_EventTypeConnection\b": "sesEventTypeConnection",
r"\bses_EventTypeDisconnection\b": "sesEventTypeDisconnection",
r"\bses_StillConnected\b": "sesStillConnected",
r"\bses_AdditionalInfo\b": "sesAdditionalInfo",
# Plugin columns (templates + WATCH values)
r"\bObject_PrimaryID\b": "objectPrimaryId",
r"\bObject_PrimaryId\b": "objectPrimaryId",
r"\bObjectPrimaryID\b": "objectPrimaryId",
r"\bObject_SecondaryID\b": "objectSecondaryId",
r"\bObject_SecondaryId\b": "objectSecondaryId",
r"\bObjectSecondaryID\b": "objectSecondaryId",
r"\bWatched_Value1\b": "watchedValue1",
r"\bWatched_Value2\b": "watchedValue2",
r"\bWatched_Value3\b": "watchedValue3",
r"\bWatched_Value4\b": "watchedValue4",
r"\bDateTimeChanged\b": "dateTimeChanged",
r"\bDateTimeCreated\b": "dateTimeCreated",
r"\bSyncHubNodeName\b": "syncHubNodeName",
# Online_History (in case of API_CUSTOM_SQL)
r"\bScan_Date\b": "scanDate",
r"\bOnline_Devices\b": "onlineDevices",
r"\bDown_Devices\b": "downDevices",
r"\bAll_Devices\b": "allDevices",
r"\bArchived_Devices\b": "archivedDevices",
r"\bOffline_Devices\b": "offlineDevices",
# Language strings (unlikely in user config but thorough)
r"\bLanguage_Code\b": "languageCode",
r"\bString_Key\b": "stringKey",
r"\bString_Value\b": "stringValue",
}
def renameColumnReferences(config_file):
"""Rename legacy DB column references in the user's app.conf file."""
contains_old_refs = False
with open(str(config_file), "r") as f:
for line in f:
if any(re.search(key, line) for key in _column_replacements):
mylog("debug", f"[Config] Old column reference found: ({line.strip()})")
contains_old_refs = True
break
if not contains_old_refs:
mylog("debug", "[Config] No old column references found in config. No changes made.")
return
timestamp = timeNowUTC(as_string=False).strftime("%Y%m%d%H%M%S")
backup_file = f"{config_file}_old_column_names_{timestamp}.bak"
mylog("none", f"[Config] Renaming legacy column references — backup: {backup_file}")
shutil.copy(str(config_file), backup_file)
with (
open(str(config_file), "r") as original,
open(str(config_file) + "_temp", "w") as temp,
):
for line in original:
for pattern, replacement in _column_replacements.items():
line = re.sub(pattern, replacement, line)
temp.write(line)
shutil.move(str(config_file) + "_temp", str(config_file))

View File

@@ -0,0 +1,140 @@
# -------------------------------------------------------------------------------
# notification_sections.py — Single source of truth for notification section
# metadata: titles, SQL templates, datetime fields, and section ordering.
#
# Both reporting.py and notification_instance.py import from here.
# -------------------------------------------------------------------------------
# Canonical processing order
SECTION_ORDER = [
"new_devices",
"down_devices",
"down_reconnected",
"events",
"plugins",
]
# Section display titles (used in text + HTML notifications)
SECTION_TITLES = {
"new_devices": "🆕 New devices",
"down_devices": "🔴 Down devices",
"down_reconnected": "🔁 Reconnected down devices",
"events": "⚡ Events",
"plugins": "🔌 Plugins",
}
# Which column(s) contain datetime values per section (for timezone conversion)
DATETIME_FIELDS = {
"new_devices": ["eveDateTime"],
"down_devices": ["eveDateTime"],
"down_reconnected": ["eveDateTime"],
"events": ["eveDateTime"],
"plugins": ["dateTimeChanged"],
}
# ---------------------------------------------------------------------------
# SQL templates
#
# All device sections use unified DB column names so the JSON output
# has consistent field names across new_devices, down_devices,
# down_reconnected, and events.
#
# Placeholders:
# {condition} — optional WHERE clause appended by condition builder
# {alert_down_minutes} — runtime value, only used by down_devices
# ---------------------------------------------------------------------------
SQL_TEMPLATES = {
"new_devices": """
SELECT
devName,
eveMac,
devVendor,
devLastIP as eveIp,
eveDateTime,
eveEventType,
devComments
FROM Events_Devices
WHERE evePendingAlertEmail = 1
AND eveEventType = 'New Device' {condition}
ORDER BY eveDateTime
""",
"down_devices": """
SELECT
devName,
eveMac,
devVendor,
eveIp,
eveDateTime,
eveEventType,
devComments
FROM Events_Devices AS down_events
WHERE evePendingAlertEmail = 1
AND down_events.eveEventType = 'Device Down'
AND eveDateTime < datetime('now', '-{alert_down_minutes} minutes')
AND NOT EXISTS (
SELECT 1
FROM Events AS connected_events
WHERE connected_events.eveMac = down_events.eveMac
AND connected_events.eveEventType = 'Connected'
AND connected_events.eveDateTime > down_events.eveDateTime
)
ORDER BY down_events.eveDateTime
""",
"down_reconnected": """
SELECT
devName,
reconnected_devices.eveMac,
devVendor,
reconnected_devices.eveIp,
reconnected_devices.eveDateTime,
reconnected_devices.eveEventType,
devComments
FROM Events_Devices AS reconnected_devices
WHERE reconnected_devices.eveEventType = 'Down Reconnected'
AND reconnected_devices.evePendingAlertEmail = 1
AND NOT EXISTS (
SELECT 1 FROM Events AS newer
WHERE newer.eveMac = reconnected_devices.eveMac
AND newer.eveEventType = 'Down Reconnected'
AND newer.evePendingAlertEmail = 1
AND newer.eveDateTime > reconnected_devices.eveDateTime
)
ORDER BY reconnected_devices.eveDateTime
""",
"events": """
SELECT
devName,
eveMac,
devVendor,
devLastIP as eveIp,
eveDateTime,
eveEventType,
devComments
FROM Events_Devices
WHERE evePendingAlertEmail = 1
AND eveEventType IN ({event_types}) {condition}
ORDER BY eveDateTime
""",
"plugins": """
SELECT
plugin,
objectPrimaryId,
objectSecondaryId,
dateTimeChanged,
watchedValue1,
watchedValue2,
watchedValue3,
watchedValue4,
status
FROM Plugins_Events
""",
}
# Sections that support user-defined condition filters
SECTIONS_WITH_CONDITIONS = {"new_devices", "events"}
# Legacy setting key mapping for condition filters
SECTION_CONDITION_MAP = {
"new_devices": "NTFPRCS_new_dev_condition",
"events": "NTFPRCS_event_condition",
}

View File

@@ -25,20 +25,20 @@ from helper import ( # noqa: E402 [flake8 lint suppression]
from logger import mylog # noqa: E402 [flake8 lint suppression] from logger import mylog # noqa: E402 [flake8 lint suppression]
from db.sql_safe_builder import create_safe_condition_builder # noqa: E402 [flake8 lint suppression] from db.sql_safe_builder import create_safe_condition_builder # noqa: E402 [flake8 lint suppression]
from utils.datetime_utils import format_date_iso # noqa: E402 [flake8 lint suppression] from utils.datetime_utils import format_date_iso # noqa: E402 [flake8 lint suppression]
from messaging.notification_sections import ( # noqa: E402 [flake8 lint suppression]
SECTION_ORDER,
SECTION_TITLES,
DATETIME_FIELDS,
SQL_TEMPLATES,
SECTIONS_WITH_CONDITIONS,
SECTION_CONDITION_MAP,
)
import conf # noqa: E402 [flake8 lint suppression] import conf # noqa: E402 [flake8 lint suppression]
# =============================================================================== # ===============================================================================
# Timezone conversion # Timezone conversion
# =============================================================================== # ===============================================================================
DATETIME_FIELDS = {
"new_devices": ["Datetime"],
"down_devices": ["eve_DateTime"],
"down_reconnected": ["eve_DateTime"],
"events": ["Datetime"],
"plugins": ["DateTimeChanged"],
}
def get_datetime_fields_from_columns(column_names): def get_datetime_fields_from_columns(column_names):
return [ return [
@@ -114,16 +114,16 @@ def get_notifications(db):
# Disable events where reporting is disabled # Disable events where reporting is disabled
sql.execute(""" sql.execute("""
UPDATE Events SET eve_PendingAlertEmail = 0 UPDATE Events SET evePendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
AND eve_EventType NOT IN ('Device Down', 'Down Reconnected', 'New Device') AND eveEventType NOT IN ('Device Down', 'Down Reconnected', 'New Device')
AND eve_MAC IN (SELECT devMac FROM Devices WHERE devAlertEvents = 0) AND eveMac IN (SELECT devMac FROM Devices WHERE devAlertEvents = 0)
""") """)
sql.execute(""" sql.execute("""
UPDATE Events SET eve_PendingAlertEmail = 0 UPDATE Events SET evePendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
AND eve_EventType IN ('Device Down', 'Down Reconnected') AND eveEventType IN ('Device Down', 'Down Reconnected')
AND eve_MAC IN (SELECT devMac FROM Devices WHERE devAlertDown = 0) AND eveMac IN (SELECT devMac FROM Devices WHERE devAlertDown = 0)
""") """)
alert_down_minutes = int(get_setting_value("NTFPRCS_alert_down_time") or 0) alert_down_minutes = int(get_setting_value("NTFPRCS_alert_down_time") or 0)
@@ -157,103 +157,15 @@ def get_notifications(db):
return "" return ""
# ------------------------- # SQL templates with placeholders for runtime values
# SQL templates # {condition} and {alert_down_minutes} are formatted at query time
# -------------------------
sql_templates = {
"new_devices": """
SELECT
eve_MAC as MAC,
eve_DateTime as Datetime,
devLastIP as IP,
eve_EventType as "Event Type",
devName as "Device name",
devComments as Comments
FROM Events_Devices
WHERE eve_PendingAlertEmail = 1
AND eve_EventType = 'New Device' {condition}
ORDER BY eve_DateTime
""",
"down_devices": f"""
SELECT
devName,
eve_MAC,
devVendor,
eve_IP,
eve_DateTime,
eve_EventType
FROM Events_Devices AS down_events
WHERE eve_PendingAlertEmail = 1
AND down_events.eve_EventType = 'Device Down'
AND eve_DateTime < datetime('now', '-{alert_down_minutes} minutes')
AND NOT EXISTS (
SELECT 1
FROM Events AS connected_events
WHERE connected_events.eve_MAC = down_events.eve_MAC
AND connected_events.eve_EventType = 'Connected'
AND connected_events.eve_DateTime > down_events.eve_DateTime
)
ORDER BY down_events.eve_DateTime
""",
"down_reconnected": """
SELECT
devName,
eve_MAC,
devVendor,
eve_IP,
eve_DateTime,
eve_EventType
FROM Events_Devices AS reconnected_devices
WHERE reconnected_devices.eve_EventType = 'Down Reconnected'
AND reconnected_devices.eve_PendingAlertEmail = 1
ORDER BY reconnected_devices.eve_DateTime
""",
"events": """
SELECT
eve_MAC as MAC,
eve_DateTime as Datetime,
devLastIP as IP,
eve_EventType as "Event Type",
devName as "Device name",
devComments as Comments
FROM Events_Devices
WHERE eve_PendingAlertEmail = 1
AND eve_EventType IN ('Connected', 'Down Reconnected', 'Disconnected','IP Changed') {condition}
ORDER BY eve_DateTime
""",
"plugins": """
SELECT
Plugin,
Object_PrimaryId,
Object_SecondaryId,
DateTimeChanged,
Watched_Value1,
Watched_Value2,
Watched_Value3,
Watched_Value4,
Status
FROM Plugins_Events
"""
}
# Titles for metadata
section_titles = {
"new_devices": "🆕 New devices",
"down_devices": "🔴 Down devices",
"down_reconnected": "🔁 Reconnected down devices",
"events": "⚡ Events",
"plugins": "🔌 Plugins"
}
# Sections that support dynamic conditions
sections_with_conditions = {"new_devices", "events"}
# Initialize final structure # Initialize final structure
final_json = {} final_json = {}
for section in ["new_devices", "down_devices", "down_reconnected", "events", "plugins"]: for section in SECTION_ORDER:
final_json[section] = [] final_json[section] = []
final_json[f"{section}_meta"] = { final_json[f"{section}_meta"] = {
"title": section_titles.get(section, section), "title": SECTION_TITLES.get(section, section),
"columnNames": [] "columnNames": []
} }
@@ -262,17 +174,8 @@ def get_notifications(db):
# ------------------------- # -------------------------
# Main loop # Main loop
# ------------------------- # -------------------------
condition_builder = create_safe_condition_builder()
SECTION_CONDITION_MAP = {
"new_devices": "NTFPRCS_new_dev_condition",
"events": "NTFPRCS_event_condition",
}
sections_with_conditions = set(SECTION_CONDITION_MAP.keys())
for section in sections: for section in sections:
template = sql_templates.get(section) template = SQL_TEMPLATES.get(section)
if not template: if not template:
mylog("verbose", ["[Notification] Unknown section: ", section]) mylog("verbose", ["[Notification] Unknown section: ", section])
@@ -282,7 +185,7 @@ def get_notifications(db):
parameters = {} parameters = {}
try: try:
if section in sections_with_conditions: if section in SECTIONS_WITH_CONDITIONS:
condition_key = SECTION_CONDITION_MAP.get(section) condition_key = SECTION_CONDITION_MAP.get(section)
condition_setting = get_setting_value(condition_key) condition_setting = get_setting_value(condition_key)
@@ -291,11 +194,31 @@ def get_notifications(db):
condition_setting condition_setting
) )
sqlQuery = template.format(condition=safe_condition) # Format template with runtime placeholders
format_vars = {"condition": safe_condition}
if section == "down_devices":
format_vars["alert_down_minutes"] = alert_down_minutes
if section == "events":
# 'Down Reconnected' has its own dedicated section; exclude it
# from events when that section is also active to prevent the
# same device appearing twice with different IP sources.
if "down_reconnected" in sections:
format_vars["event_types"] = "'Connected', 'Disconnected','IP Changed'"
else:
format_vars["event_types"] = "'Connected', 'Down Reconnected', 'Disconnected','IP Changed'"
sqlQuery = template.format(**format_vars)
except Exception as e: except Exception as e:
mylog("verbose", [f"[Notification] Error building condition for {section}: ", e]) mylog("verbose", [f"[Notification] Error building condition for {section}: ", e])
sqlQuery = template.format(condition="") fallback_vars = {"condition": ""}
if section == "down_devices":
fallback_vars["alert_down_minutes"] = alert_down_minutes
if section == "events":
if "down_reconnected" in sections:
fallback_vars["event_types"] = "'Connected', 'Disconnected','IP Changed'"
else:
fallback_vars["event_types"] = "'Connected', 'Down Reconnected', 'Disconnected','IP Changed'"
sqlQuery = template.format(**fallback_vars)
parameters = {} parameters = {}
mylog("debug", [f"[Notification] {section} SQL query: ", sqlQuery]) mylog("debug", [f"[Notification] {section} SQL query: ", sqlQuery])
@@ -309,7 +232,7 @@ def get_notifications(db):
final_json[section] = json_obj.json.get("data", []) final_json[section] = json_obj.json.get("data", [])
final_json[f"{section}_meta"] = { final_json[f"{section}_meta"] = {
"title": section_titles.get(section, section), "title": SECTION_TITLES.get(section, section),
"columnNames": getattr(json_obj, "columnNames", []) "columnNames": getattr(json_obj, "columnNames", [])
} }
@@ -323,7 +246,7 @@ def skip_repeated_notifications(db):
""" """
Skips sending alerts for devices recently notified. Skips sending alerts for devices recently notified.
Clears `eve_PendingAlertEmail` for events linked to devices whose last Clears `evePendingAlertEmail` for events linked to devices whose last
notification time is within their `devSkipRepeated` interval. notification time is within their `devSkipRepeated` interval.
Args: Args:
@@ -334,8 +257,8 @@ def skip_repeated_notifications(db):
# due strfime : Overflow --> use "strftime / 60" # due strfime : Overflow --> use "strftime / 60"
mylog("verbose", "[Skip Repeated Notifications] Skip Repeated") mylog("verbose", "[Skip Repeated Notifications] Skip Repeated")
db.sql.execute("""UPDATE Events SET eve_PendingAlertEmail = 0 db.sql.execute("""UPDATE Events SET evePendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 AND eve_MAC IN WHERE evePendingAlertEmail = 1 AND eveMac IN
( (
SELECT devMac FROM Devices SELECT devMac FROM Devices
WHERE devLastNotification IS NOT NULL WHERE devLastNotification IS NOT NULL

View File

@@ -142,17 +142,17 @@ class DeviceInstance:
objs = PluginObjectInstance().getByField( objs = PluginObjectInstance().getByField(
plugPrefix='NMAP', plugPrefix='NMAP',
matchedColumn='Object_PrimaryID', matchedColumn='objectPrimaryId',
matchedKey=primary, matchedKey=primary,
returnFields=['Object_SecondaryID', 'Watched_Value2'] returnFields=['objectSecondaryId', 'watchedValue2']
) )
ports = [] ports = []
for o in objs: for o in objs:
port = int(o.get('Object_SecondaryID') or 0) port = int(o.get('objectSecondaryId') or 0)
ports.append({"port": port, "service": o.get('Watched_Value2', '')}) ports.append({"port": port, "service": o.get('watchedValue2', '')})
return ports return ports
@@ -327,20 +327,30 @@ class DeviceInstance:
return {"success": True, "inserted": row_count, "skipped_lines": skipped} return {"success": True, "inserted": row_count, "skipped_lines": skipped}
def getTotals(self): def getTotals(self):
"""Get device totals by status.""" """Get device totals by status.
Returns a list of 6 counts in the documented positional order:
[all, connected, favorites, new, down, archived]
IMPORTANT: This order is a public API contract consumed by:
- presence.php (reads indices 0-5)
- /devices/totals/named (maps indices 0-5 to named fields)
- homepage widget datav2 (reads /devices/totals indices)
DO NOT change the order or add/remove fields without a breaking-change release.
"""
conn = get_temp_db_connection() conn = get_temp_db_connection()
sql = conn.cursor() sql = conn.cursor()
conditions = get_device_conditions() all_conditions = get_device_conditions()
# Build sub-selects dynamically for all dictionary entries # Only the 6 public fields, in documented positional order.
sub_queries = [] # DO NOT change this order — it is a stable API contract.
for key, condition in conditions.items(): keys = ["all", "connected", "favorites", "new", "down", "archived"]
# Make sure the alias is SQL-safe (no spaces or special chars) sub_queries = [
alias = key.replace(" ", "_").lower() f'(SELECT COUNT(*) FROM DevicesView {all_conditions[key]}) AS "{key}"'
sub_queries.append(f'(SELECT COUNT(*) FROM DevicesView {condition}) AS "{alias}"') for key in keys
]
# Join all sub-selects with commas
query = "SELECT\n " + ",\n ".join(sub_queries) query = "SELECT\n " + ",\n ".join(sub_queries)
sql.execute(query) sql.execute(query)
row = sql.fetchone() row = sql.fetchone()
@@ -471,31 +481,31 @@ class DeviceInstance:
LOWER(d.devParentMAC) AS devParentMAC, LOWER(d.devParentMAC) AS devParentMAC,
(SELECT COUNT(*) FROM Sessions (SELECT COUNT(*) FROM Sessions
WHERE LOWER(ses_MAC) = LOWER(d.devMac) AND ( WHERE LOWER(sesMac) = LOWER(d.devMac) AND (
ses_DateTimeConnection >= {period_date_sql} OR sesDateTimeConnection >= {period_date_sql} OR
ses_DateTimeDisconnection >= {period_date_sql} OR sesDateTimeDisconnection >= {period_date_sql} OR
ses_StillConnected = 1 sesStillConnected = 1
)) AS devSessions, )) AS devSessions,
(SELECT COUNT(*) FROM Events (SELECT COUNT(*) FROM Events
WHERE LOWER(eve_MAC) = LOWER(d.devMac) AND eve_DateTime >= {period_date_sql} WHERE LOWER(eveMac) = LOWER(d.devMac) AND eveDateTime >= {period_date_sql}
AND eve_EventType NOT IN ('Connected','Disconnected')) AS devEvents, AND eveEventType NOT IN ('Connected','Disconnected')) AS devEvents,
(SELECT COUNT(*) FROM Events (SELECT COUNT(*) FROM Events
WHERE LOWER(eve_MAC) = LOWER(d.devMac) AND eve_DateTime >= {period_date_sql} WHERE LOWER(eveMac) = LOWER(d.devMac) AND eveDateTime >= {period_date_sql}
AND eve_EventType = 'Device Down') AS devDownAlerts, AND eveEventType = 'Device Down') AS devDownAlerts,
(SELECT CAST(MAX(0, SUM( (SELECT CAST(MAX(0, SUM(
julianday(IFNULL(ses_DateTimeDisconnection,'{now}')) - julianday(IFNULL(sesDateTimeDisconnection,'{now}')) -
julianday(CASE WHEN ses_DateTimeConnection < {period_date_sql} julianday(CASE WHEN sesDateTimeConnection < {period_date_sql}
THEN {period_date_sql} ELSE ses_DateTimeConnection END) THEN {period_date_sql} ELSE sesDateTimeConnection END)
) * 24) AS INT) ) * 24) AS INT)
FROM Sessions FROM Sessions
WHERE LOWER(ses_MAC) = LOWER(d.devMac) WHERE LOWER(sesMac) = LOWER(d.devMac)
AND ses_DateTimeConnection IS NOT NULL AND sesDateTimeConnection IS NOT NULL
AND (ses_DateTimeDisconnection IS NOT NULL OR ses_StillConnected = 1) AND (sesDateTimeDisconnection IS NOT NULL OR sesStillConnected = 1)
AND (ses_DateTimeConnection >= {period_date_sql} AND (sesDateTimeConnection >= {period_date_sql}
OR ses_DateTimeDisconnection >= {period_date_sql} OR ses_StillConnected = 1) OR sesDateTimeDisconnection >= {period_date_sql} OR sesStillConnected = 1)
) AS devPresenceHours ) AS devPresenceHours
FROM DevicesView d FROM DevicesView d
@@ -797,7 +807,7 @@ class DeviceInstance:
"""Delete all events for a device.""" """Delete all events for a device."""
conn = get_temp_db_connection() conn = get_temp_db_connection()
cur = conn.cursor() cur = conn.cursor()
cur.execute("DELETE FROM Events WHERE eve_MAC=?", (mac,)) cur.execute("DELETE FROM Events WHERE eveMac=?", (mac,))
conn.commit() conn.commit()
conn.close() conn.close()
return {"success": True} return {"success": True}

View File

@@ -21,7 +21,7 @@ class EventInstance:
def get_all(self): def get_all(self):
conn = self._conn() conn = self._conn()
rows = conn.execute( rows = conn.execute(
"SELECT * FROM Events ORDER BY eve_DateTime DESC" "SELECT * FROM Events ORDER BY eveDateTime DESC"
).fetchall() ).fetchall()
conn.close() conn.close()
return self._rows_to_list(rows) return self._rows_to_list(rows)
@@ -31,7 +31,7 @@ class EventInstance:
conn = self._conn() conn = self._conn()
rows = conn.execute(""" rows = conn.execute("""
SELECT * FROM Events SELECT * FROM Events
ORDER BY eve_DateTime DESC ORDER BY eveDateTime DESC
LIMIT ? LIMIT ?
""", (n,)).fetchall() """, (n,)).fetchall()
conn.close() conn.close()
@@ -47,8 +47,8 @@ class EventInstance:
conn = self._conn() conn = self._conn()
rows = conn.execute(""" rows = conn.execute("""
SELECT * FROM Events SELECT * FROM Events
WHERE eve_DateTime >= ? WHERE eveDateTime >= ?
ORDER BY eve_DateTime DESC ORDER BY eveDateTime DESC
""", (since,)).fetchall() """, (since,)).fetchall()
conn.close() conn.close()
return self._rows_to_list(rows) return self._rows_to_list(rows)
@@ -63,8 +63,8 @@ class EventInstance:
conn = self._conn() conn = self._conn()
rows = conn.execute(""" rows = conn.execute("""
SELECT * FROM Events SELECT * FROM Events
WHERE eve_DateTime >= ? WHERE eveDateTime >= ?
ORDER BY eve_DateTime DESC ORDER BY eveDateTime DESC
""", (since,)).fetchall() """, (since,)).fetchall()
conn.close() conn.close()
return self._rows_to_list(rows) return self._rows_to_list(rows)
@@ -78,8 +78,8 @@ class EventInstance:
conn = self._conn() conn = self._conn()
rows = conn.execute(""" rows = conn.execute("""
SELECT * FROM Events SELECT * FROM Events
WHERE eve_DateTime BETWEEN ? AND ? WHERE eveDateTime BETWEEN ? AND ?
ORDER BY eve_DateTime DESC ORDER BY eveDateTime DESC
""", (start, end)).fetchall() """, (start, end)).fetchall()
conn.close() conn.close()
return self._rows_to_list(rows) return self._rows_to_list(rows)
@@ -89,9 +89,9 @@ class EventInstance:
conn = self._conn() conn = self._conn()
conn.execute(""" conn.execute("""
INSERT OR IGNORE INTO Events ( INSERT OR IGNORE INTO Events (
eve_MAC, eve_IP, eve_DateTime, eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail, eve_PairEventRowid evePendingAlertEmail, evePairEventRowid
) VALUES (?,?,?,?,?,?,?) ) VALUES (?,?,?,?,?,?,?)
""", (mac, ip, timeNowUTC(), eventType, info, """, (mac, ip, timeNowUTC(), eventType, info,
1 if pendingAlert else 0, pairRow)) 1 if pendingAlert else 0, pairRow))
@@ -102,7 +102,7 @@ class EventInstance:
def delete_older_than(self, days: int): def delete_older_than(self, days: int):
cutoff = timeNowUTC(as_string=False) - timedelta(days=days) cutoff = timeNowUTC(as_string=False) - timedelta(days=days)
conn = self._conn() conn = self._conn()
result = conn.execute("DELETE FROM Events WHERE eve_DateTime < ?", (cutoff,)) result = conn.execute("DELETE FROM Events WHERE eveDateTime < ?", (cutoff,))
conn.commit() conn.commit()
deleted_count = result.rowcount deleted_count = result.rowcount
conn.close() conn.close()
@@ -124,7 +124,7 @@ class EventInstance:
cur = conn.cursor() cur = conn.cursor()
cur.execute( cur.execute(
""" """
INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, eve_EventType, eve_AdditionalInfo, eve_PendingAlertEmail) INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime, eveEventType, eveAdditionalInfo, evePendingAlertEmail)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
""", """,
(mac, ip, start_time, event_type, additional_info, pending_alert), (mac, ip, start_time, event_type, additional_info, pending_alert),
@@ -145,10 +145,10 @@ class EventInstance:
cur = conn.cursor() cur = conn.cursor()
if mac: if mac:
sql = "SELECT * FROM Events WHERE eve_MAC=? ORDER BY eve_DateTime DESC" sql = "SELECT * FROM Events WHERE eveMac=? ORDER BY eveDateTime DESC"
cur.execute(sql, (mac,)) cur.execute(sql, (mac,))
else: else:
sql = "SELECT * FROM Events ORDER BY eve_DateTime DESC" sql = "SELECT * FROM Events ORDER BY eveDateTime DESC"
cur.execute(sql) cur.execute(sql)
rows = cur.fetchall() rows = cur.fetchall()
@@ -163,7 +163,7 @@ class EventInstance:
cur = conn.cursor() cur = conn.cursor()
# Use a parameterized query with sqlite date function # Use a parameterized query with sqlite date function
sql = "DELETE FROM Events WHERE eve_DateTime <= date('now', ?)" sql = "DELETE FROM Events WHERE eveDateTime <= date('now', ?)"
cur.execute(sql, [f"-{days} days"]) cur.execute(sql, [f"-{days} days"])
conn.commit() conn.commit()
@@ -197,19 +197,19 @@ class EventInstance:
sql = f""" sql = f"""
SELECT SELECT
(SELECT COUNT(*) FROM Events WHERE eve_DateTime >= {period_date_sql}) AS all_events, (SELECT COUNT(*) FROM Events WHERE eveDateTime >= {period_date_sql}) AS all_events,
(SELECT COUNT(*) FROM Sessions WHERE (SELECT COUNT(*) FROM Sessions WHERE
ses_DateTimeConnection >= {period_date_sql} sesDateTimeConnection >= {period_date_sql}
OR ses_DateTimeDisconnection >= {period_date_sql} OR sesDateTimeDisconnection >= {period_date_sql}
OR ses_StillConnected = 1 OR sesStillConnected = 1
) AS sessions, ) AS sessions,
(SELECT COUNT(*) FROM Sessions WHERE (SELECT COUNT(*) FROM Sessions WHERE
(ses_DateTimeConnection IS NULL AND ses_DateTimeDisconnection >= {period_date_sql}) (sesDateTimeConnection IS NULL AND sesDateTimeDisconnection >= {period_date_sql})
OR (ses_DateTimeDisconnection IS NULL AND ses_StillConnected = 0 AND ses_DateTimeConnection >= {period_date_sql}) OR (sesDateTimeDisconnection IS NULL AND sesStillConnected = 0 AND sesDateTimeConnection >= {period_date_sql})
) AS missing, ) AS missing,
(SELECT COUNT(*) FROM Events WHERE eve_DateTime >= {period_date_sql} AND eve_EventType LIKE 'VOIDED%') AS voided, (SELECT COUNT(*) FROM Events WHERE eveDateTime >= {period_date_sql} AND eveEventType LIKE 'VOIDED%') AS voided,
(SELECT COUNT(*) FROM Events WHERE eve_DateTime >= {period_date_sql} AND eve_EventType LIKE 'New Device') AS new, (SELECT COUNT(*) FROM Events WHERE eveDateTime >= {period_date_sql} AND eveEventType LIKE 'New Device') AS new,
(SELECT COUNT(*) FROM Events WHERE eve_DateTime >= {period_date_sql} AND eve_EventType LIKE 'Device Down') AS down (SELECT COUNT(*) FROM Events WHERE eveDateTime >= {period_date_sql} AND eveEventType LIKE 'Device Down') AS down
""" """
cur.execute(sql) cur.execute(sql)
@@ -247,11 +247,11 @@ class EventInstance:
conn = self._conn() conn = self._conn()
sql = """ sql = """
SELECT eve_MAC, COUNT(*) as event_count SELECT eveMac, COUNT(*) as event_count
FROM Events FROM Events
WHERE eve_EventType IN ('Connected','Disconnected','Device Down','Down Reconnected') WHERE eveEventType IN ('Connected','Disconnected','Device Down','Down Reconnected')
AND eve_DateTime >= datetime('now', ?) AND eveDateTime >= datetime('now', ?)
GROUP BY eve_MAC GROUP BY eveMac
HAVING COUNT(*) >= ? HAVING COUNT(*) >= ?
""" """
@@ -262,6 +262,6 @@ class EventInstance:
conn.close() conn.close()
if macs_only: if macs_only:
return {row["eve_MAC"] for row in rows} return {row["eveMac"] for row in rows}
return [dict(row) for row in rows] return [dict(row) for row in rows]

View File

@@ -17,6 +17,7 @@ from helper import (
getBuildTimeStampAndVersion, getBuildTimeStampAndVersion,
) )
from messaging.in_app import write_notification from messaging.in_app import write_notification
from messaging.notification_sections import SECTION_ORDER
from utils.datetime_utils import timeNowUTC, timeNowTZ, get_timezone_offset from utils.datetime_utils import timeNowUTC, timeNowTZ, get_timezone_offset
@@ -30,17 +31,17 @@ class NotificationInstance:
# Create Notifications table if missing # Create Notifications table if missing
self.db.sql.execute("""CREATE TABLE IF NOT EXISTS "Notifications" ( self.db.sql.execute("""CREATE TABLE IF NOT EXISTS "Notifications" (
"Index" INTEGER, "index" INTEGER,
"GUID" TEXT UNIQUE, "guid" TEXT UNIQUE,
"DateTimeCreated" TEXT, "dateTimeCreated" TEXT,
"DateTimePushed" TEXT, "dateTimePushed" TEXT,
"Status" TEXT, "status" TEXT,
"JSON" TEXT, "json" TEXT,
"Text" TEXT, "text" TEXT,
"HTML" TEXT, "html" TEXT,
"PublishedVia" TEXT, "publishedVia" TEXT,
"Extra" TEXT, "extra" TEXT,
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("index" AUTOINCREMENT)
); );
""") """)
@@ -61,12 +62,7 @@ class NotificationInstance:
write_file(logPath + "/report_output.json", json.dumps(JSON)) write_file(logPath + "/report_output.json", json.dumps(JSON))
# Check if nothing to report, end # Check if nothing to report, end
if ( self.HasNotifications = any(JSON.get(s, []) for s in SECTION_ORDER)
JSON["new_devices"] == [] and JSON["down_devices"] == [] and JSON["events"] == [] and JSON["plugins"] == [] and JSON["down_reconnected"] == []
):
self.HasNotifications = False
else:
self.HasNotifications = True
self.GUID = str(uuid.uuid4()) self.GUID = str(uuid.uuid4())
self.DateTimeCreated = timeNowUTC() self.DateTimeCreated = timeNowUTC()
@@ -130,47 +126,13 @@ class NotificationInstance:
mail_text = mail_text.replace("REPORT_DASHBOARD_URL", self.serverUrl) mail_text = mail_text.replace("REPORT_DASHBOARD_URL", self.serverUrl)
mail_html = mail_html.replace("REPORT_DASHBOARD_URL", self.serverUrl) mail_html = mail_html.replace("REPORT_DASHBOARD_URL", self.serverUrl)
# Start generating the TEXT & HTML notification messages # Generate TEXT & HTML for each notification section
# new_devices for section in SECTION_ORDER:
# --- html, text = construct_notifications(self.JSON, section)
html, text = construct_notifications(self.JSON, "new_devices") placeholder = f"{section.upper()}_TABLE"
mail_text = mail_text.replace(placeholder, text + "\n")
mail_text = mail_text.replace("NEW_DEVICES_TABLE", text + "\n") mail_html = mail_html.replace(placeholder, html)
mail_html = mail_html.replace("NEW_DEVICES_TABLE", html) mylog("verbose", [f"[Notification] {section} section done."])
mylog("verbose", ["[Notification] New Devices sections done."])
# down_devices
# ---
html, text = construct_notifications(self.JSON, "down_devices")
mail_text = mail_text.replace("DOWN_DEVICES_TABLE", text + "\n")
mail_html = mail_html.replace("DOWN_DEVICES_TABLE", html)
mylog("verbose", ["[Notification] Down Devices sections done."])
# down_reconnected
# ---
html, text = construct_notifications(self.JSON, "down_reconnected")
mail_text = mail_text.replace("DOWN_RECONNECTED_TABLE", text + "\n")
mail_html = mail_html.replace("DOWN_RECONNECTED_TABLE", html)
mylog("verbose", ["[Notification] Reconnected Down Devices sections done."])
# events
# ---
html, text = construct_notifications(self.JSON, "events")
mail_text = mail_text.replace("EVENTS_TABLE", text + "\n")
mail_html = mail_html.replace("EVENTS_TABLE", html)
mylog("verbose", ["[Notification] Events sections done."])
# plugins
# ---
html, text = construct_notifications(self.JSON, "plugins")
mail_text = mail_text.replace("PLUGINS_TABLE", text + "\n")
mail_html = mail_html.replace("PLUGINS_TABLE", html)
mylog("verbose", ["[Notification] Plugins sections done."])
final_text = removeDuplicateNewLines(mail_text) final_text = removeDuplicateNewLines(mail_text)
@@ -216,7 +178,7 @@ class NotificationInstance:
def upsert(self): def upsert(self):
self.db.sql.execute( self.db.sql.execute(
""" """
INSERT OR REPLACE INTO Notifications (GUID, DateTimeCreated, DateTimePushed, Status, JSON, Text, HTML, PublishedVia, Extra) INSERT OR REPLACE INTO Notifications (guid, dateTimeCreated, dateTimePushed, "status", "json", "text", html, publishedVia, extra)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -240,7 +202,7 @@ class NotificationInstance:
self.db.sql.execute( self.db.sql.execute(
""" """
DELETE FROM Notifications DELETE FROM Notifications
WHERE GUID = ? WHERE guid = ?
""", """,
(GUID,), (GUID,),
) )
@@ -250,7 +212,7 @@ class NotificationInstance:
def getNew(self): def getNew(self):
self.db.sql.execute(""" self.db.sql.execute("""
SELECT * FROM Notifications SELECT * FROM Notifications
WHERE Status = "new" WHERE "status" = 'new'
""") """)
return self.db.sql.fetchall() return self.db.sql.fetchall()
@@ -259,8 +221,8 @@ class NotificationInstance:
# Execute an SQL query to update the status of all notifications # Execute an SQL query to update the status of all notifications
self.db.sql.execute(""" self.db.sql.execute("""
UPDATE Notifications UPDATE Notifications
SET Status = "processed" SET "status" = 'processed'
WHERE Status = "new" WHERE "status" = 'new'
""") """)
self.save() self.save()
@@ -272,15 +234,15 @@ class NotificationInstance:
self.db.sql.execute(""" self.db.sql.execute("""
UPDATE Devices SET devLastNotification = ? UPDATE Devices SET devLastNotification = ?
WHERE devMac IN ( WHERE devMac IN (
SELECT eve_MAC FROM Events SELECT eveMac FROM Events
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
) )
""", (timeNowUTC(),)) """, (timeNowUTC(),))
self.db.sql.execute(""" self.db.sql.execute("""
UPDATE Events SET eve_PendingAlertEmail = 0 UPDATE Events SET evePendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
AND eve_EventType !='Device Down' """) AND eveEventType !='Device Down' """)
# Clear down events flag after the reporting window passed # Clear down events flag after the reporting window passed
minutes = int(get_setting_value("NTFPRCS_alert_down_time") or 0) minutes = int(get_setting_value("NTFPRCS_alert_down_time") or 0)
@@ -288,10 +250,10 @@ class NotificationInstance:
self.db.sql.execute( self.db.sql.execute(
""" """
UPDATE Events UPDATE Events
SET eve_PendingAlertEmail = 0 SET evePendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 WHERE evePendingAlertEmail = 1
AND eve_EventType = 'Device Down' AND eveEventType = 'Device Down'
AND eve_DateTime < datetime('now', ?, ?) AND eveDateTime < datetime('now', ?, ?)
""", """,
(f"-{minutes} minutes", tz_offset), (f"-{minutes} minutes", tz_offset),
) )

View File

@@ -35,18 +35,18 @@ class PluginObjectInstance:
def getByGUID(self, ObjectGUID): def getByGUID(self, ObjectGUID):
return self._fetchone( return self._fetchone(
"SELECT * FROM Plugins_Objects WHERE ObjectGUID = ?", (ObjectGUID,) "SELECT * FROM Plugins_Objects WHERE objectGuid = ?", (ObjectGUID,)
) )
def exists(self, ObjectGUID): def exists(self, ObjectGUID):
row = self._fetchone(""" row = self._fetchone("""
SELECT COUNT(*) AS count FROM Plugins_Objects WHERE ObjectGUID = ? SELECT COUNT(*) AS count FROM Plugins_Objects WHERE objectGuid = ?
""", (ObjectGUID,)) """, (ObjectGUID,))
return row["count"] > 0 if row else False return row["count"] > 0 if row else False
def getByPlugin(self, plugin): def getByPlugin(self, plugin):
return self._fetchall( return self._fetchall(
"SELECT * FROM Plugins_Objects WHERE Plugin = ?", (plugin,) "SELECT * FROM Plugins_Objects WHERE plugin = ?", (plugin,)
) )
def getLastNCreatedPerPlugin(self, plugin, entries=1): def getLastNCreatedPerPlugin(self, plugin, entries=1):
@@ -54,8 +54,8 @@ class PluginObjectInstance:
""" """
SELECT * SELECT *
FROM Plugins_Objects FROM Plugins_Objects
WHERE Plugin = ? WHERE plugin = ?
ORDER BY DateTimeCreated DESC ORDER BY dateTimeCreated DESC
LIMIT ? LIMIT ?
""", """,
(plugin, entries), (plugin, entries),
@@ -63,7 +63,7 @@ class PluginObjectInstance:
def getByField(self, plugPrefix, matchedColumn, matchedKey, returnFields=None): def getByField(self, plugPrefix, matchedColumn, matchedKey, returnFields=None):
rows = self._fetchall( rows = self._fetchall(
f"SELECT * FROM Plugins_Objects WHERE Plugin = ? AND {matchedColumn} = ?", f"SELECT * FROM Plugins_Objects WHERE plugin = ? AND {matchedColumn} = ?",
(plugPrefix, matchedKey.lower()) (plugPrefix, matchedKey.lower())
) )
@@ -75,12 +75,12 @@ class PluginObjectInstance:
def getByPrimary(self, plugin, primary_id): def getByPrimary(self, plugin, primary_id):
return self._fetchall(""" return self._fetchall("""
SELECT * FROM Plugins_Objects SELECT * FROM Plugins_Objects
WHERE Plugin = ? AND Object_PrimaryID = ? WHERE plugin = ? AND objectPrimaryId = ?
""", (plugin, primary_id)) """, (plugin, primary_id))
def getByStatus(self, status): def getByStatus(self, status):
return self._fetchall(""" return self._fetchall("""
SELECT * FROM Plugins_Objects WHERE Status = ? SELECT * FROM Plugins_Objects WHERE "status" = ?
""", (status,)) """, (status,))
def updateField(self, ObjectGUID, field, value): def updateField(self, ObjectGUID, field, value):
@@ -90,7 +90,7 @@ class PluginObjectInstance:
raise ValueError(msg) raise ValueError(msg)
self._execute( self._execute(
f"UPDATE Plugins_Objects SET {field}=? WHERE ObjectGUID=?", f"UPDATE Plugins_Objects SET {field}=? WHERE objectGuid=?",
(value, ObjectGUID) (value, ObjectGUID)
) )
@@ -100,4 +100,4 @@ class PluginObjectInstance:
mylog("none", msg) mylog("none", msg)
raise ValueError(msg) raise ValueError(msg)
self._execute("DELETE FROM Plugins_Objects WHERE ObjectGUID=?", (ObjectGUID,)) self._execute("DELETE FROM Plugins_Objects WHERE objectGuid=?", (ObjectGUID,))

View File

@@ -238,11 +238,11 @@ class plugin_manager:
if plugin_name: # Only compute for single plugin if plugin_name: # Only compute for single plugin
sql.execute( sql.execute(
""" """
SELECT MAX(DateTimeChanged) AS last_changed, SELECT MAX(dateTimeChanged) AS last_changed,
COUNT(*) AS total_objects, COUNT(*) AS total_objects,
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects SUM(CASE WHEN dateTimeCreated = dateTimeChanged THEN 1 ELSE 0 END) AS new_objects
FROM Plugins_Objects FROM Plugins_Objects
WHERE Plugin = ? WHERE plugin = ?
""", """,
(plugin_name,), (plugin_name,),
) )
@@ -264,12 +264,12 @@ class plugin_manager:
else: # Compute for all plugins (full refresh) else: # Compute for all plugins (full refresh)
sql.execute(""" sql.execute("""
SELECT Plugin, SELECT plugin,
MAX(DateTimeChanged) AS last_changed, MAX(dateTimeChanged) AS last_changed,
COUNT(*) AS total_objects, COUNT(*) AS total_objects,
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects SUM(CASE WHEN dateTimeCreated = dateTimeChanged THEN 1 ELSE 0 END) AS new_objects
FROM Plugins_Objects FROM Plugins_Objects
GROUP BY Plugin GROUP BY plugin
""") """)
for plugin, last_changed, total_objects, new_objects in sql.fetchall(): for plugin, last_changed, total_objects, new_objects in sql.fetchall():
new_objects = new_objects or 0 # ensure it's int new_objects = new_objects or 0 # ensure it's int
@@ -496,22 +496,22 @@ def execute_plugin(db, all_plugins, plugin):
# Common part of the SQL parameters # Common part of the SQL parameters
base_params = [ base_params = [
0, # "Index" placeholder 0, # "index" placeholder
plugin[ plugin[
"unique_prefix" "unique_prefix"
], # "Plugin" column value from the plugin dictionary ], # "plugin" column value from the plugin dictionary
columns[0], # "Object_PrimaryID" value from columns list columns[0], # "objectPrimaryId" value from columns list
columns[1], # "Object_SecondaryID" value from columns list columns[1], # "objectSecondaryId" value from columns list
"null", # Placeholder for "DateTimeCreated" column "null", # Placeholder for "dateTimeCreated" column
columns[2], # "DateTimeChanged" value from columns list columns[2], # "dateTimeChanged" value from columns list
columns[3], # "Watched_Value1" value from columns list columns[3], # "watchedValue1" value from columns list
columns[4], # "Watched_Value2" value from columns list columns[4], # "watchedValue2" value from columns list
columns[5], # "Watched_Value3" value from columns list columns[5], # "watchedValue3" value from columns list
columns[6], # "Watched_Value4" value from columns list columns[6], # "watchedValue4" value from columns list
"not-processed", # "Status" column (placeholder) "not-processed", # "status" column (placeholder)
columns[7], # "Extra" value from columns list columns[7], # "extra" value from columns list
"null", # Placeholder for "UserData" column "null", # Placeholder for "userData" column
columns[8], # "ForeignKey" value from columns list columns[8], # "foreignKey" value from columns list
tmp_SyncHubNodeName, # Sync Hub Node name tmp_SyncHubNodeName, # Sync Hub Node name
] ]
@@ -566,26 +566,26 @@ def execute_plugin(db, all_plugins, plugin):
# Each value corresponds to a column in the table in the order of the columns. # Each value corresponds to a column in the table in the order of the columns.
# Must match the Plugins_Objects and Plugins_Events database tables and can be used as input for the plugin_object_class. # Must match the Plugins_Objects and Plugins_Events database tables and can be used as input for the plugin_object_class.
base_params = [ base_params = [
0, # "Index" placeholder 0, # "index" placeholder
plugin["unique_prefix"], # "Plugin" plugin dictionary plugin["unique_prefix"], # "plugin" plugin dictionary
row[0], # "Object_PrimaryID" row row[0], # "objectPrimaryId" row
handle_empty( handle_empty(
row[1] row[1]
), # "Object_SecondaryID" column after handling empty values ), # "objectSecondaryId" column after handling empty values
"null", # Placeholder "DateTimeCreated" column "null", # Placeholder "dateTimeCreated" column
row[2], # "DateTimeChanged" row row[2], # "dateTimeChanged" row
row[3], # "Watched_Value1" row row[3], # "watchedValue1" row
row[4], # "Watched_Value2" row row[4], # "watchedValue2" row
handle_empty( handle_empty(
row[5] row[5]
), # "Watched_Value3" column after handling empty values ), # "watchedValue3" column after handling empty values
handle_empty( handle_empty(
row[6] row[6]
), # "Watched_Value4" column after handling empty values ), # "watchedValue4" column after handling empty values
"not-processed", # "Status" column (placeholder) "not-processed", # "status" column (placeholder)
row[7], # "Extra" row row[7], # "extra" row
"null", # Placeholder "UserData" column "null", # Placeholder "userData" column
row[8], # "ForeignKey" row row[8], # "foreignKey" row
"null", # Sync Hub Node name - Only supported with scripts "null", # Sync Hub Node name - Only supported with scripts
] ]
@@ -654,41 +654,41 @@ def execute_plugin(db, all_plugins, plugin):
# Each value corresponds to a column in the table in the order of the columns. # Each value corresponds to a column in the table in the order of the columns.
# Must match the Plugins_Objects and Plugins_Events database tables and can be used as input for the plugin_object_class. # Must match the Plugins_Objects and Plugins_Events database tables and can be used as input for the plugin_object_class.
base_params = [ base_params = [
0, # "Index" placeholder 0, # "index" placeholder
plugin["unique_prefix"], # "Plugin" plugin["unique_prefix"], # "plugin"
row[0], # "Object_PrimaryID" row[0], # "objectPrimaryId"
handle_empty(row[1]), # "Object_SecondaryID" handle_empty(row[1]), # "objectSecondaryId"
"null", # "DateTimeCreated" column (null placeholder) "null", # "dateTimeCreated" column (null placeholder)
row[2], # "DateTimeChanged" row[2], # "dateTimeChanged"
row[3], # "Watched_Value1" row[3], # "watchedValue1"
row[4], # "Watched_Value2" row[4], # "watchedValue2"
handle_empty(row[5]), # "Watched_Value3" handle_empty(row[5]), # "watchedValue3"
handle_empty(row[6]), # "Watched_Value4" handle_empty(row[6]), # "watchedValue4"
"not-processed", # "Status" column (placeholder) "not-processed", # "status" column (placeholder)
row[7], # "Extra" row[7], # "extra"
"null", # "UserData" column (null placeholder) "null", # "userData" column (null placeholder)
row[8], # "ForeignKey" row[8], # "foreignKey"
"null", # Sync Hub Node name - Only supported with scripts "null", # syncHubNodeName - Only supported with scripts
] ]
# Extend the base tuple with additional values if there are 13 columns # Extend the base tuple with additional values if there are 13 columns
if len(row) == 13: if len(row) == 13:
base_params.extend( base_params.extend(
[ [
row[9], # "HelpVal1" row[9], # "helpVal1"
row[10], # "HelpVal2" row[10], # "helpVal2"
row[11], # "HelpVal3" row[11], # "helpVal3"
row[12], # "HelpVal4" row[12], # "helpVal4"
] ]
) )
else: else:
# add padding # add padding
base_params.extend( base_params.extend(
[ [
"null", # "HelpVal1" "null", # "helpVal1"
"null", # "HelpVal2" "null", # "helpVal2"
"null", # "HelpVal3" "null", # "helpVal3"
"null", # "HelpVal4" "null", # "helpVal4"
] ]
) )
@@ -749,7 +749,7 @@ def process_plugin_events(db, plugin, plugEventsArr):
# Create plugin objects from existing database entries # Create plugin objects from existing database entries
plugObjectsArr = db.get_sql_array( plugObjectsArr = db.get_sql_array(
"SELECT * FROM Plugins_Objects where Plugin = '" + str(pluginPref) + "'" "SELECT * FROM Plugins_Objects where plugin = '" + str(pluginPref) + "'"
) )
for obj in plugObjectsArr: for obj in plugObjectsArr:
@@ -894,11 +894,11 @@ def process_plugin_events(db, plugin, plugEventsArr):
sql.executemany( sql.executemany(
""" """
INSERT INTO Plugins_Objects INSERT INTO Plugins_Objects
("Plugin", "Object_PrimaryID", "Object_SecondaryID", "DateTimeCreated", ("plugin", "objectPrimaryId", "objectSecondaryId", "dateTimeCreated",
"DateTimeChanged", "Watched_Value1", "Watched_Value2", "Watched_Value3", "dateTimeChanged", "watchedValue1", "watchedValue2", "watchedValue3",
"Watched_Value4", "Status", "Extra", "UserData", "ForeignKey", "SyncHubNodeName", "watchedValue4", "status", "extra", "userData", "foreignKey", "syncHubNodeName",
"HelpVal1", "HelpVal2", "HelpVal3", "HelpVal4", "helpVal1", "helpVal2", "helpVal3", "helpVal4",
"ObjectGUID") "objectGuid")
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
objects_to_insert, objects_to_insert,
@@ -909,12 +909,12 @@ def process_plugin_events(db, plugin, plugEventsArr):
sql.executemany( sql.executemany(
""" """
UPDATE Plugins_Objects UPDATE Plugins_Objects
SET "Plugin" = ?, "Object_PrimaryID" = ?, "Object_SecondaryID" = ?, "DateTimeCreated" = ?, SET "plugin" = ?, "objectPrimaryId" = ?, "objectSecondaryId" = ?, "dateTimeCreated" = ?,
"DateTimeChanged" = ?, "Watched_Value1" = ?, "Watched_Value2" = ?, "Watched_Value3" = ?, "dateTimeChanged" = ?, "watchedValue1" = ?, "watchedValue2" = ?, "watchedValue3" = ?,
"Watched_Value4" = ?, "Status" = ?, "Extra" = ?, "UserData" = ?, "ForeignKey" = ?, "SyncHubNodeName" = ?, "watchedValue4" = ?, "status" = ?, "extra" = ?, "userData" = ?, "foreignKey" = ?, "syncHubNodeName" = ?,
"HelpVal1" = ?, "HelpVal2" = ?, "HelpVal3" = ?, "HelpVal4" = ?, "helpVal1" = ?, "helpVal2" = ?, "helpVal3" = ?, "helpVal4" = ?,
"ObjectGUID" = ? "objectGuid" = ?
WHERE "Index" = ? WHERE "index" = ?
""", """,
objects_to_update, objects_to_update,
) )
@@ -924,11 +924,11 @@ def process_plugin_events(db, plugin, plugEventsArr):
sql.executemany( sql.executemany(
""" """
INSERT INTO Plugins_Events INSERT INTO Plugins_Events
("Plugin", "Object_PrimaryID", "Object_SecondaryID", "DateTimeCreated", ("plugin", "objectPrimaryId", "objectSecondaryId", "dateTimeCreated",
"DateTimeChanged", "Watched_Value1", "Watched_Value2", "Watched_Value3", "dateTimeChanged", "watchedValue1", "watchedValue2", "watchedValue3",
"Watched_Value4", "Status", "Extra", "UserData", "ForeignKey", "SyncHubNodeName", "watchedValue4", "status", "extra", "userData", "foreignKey", "syncHubNodeName",
"HelpVal1", "HelpVal2", "HelpVal3", "HelpVal4", "helpVal1", "helpVal2", "helpVal3", "helpVal4",
"ObjectGUID") "objectGuid")
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
events_to_insert, events_to_insert,
@@ -939,11 +939,11 @@ def process_plugin_events(db, plugin, plugEventsArr):
sql.executemany( sql.executemany(
""" """
INSERT INTO Plugins_History INSERT INTO Plugins_History
("Plugin", "Object_PrimaryID", "Object_SecondaryID", "DateTimeCreated", ("plugin", "objectPrimaryId", "objectSecondaryId", "dateTimeCreated",
"DateTimeChanged", "Watched_Value1", "Watched_Value2", "Watched_Value3", "dateTimeChanged", "watchedValue1", "watchedValue2", "watchedValue3",
"Watched_Value4", "Status", "Extra", "UserData", "ForeignKey", "SyncHubNodeName", "watchedValue4", "status", "extra", "userData", "foreignKey", "syncHubNodeName",
"HelpVal1", "HelpVal2", "HelpVal3", "HelpVal4", "helpVal1", "helpVal2", "helpVal3", "helpVal4",
"ObjectGUID") "objectGuid")
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
history_to_insert, history_to_insert,
@@ -993,41 +993,41 @@ def process_plugin_events(db, plugin, plugEventsArr):
tmpList = [] tmpList = []
for col in mappedCols: for col in mappedCols:
if col["column"] == "Index": if col["column"] == "index":
tmpList.append(plgEv.index) tmpList.append(plgEv.index)
elif col["column"] == "Plugin": elif col["column"] == "plugin":
tmpList.append(plgEv.pluginPref) tmpList.append(plgEv.pluginPref)
elif col["column"] == "Object_PrimaryID": elif col["column"] == "objectPrimaryId":
tmpList.append(plgEv.primaryId) tmpList.append(plgEv.primaryId)
elif col["column"] == "Object_SecondaryID": elif col["column"] == "objectSecondaryId":
tmpList.append(plgEv.secondaryId) tmpList.append(plgEv.secondaryId)
elif col["column"] == "DateTimeCreated": elif col["column"] == "dateTimeCreated":
tmpList.append(plgEv.created) tmpList.append(plgEv.created)
elif col["column"] == "DateTimeChanged": elif col["column"] == "dateTimeChanged":
tmpList.append(plgEv.changed) tmpList.append(plgEv.changed)
elif col["column"] == "Watched_Value1": elif col["column"] == "watchedValue1":
tmpList.append(plgEv.watched1) tmpList.append(plgEv.watched1)
elif col["column"] == "Watched_Value2": elif col["column"] == "watchedValue2":
tmpList.append(plgEv.watched2) tmpList.append(plgEv.watched2)
elif col["column"] == "Watched_Value3": elif col["column"] == "watchedValue3":
tmpList.append(plgEv.watched3) tmpList.append(plgEv.watched3)
elif col["column"] == "Watched_Value4": elif col["column"] == "watchedValue4":
tmpList.append(plgEv.watched4) tmpList.append(plgEv.watched4)
elif col["column"] == "UserData": elif col["column"] == "userData":
tmpList.append(plgEv.userData) tmpList.append(plgEv.userData)
elif col["column"] == "Extra": elif col["column"] == "extra":
tmpList.append(plgEv.extra) tmpList.append(plgEv.extra)
elif col["column"] == "Status": elif col["column"] == "status":
tmpList.append(plgEv.status) tmpList.append(plgEv.status)
elif col["column"] == "SyncHubNodeName": elif col["column"] == "syncHubNodeName":
tmpList.append(plgEv.syncHubNodeName) tmpList.append(plgEv.syncHubNodeName)
elif col["column"] == "HelpVal1": elif col["column"] == "helpVal1":
tmpList.append(plgEv.helpVal1) tmpList.append(plgEv.helpVal1)
elif col["column"] == "HelpVal2": elif col["column"] == "helpVal2":
tmpList.append(plgEv.helpVal2) tmpList.append(plgEv.helpVal2)
elif col["column"] == "HelpVal3": elif col["column"] == "helpVal3":
tmpList.append(plgEv.helpVal3) tmpList.append(plgEv.helpVal3)
elif col["column"] == "HelpVal4": elif col["column"] == "helpVal4":
tmpList.append(plgEv.helpVal4) tmpList.append(plgEv.helpVal4)
# Check if there's a default value specified for this column in the JSON. # Check if there's a default value specified for this column in the JSON.
@@ -1113,10 +1113,10 @@ class plugin_object_class:
# hash for comapring watched value changes # hash for comapring watched value changes
indexNameColumnMapping = [ indexNameColumnMapping = [
(6, "Watched_Value1"), (6, "watchedValue1"),
(7, "Watched_Value2"), (7, "watchedValue2"),
(8, "Watched_Value3"), (8, "watchedValue3"),
(9, "Watched_Value4"), (9, "watchedValue4"),
] ]
if setObj is not None: if setObj is not None:

View File

@@ -581,8 +581,8 @@ def print_scan_stats(db):
row_dict = dict(row) row_dict = dict(row)
mylog("trace", f" {row_dict}") mylog("trace", f" {row_dict}")
mylog("trace", " ================ Events table content where eve_PendingAlertEmail = 1 ================",) mylog("trace", " ================ Events table content where evePendingAlertEmail = 1 ================",)
sql.execute("select * from Events where eve_PendingAlertEmail = 1") sql.execute("select * from Events where evePendingAlertEmail = 1")
rows = sql.fetchall() rows = sql.fetchall()
for row in rows: for row in rows:
row_dict = dict(row) row_dict = dict(row)
@@ -611,9 +611,9 @@ def create_new_devices(db):
mylog("debug", '[New Devices] Insert "New Device" Events') mylog("debug", '[New Devices] Insert "New Device" Events')
query_new_device_events = f""" query_new_device_events = f"""
INSERT OR IGNORE INTO Events ( INSERT OR IGNORE INTO Events (
eve_MAC, eve_IP, eve_DateTime, eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail evePendingAlertEmail
) )
SELECT DISTINCT scanMac, scanLastIP, '{startTime}', 'New Device', scanVendor, 1 SELECT DISTINCT scanMac, scanLastIP, '{startTime}', 'New Device', scanVendor, 1
FROM CurrentScan FROM CurrentScan
@@ -630,9 +630,9 @@ def create_new_devices(db):
mylog("debug", "[New Devices] Insert Connection into session table") mylog("debug", "[New Devices] Insert Connection into session table")
sql.execute(f"""INSERT INTO Sessions ( sql.execute(f"""INSERT INTO Sessions (
ses_MAC, ses_IP, ses_EventTypeConnection, ses_DateTimeConnection, sesMac, sesIp, sesEventTypeConnection, sesDateTimeConnection,
ses_EventTypeDisconnection, ses_DateTimeDisconnection, sesEventTypeDisconnection, sesDateTimeDisconnection,
ses_StillConnected, ses_AdditionalInfo sesStillConnected, sesAdditionalInfo
) )
SELECT scanMac, scanLastIP, 'Connected', '{startTime}', NULL, NULL, 1, scanVendor SELECT scanMac, scanLastIP, 'Connected', '{startTime}', NULL, NULL, 1, scanVendor
FROM CurrentScan FROM CurrentScan
@@ -642,7 +642,7 @@ def create_new_devices(db):
) )
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 FROM Sessions SELECT 1 FROM Sessions
WHERE ses_MAC = scanMac AND ses_StillConnected = 1 WHERE sesMac = scanMac AND sesStillConnected = 1
) )
""") """)

View File

@@ -23,10 +23,10 @@ class NameResolver:
nameNotFound = ResolvedName() nameNotFound = ResolvedName()
# Check by MAC # Check by MAC
sql.execute(f""" sql.execute("""
SELECT Watched_Value2 FROM Plugins_Objects SELECT watchedValue2 FROM Plugins_Objects
WHERE Plugin = '{plugin}' AND Object_PrimaryID = '{pMAC}' WHERE plugin = ? AND objectPrimaryId = ?
""") """, (plugin, pMAC))
result = sql.fetchall() result = sql.fetchall()
# self.db.commitDB() # Issue #1251: Optimize name resolution lookup # self.db.commitDB() # Issue #1251: Optimize name resolution lookup
if result: if result:
@@ -36,10 +36,10 @@ class NameResolver:
# Check name by IP if enabled # Check name by IP if enabled
if get_setting_value('NEWDEV_IP_MATCH_NAME'): if get_setting_value('NEWDEV_IP_MATCH_NAME'):
sql.execute(f""" sql.execute("""
SELECT Watched_Value2 FROM Plugins_Objects SELECT watchedValue2 FROM Plugins_Objects
WHERE Plugin = '{plugin}' AND Object_SecondaryID = '{pIP}' WHERE plugin = ? AND objectSecondaryId = ?
""") """, (plugin, pIP))
result = sql.fetchall() result = sql.fetchall()
# self.db.commitDB() # Issue #1251: Optimize name resolution lookup # self.db.commitDB() # Issue #1251: Optimize name resolution lookup
if result: if result:

View File

@@ -120,27 +120,27 @@ def pair_sessions_events(db):
mylog("debug", "[Pair Session] - 1 Connections / New Devices") mylog("debug", "[Pair Session] - 1 Connections / New Devices")
sql.execute("""UPDATE Events sql.execute("""UPDATE Events
SET eve_PairEventRowid = SET evePairEventRowid =
(SELECT ROWID (SELECT ROWID
FROM Events AS EVE2 FROM Events AS EVE2
WHERE EVE2.eve_EventType IN ('New Device', 'Connected', 'Down Reconnected', WHERE EVE2.eveEventType IN ('New Device', 'Connected', 'Down Reconnected',
'Device Down', 'Disconnected') 'Device Down', 'Disconnected')
AND EVE2.eve_MAC = Events.eve_MAC AND EVE2.eveMac = Events.eveMac
AND EVE2.eve_Datetime > Events.eve_DateTime AND EVE2.eveDateTime > Events.eveDateTime
ORDER BY EVE2.eve_DateTime ASC LIMIT 1) ORDER BY EVE2.eveDateTime ASC LIMIT 1)
WHERE eve_EventType IN ('New Device', 'Connected', 'Down Reconnected') WHERE eveEventType IN ('New Device', 'Connected', 'Down Reconnected')
AND eve_PairEventRowid IS NULL AND evePairEventRowid IS NULL
""") """)
# Pair Disconnection / Device Down # Pair Disconnection / Device Down
mylog("debug", "[Pair Session] - 2 Disconnections") mylog("debug", "[Pair Session] - 2 Disconnections")
sql.execute("""UPDATE Events sql.execute("""UPDATE Events
SET eve_PairEventRowid = SET evePairEventRowid =
(SELECT ROWID (SELECT ROWID
FROM Events AS EVE2 FROM Events AS EVE2
WHERE EVE2.eve_PairEventRowid = Events.ROWID) WHERE EVE2.evePairEventRowid = Events.ROWID)
WHERE eve_EventType IN ('Device Down', 'Disconnected') WHERE eveEventType IN ('Device Down', 'Disconnected')
AND eve_PairEventRowid IS NULL AND evePairEventRowid IS NULL
""") """)
mylog("debug", "[Pair Session] Pair session end") mylog("debug", "[Pair Session] Pair session end")
@@ -171,9 +171,9 @@ def insert_events(db):
# Check device down non-sleeping devices (immediate on first absence) # Check device down non-sleeping devices (immediate on first absence)
mylog("debug", "[Events] - 1a - Devices down (non-sleeping)") mylog("debug", "[Events] - 1a - Devices down (non-sleeping)")
sql.execute(f"""INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f"""INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail) evePendingAlertEmail)
SELECT devMac, devLastIP, '{startTime}', 'Device Down', '', 1 SELECT devMac, devLastIP, '{startTime}', 'Device Down', '', 1
FROM DevicesView FROM DevicesView
WHERE devAlertDown != 0 WHERE devAlertDown != 0
@@ -185,9 +185,9 @@ def insert_events(db):
# Check device down sleeping devices whose sleep window has expired # Check device down sleeping devices whose sleep window has expired
mylog("debug", "[Events] - 1b - Devices down (sleep expired)") mylog("debug", "[Events] - 1b - Devices down (sleep expired)")
sql.execute(f"""INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f"""INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail) evePendingAlertEmail)
SELECT devMac, devLastIP, '{startTime}', 'Device Down', '', 1 SELECT devMac, devLastIP, '{startTime}', 'Device Down', '', 1
FROM DevicesView FROM DevicesView
WHERE devAlertDown != 0 WHERE devAlertDown != 0
@@ -197,33 +197,33 @@ def insert_events(db):
AND NOT EXISTS (SELECT 1 FROM CurrentScan AND NOT EXISTS (SELECT 1 FROM CurrentScan
WHERE devMac = scanMac) WHERE devMac = scanMac)
AND NOT EXISTS (SELECT 1 FROM Events AND NOT EXISTS (SELECT 1 FROM Events
WHERE eve_MAC = devMac WHERE eveMac = devMac
AND eve_EventType = 'Device Down' AND eveEventType = 'Device Down'
AND eve_DateTime >= devLastConnection AND eveDateTime >= devLastConnection
) """) ) """)
# Check new Connections or Down Reconnections # Check new Connections or Down Reconnections
mylog("debug", "[Events] - 2 - New Connections") mylog("debug", "[Events] - 2 - New Connections")
sql.execute(f""" INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f""" INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail) evePendingAlertEmail)
SELECT DISTINCT c.scanMac, c.scanLastIP, '{startTime}', SELECT DISTINCT c.scanMac, c.scanLastIP, '{startTime}',
CASE CASE
WHEN last_event.eve_EventType = 'Device Down' and last_event.eve_PendingAlertEmail = 0 THEN 'Down Reconnected' WHEN last_event.eveEventType = 'Device Down' and last_event.evePendingAlertEmail = 0 THEN 'Down Reconnected'
ELSE 'Connected' ELSE 'Connected'
END, END,
'', '',
1 1
FROM CurrentScan AS c FROM CurrentScan AS c
LEFT JOIN LatestEventsPerMAC AS last_event ON c.scanMac = last_event.eve_MAC LEFT JOIN LatestEventsPerMAC AS last_event ON c.scanMac = last_event.eveMac
WHERE last_event.devPresentLastScan = 0 OR last_event.eve_MAC IS NULL WHERE last_event.devPresentLastScan = 0 OR last_event.eveMac IS NULL
""") """)
# Check disconnections # Check disconnections
mylog("debug", "[Events] - 3 - Disconnections") mylog("debug", "[Events] - 3 - Disconnections")
sql.execute(f"""INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f"""INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail) evePendingAlertEmail)
SELECT devMac, devLastIP, '{startTime}', 'Disconnected', '', SELECT devMac, devLastIP, '{startTime}', 'Disconnected', '',
devAlertEvents devAlertEvents
FROM Devices FROM Devices
@@ -235,9 +235,9 @@ def insert_events(db):
# Check IP Changed # Check IP Changed
mylog("debug", "[Events] - 4 - IP Changes") mylog("debug", "[Events] - 4 - IP Changes")
sql.execute(f"""INSERT OR IGNORE INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f"""INSERT OR IGNORE INTO Events (eveMac, eveIp, eveDateTime,
eve_EventType, eve_AdditionalInfo, eveEventType, eveAdditionalInfo,
eve_PendingAlertEmail) evePendingAlertEmail)
SELECT scanMac, scanLastIP, '{startTime}', 'IP Changed', SELECT scanMac, scanLastIP, '{startTime}', 'IP Changed',
'Previous IP: '|| devLastIP, devAlertEvents 'Previous IP: '|| devLastIP, devAlertEvents
FROM Devices, CurrentScan FROM Devices, CurrentScan
@@ -279,7 +279,7 @@ def insertOnlineHistory(db):
# Prepare the insert query using parameterized inputs # Prepare the insert query using parameterized inputs
insert_query = """ insert_query = """
INSERT INTO Online_History (Scan_Date, Online_Devices, Down_Devices, All_Devices, Archived_Devices, Offline_Devices) INSERT INTO Online_History (scanDate, onlineDevices, downDevices, allDevices, archivedDevices, offlineDevices)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
""" """

View File

@@ -245,7 +245,7 @@ def handle_empty(value):
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
# Get and return a plugin object based on key-value pairs # Get and return a plugin object based on key-value pairs
# keyValues example: getPluginObject({"Plugin":"MQTT", "Watched_Value4":"someValue"}) # keyValues example: getPluginObject({"plugin":"MQTT", "watchedValue4":"someValue"})
def getPluginObject(keyValues): def getPluginObject(keyValues):
plugins_objects = apiPath + "table_plugins_objects.json" plugins_objects = apiPath + "table_plugins_objects.json"

View File

@@ -40,10 +40,10 @@ class UpdateFieldAction(Action):
processed = False processed = False
# currently unused # currently unused
if isinstance(obj, dict) and "ObjectGUID" in obj: if isinstance(obj, dict) and "objectGuid" in obj:
mylog("debug", f"[WF] Updating Object '{obj}' ") mylog("debug", f"[WF] Updating Object '{obj}' ")
plugin_instance = PluginObjectInstance() plugin_instance = PluginObjectInstance()
plugin_instance.updateField(obj["ObjectGUID"], self.field, self.value) plugin_instance.updateField(obj["objectGuid"], self.field, self.value)
processed = True processed = True
elif isinstance(obj, dict) and "devGUID" in obj: elif isinstance(obj, dict) and "devGUID" in obj:
@@ -77,10 +77,10 @@ class DeleteObjectAction(Action):
processed = False processed = False
# currently unused # currently unused
if isinstance(obj, dict) and "ObjectGUID" in obj: if isinstance(obj, dict) and "objectGuid" in obj:
mylog("debug", f"[WF] Updating Object '{obj}' ") mylog("debug", f"[WF] Updating Object '{obj}' ")
plugin_instance = PluginObjectInstance() plugin_instance = PluginObjectInstance()
plugin_instance.delete(obj["ObjectGUID"]) plugin_instance.delete(obj["objectGuid"])
processed = True processed = True
elif isinstance(obj, dict) and "devGUID" in obj: elif isinstance(obj, dict) and "devGUID" in obj:

View File

@@ -23,29 +23,29 @@ class AppEvent_obj:
self.object_mapping = { self.object_mapping = {
"Devices": { "Devices": {
"fields": { "fields": {
"ObjectGUID": "NEW.devGUID", "objectGuid": "NEW.devGUID",
"ObjectPrimaryID": "NEW.devMac", "objectPrimaryId": "NEW.devMac",
"ObjectSecondaryID": "NEW.devLastIP", "objectSecondaryId": "NEW.devLastIP",
"ObjectForeignKey": "NEW.devGUID", "objectForeignKey": "NEW.devGUID",
"ObjectStatus": "CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END", "objectStatus": "CASE WHEN NEW.devPresentLastScan = 1 THEN 'online' ELSE 'offline' END",
"ObjectStatusColumn": "'devPresentLastScan'", "objectStatusColumn": "'devPresentLastScan'",
"ObjectIsNew": "NEW.devIsNew", "objectIsNew": "NEW.devIsNew",
"ObjectIsArchived": "NEW.devIsArchived", "objectIsArchived": "NEW.devIsArchived",
"ObjectPlugin": "'DEVICES'", "objectPlugin": "'DEVICES'",
} }
} }
# , # ,
# "Plugins_Objects": { # "Plugins_Objects": {
# "fields": { # "fields": {
# "ObjectGUID": "NEW.ObjectGUID", # "objectGuid": "NEW.objectGuid",
# "ObjectPrimaryID": "NEW.Plugin", # "objectPrimaryId": "NEW.plugin",
# "ObjectSecondaryID": "NEW.Object_PrimaryID", # "objectSecondaryId": "NEW.objectPrimaryId",
# "ObjectForeignKey": "NEW.ForeignKey", # "objectForeignKey": "NEW.foreignKey",
# "ObjectStatus": "NEW.Status", # "objectStatus": "NEW.status",
# "ObjectStatusColumn": "'Status'", # "objectStatusColumn": "'status'",
# "ObjectIsNew": "CASE WHEN NEW.Status = 'new' THEN 1 ELSE 0 END", # "objectIsNew": "CASE WHEN NEW.status = 'new' THEN 1 ELSE 0 END",
# "ObjectIsArchived": "0", # Default value # "objectIsArchived": "0", # Default value
# "ObjectPlugin": "NEW.Plugin" # "objectPlugin": "NEW.plugin"
# } # }
# } # }
} }
@@ -79,26 +79,26 @@ class AppEvent_obj:
"""Creates the AppEvents table if it doesn't exist.""" """Creates the AppEvents table if it doesn't exist."""
self.db.sql.execute(""" self.db.sql.execute("""
CREATE TABLE IF NOT EXISTS "AppEvents" ( CREATE TABLE IF NOT EXISTS "AppEvents" (
"Index" INTEGER PRIMARY KEY AUTOINCREMENT, "index" INTEGER PRIMARY KEY AUTOINCREMENT,
"GUID" TEXT UNIQUE, "guid" TEXT UNIQUE,
"AppEventProcessed" BOOLEAN, "appEventProcessed" BOOLEAN,
"DateTimeCreated" TEXT, "dateTimeCreated" TEXT,
"ObjectType" TEXT, "objectType" TEXT,
"ObjectGUID" TEXT, "objectGuid" TEXT,
"ObjectPlugin" TEXT, "objectPlugin" TEXT,
"ObjectPrimaryID" TEXT, "objectPrimaryId" TEXT,
"ObjectSecondaryID" TEXT, "objectSecondaryId" TEXT,
"ObjectForeignKey" TEXT, "objectForeignKey" TEXT,
"ObjectIndex" TEXT, "objectIndex" TEXT,
"ObjectIsNew" BOOLEAN, "objectIsNew" BOOLEAN,
"ObjectIsArchived" BOOLEAN, "objectIsArchived" BOOLEAN,
"ObjectStatusColumn" TEXT, "objectStatusColumn" TEXT,
"ObjectStatus" TEXT, "objectStatus" TEXT,
"AppEventType" TEXT, "appEventType" TEXT,
"Helper1" TEXT, "helper1" TEXT,
"Helper2" TEXT, "helper2" TEXT,
"Helper3" TEXT, "helper3" TEXT,
"Extra" TEXT "extra" TEXT
); );
""") """)
@@ -111,43 +111,43 @@ class AppEvent_obj:
AFTER {event.upper()} ON "{table_name}" AFTER {event.upper()} ON "{table_name}"
WHEN NOT EXISTS ( WHEN NOT EXISTS (
SELECT 1 FROM AppEvents SELECT 1 FROM AppEvents
WHERE AppEventProcessed = 0 WHERE appEventProcessed = 0
AND ObjectType = '{table_name}' AND objectType = '{table_name}'
AND ObjectGUID = {manage_prefix(config["fields"]["ObjectGUID"], event)} AND objectGuid = {manage_prefix(config["fields"]["objectGuid"], event)}
AND ObjectStatus = {manage_prefix(config["fields"]["ObjectStatus"], event)} AND objectStatus = {manage_prefix(config["fields"]["objectStatus"], event)}
AND AppEventType = '{event.lower()}' AND appEventType = '{event.lower()}'
) )
BEGIN BEGIN
INSERT INTO "AppEvents" ( INSERT INTO "AppEvents" (
"GUID", "guid",
"DateTimeCreated", "dateTimeCreated",
"AppEventProcessed", "appEventProcessed",
"ObjectType", "objectType",
"ObjectGUID", "objectGuid",
"ObjectPrimaryID", "objectPrimaryId",
"ObjectSecondaryID", "objectSecondaryId",
"ObjectStatus", "objectStatus",
"ObjectStatusColumn", "objectStatusColumn",
"ObjectIsNew", "objectIsNew",
"ObjectIsArchived", "objectIsArchived",
"ObjectForeignKey", "objectForeignKey",
"ObjectPlugin", "objectPlugin",
"AppEventType" "appEventType"
) )
VALUES ( VALUES (
{sql_generateGuid}, {sql_generateGuid},
DATETIME('now'), DATETIME('now'),
FALSE, FALSE,
'{table_name}', '{table_name}',
{manage_prefix(config["fields"]["ObjectGUID"], event)}, -- ObjectGUID {manage_prefix(config["fields"]["objectGuid"], event)}, -- objectGuid
{manage_prefix(config["fields"]["ObjectPrimaryID"], event)}, -- ObjectPrimaryID {manage_prefix(config["fields"]["objectPrimaryId"], event)}, -- objectPrimaryId
{manage_prefix(config["fields"]["ObjectSecondaryID"], event)}, -- ObjectSecondaryID {manage_prefix(config["fields"]["objectSecondaryId"], event)}, -- objectSecondaryId
{manage_prefix(config["fields"]["ObjectStatus"], event)}, -- ObjectStatus {manage_prefix(config["fields"]["objectStatus"], event)}, -- objectStatus
{manage_prefix(config["fields"]["ObjectStatusColumn"], event)}, -- ObjectStatusColumn {manage_prefix(config["fields"]["objectStatusColumn"], event)}, -- objectStatusColumn
{manage_prefix(config["fields"]["ObjectIsNew"], event)}, -- ObjectIsNew {manage_prefix(config["fields"]["objectIsNew"], event)}, -- objectIsNew
{manage_prefix(config["fields"]["ObjectIsArchived"], event)}, -- ObjectIsArchived {manage_prefix(config["fields"]["objectIsArchived"], event)}, -- objectIsArchived
{manage_prefix(config["fields"]["ObjectForeignKey"], event)}, -- ObjectForeignKey {manage_prefix(config["fields"]["objectForeignKey"], event)}, -- objectForeignKey
{manage_prefix(config["fields"]["ObjectPlugin"], event)}, -- ObjectForeignKey {manage_prefix(config["fields"]["objectPlugin"], event)}, -- objectPlugin
'{event.lower()}' '{event.lower()}'
); );
END; END;

View File

@@ -33,8 +33,8 @@ class WorkflowManager:
"""Get new unprocessed events from the AppEvents table.""" """Get new unprocessed events from the AppEvents table."""
result = self.db.sql.execute(""" result = self.db.sql.execute("""
SELECT * FROM AppEvents SELECT * FROM AppEvents
WHERE AppEventProcessed = 0 WHERE appEventProcessed = 0
ORDER BY DateTimeCreated ASC ORDER BY dateTimeCreated ASC
""").fetchall() """).fetchall()
mylog("none", [f"[WF] get_new_app_events - new events count: {len(result)}"]) mylog("none", [f"[WF] get_new_app_events - new events count: {len(result)}"])
@@ -44,7 +44,7 @@ class WorkflowManager:
def process_event(self, event): def process_event(self, event):
"""Process the events. Check if events match a workflow trigger""" """Process the events. Check if events match a workflow trigger"""
evGuid = event["GUID"] evGuid = event["guid"]
mylog("verbose", [f"[WF] Processing event with GUID {evGuid}"]) mylog("verbose", [f"[WF] Processing event with GUID {evGuid}"])
@@ -67,10 +67,10 @@ class WorkflowManager:
self.db.sql.execute( self.db.sql.execute(
""" """
UPDATE AppEvents UPDATE AppEvents
SET AppEventProcessed = 1 SET appEventProcessed = 1
WHERE "Index" = ? WHERE "index" = ?
""", """,
(event["Index"],), (event["index"],),
) # Pass the event's unique identifier ) # Pass the event's unique identifier
self.db.commitDB() self.db.commitDB()

View File

@@ -21,7 +21,7 @@ class Trigger:
self.event_type = triggerJson["event_type"] self.event_type = triggerJson["event_type"]
self.event = event # Store the triggered event context, if provided self.event = event # Store the triggered event context, if provided
self.triggered = ( self.triggered = (
self.object_type == event["ObjectType"] and self.event_type == event["AppEventType"] self.object_type == event["objectType"] and self.event_type == event["appEventType"]
) )
mylog("debug", f"""[WF] self.triggered '{self.triggered}' for event '{get_array_from_sql_rows(event)} and trigger {json.dumps(triggerJson)}' """) mylog("debug", f"""[WF] self.triggered '{self.triggered}' for event '{get_array_from_sql_rows(event)} and trigger {json.dumps(triggerJson)}' """)
@@ -33,7 +33,7 @@ class Trigger:
if db_table == "Devices": if db_table == "Devices":
refField = "devGUID" refField = "devGUID"
elif db_table == "Plugins_Objects": elif db_table == "Plugins_Objects":
refField = "ObjectGUID" refField = "objectGuid"
else: else:
m = f"[WF] Unsupported object_type: {self.object_type}" m = f"[WF] Unsupported object_type: {self.object_type}"
mylog("none", [m]) mylog("none", [m])
@@ -42,7 +42,7 @@ class Trigger:
query = f""" query = f"""
SELECT * FROM SELECT * FROM
{db_table} {db_table}
WHERE {refField} = '{event["ObjectGUID"]}' WHERE {refField} = '{event["objectGuid"]}'
""" """
mylog("debug", [query]) mylog("debug", [query])

View File

@@ -8,7 +8,6 @@ import pytest
from helper import get_setting_value from helper import get_setting_value
from api_server.api_server_start import app from api_server.api_server_start import app
from db.db_helper import get_device_conditions
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
@@ -163,17 +162,15 @@ def test_devices_totals(client, api_token, test_mac):
data = resp.json data = resp.json
assert isinstance(data, list) assert isinstance(data, list)
# 3. Dynamically get expected length # 3. Verify the response has exactly 6 elements in documented order:
conditions = get_device_conditions() # [all, connected, favorites, new, down, archived]
expected_length = len(conditions) expected_length = 6
assert len(data) == expected_length assert len(data) == expected_length, (
f"Expected 6 totals (all, connected, favorites, new, down, archived), got {len(data)}"
)
# 4. Check that at least 1 device exists when there are any conditions # 4. Check that at least 1 device exists (all count includes the dummy device)
if expected_length > 0: assert data[0] >= 1 # index 0 = 'all'
assert data[0] >= 1 # 'devices' count includes the dummy device
else:
# no conditions defined; data should be an empty list
assert data == []
finally: finally:
delete_dummy(client, api_token, test_mac) delete_dummy(client, api_token, test_mac)

View File

@@ -61,7 +61,7 @@ def test_create_event(client, api_token, test_mac):
resp = list_events(client, api_token, test_mac) resp = list_events(client, api_token, test_mac)
assert resp.status_code == 200 assert resp.status_code == 200
events = resp.get_json().get("events", []) events = resp.get_json().get("events", [])
assert any(ev.get("eve_MAC") == test_mac for ev in events) assert any(ev.get("eveMac") == test_mac for ev in events)
def test_delete_events_for_mac(client, api_token, test_mac): def test_delete_events_for_mac(client, api_token, test_mac):
@@ -73,7 +73,7 @@ def test_delete_events_for_mac(client, api_token, test_mac):
resp = list_events(client, api_token, test_mac) resp = list_events(client, api_token, test_mac)
assert resp.status_code == 200 assert resp.status_code == 200
events = resp.json.get("events", []) events = resp.json.get("events", [])
assert any(ev["eve_MAC"] == test_mac for ev in events) assert any(ev["eveMac"] == test_mac for ev in events)
# delete # delete
resp = client.delete(f"/events/{test_mac}", headers=auth_headers(api_token)) resp = client.delete(f"/events/{test_mac}", headers=auth_headers(api_token))
@@ -143,10 +143,10 @@ def test_delete_events_dynamic_days(client, api_token, test_mac):
thirty_days_ago = timeNowUTC(as_string=False) - timedelta(days=30) thirty_days_ago = timeNowUTC(as_string=False) - timedelta(days=30)
initial_younger_count = 0 initial_younger_count = 0
for ev in initial_events: for ev in initial_events:
if ev.get("eve_MAC") == test_mac and ev.get("eve_DateTime"): if ev.get("eveMac") == test_mac and ev.get("eveDateTime"):
try: try:
# Parse event datetime (handle ISO format) # Parse event datetime (handle ISO format)
ev_time_str = ev["eve_DateTime"] ev_time_str = ev["eveDateTime"]
# Try parsing with timezone info # Try parsing with timezone info
try: try:
ev_time = datetime.fromisoformat(ev_time_str.replace("Z", "+00:00")) ev_time = datetime.fromisoformat(ev_time_str.replace("Z", "+00:00"))
@@ -176,6 +176,6 @@ def test_delete_events_dynamic_days(client, api_token, test_mac):
# confirm only recent events remain (pre-existing younger + newly created 5-day-old) # confirm only recent events remain (pre-existing younger + newly created 5-day-old)
resp = list_events(client, api_token, test_mac) resp = list_events(client, api_token, test_mac)
events = resp.get_json().get("events", []) events = resp.get_json().get("events", [])
mac_events = [ev for ev in events if ev.get("eve_MAC") == test_mac] mac_events = [ev for ev in events if ev.get("eveMac") == test_mac]
expected_remaining = initial_younger_count + 1 # 1 for the 5-day-old event we created expected_remaining = initial_younger_count + 1 # 1 for the 5-day-old event we created
assert len(mac_events) == expected_remaining assert len(mac_events) == expected_remaining

View File

@@ -116,7 +116,7 @@ def test_get_open_ports_ip(mock_device_db_conn, mock_plugin_db_conn, client, api
mock_execute_result = MagicMock() mock_execute_result = MagicMock()
# Mock for PluginObjectInstance.getByField (returns port data) # Mock for PluginObjectInstance.getByField (returns port data)
mock_execute_result.fetchall.return_value = [{"Object_SecondaryID": "22", "Watched_Value2": "ssh"}, {"Object_SecondaryID": "80", "Watched_Value2": "http"}] mock_execute_result.fetchall.return_value = [{"objectSecondaryId": "22", "watchedValue2": "ssh"}, {"objectSecondaryId": "80", "watchedValue2": "http"}]
# Mock for DeviceInstance.getByIP (returns device with MAC) # Mock for DeviceInstance.getByIP (returns device with MAC)
mock_execute_result.fetchone.return_value = {"devMac": "aa:bb:cc:dd:ee:ff"} mock_execute_result.fetchone.return_value = {"devMac": "aa:bb:cc:dd:ee:ff"}
@@ -141,7 +141,7 @@ def test_get_open_ports_mac_resolve(mock_plugin_db_conn, client, api_token):
# Mock database connection for MAC-based open ports query # Mock database connection for MAC-based open ports query
mock_conn = MagicMock() mock_conn = MagicMock()
mock_execute_result = MagicMock() mock_execute_result = MagicMock()
mock_execute_result.fetchall.return_value = [{"Object_SecondaryID": "80", "Watched_Value2": "http"}] mock_execute_result.fetchall.return_value = [{"objectSecondaryId": "80", "watchedValue2": "http"}]
mock_conn.execute.return_value = mock_execute_result mock_conn.execute.return_value = mock_execute_result
mock_plugin_db_conn.return_value = mock_conn mock_plugin_db_conn.return_value = mock_conn
@@ -189,7 +189,7 @@ def test_get_recent_alerts(mock_db_conn, client, api_token):
mock_conn = MagicMock() mock_conn = MagicMock()
mock_execute_result = MagicMock() mock_execute_result = MagicMock()
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
mock_execute_result.fetchall.return_value = [{"eve_DateTime": now, "eve_EventType": "New Device", "eve_MAC": "aa:bb:cc:dd:ee:ff"}] mock_execute_result.fetchall.return_value = [{"eveDateTime": now, "eveEventType": "New Device", "eveMac": "aa:bb:cc:dd:ee:ff"}]
mock_conn.execute.return_value = mock_execute_result mock_conn.execute.return_value = mock_execute_result
mock_db_conn.return_value = mock_conn mock_db_conn.return_value = mock_conn

View File

@@ -74,7 +74,7 @@ def test_list_sessions(client, api_token, test_mac):
assert resp.status_code == 200 assert resp.status_code == 200
assert resp.json.get("success") is True assert resp.json.get("success") is True
sessions = resp.json.get("sessions") sessions = resp.json.get("sessions")
assert any(ses["ses_MAC"] == test_mac for ses in sessions) assert any(ses["sesMac"] == test_mac for ses in sessions)
def test_device_sessions_by_period(client, api_token, test_mac): def test_device_sessions_by_period(client, api_token, test_mac):
@@ -105,7 +105,7 @@ def test_device_sessions_by_period(client, api_token, test_mac):
print(test_mac) print(test_mac)
assert isinstance(sessions, list) assert isinstance(sessions, list)
assert any(s["ses_MAC"] == test_mac for s in sessions) assert any(s["sesMac"] == test_mac for s in sessions)
def test_device_session_events(client, api_token, test_mac): def test_device_session_events(client, api_token, test_mac):
@@ -178,7 +178,7 @@ def test_delete_session(client, api_token, test_mac):
# Confirm deletion # Confirm deletion
resp = client.get(f"/sessions/list?mac={test_mac}", headers=auth_headers(api_token)) resp = client.get(f"/sessions/list?mac={test_mac}", headers=auth_headers(api_token))
sessions = resp.json.get("sessions") sessions = resp.json.get("sessions")
assert not any(ses["ses_MAC"] == test_mac for ses in sessions) assert not any(ses["sesMac"] == test_mac for ses in sessions)
def test_get_sessions_calendar(client, api_token, test_mac): def test_get_sessions_calendar(client, api_token, test_mac):

Some files were not shown because too many files have changed in this diff Show More