Skip to content

Commit c739921

Browse files
committed
Refactor event and session column names to camelCase
- Updated test cases to reflect new column names (eve_MAC -> eveMac, eve_DateTime -> eveDateTime, etc.) across various test files. - Modified SQL table definitions in the database cleanup and migration tests to use camelCase naming conventions. - Implemented migration tests to ensure legacy column names are correctly renamed to camelCase equivalents. - Ensured that existing data is preserved during the migration process and that views referencing old column names are dropped before renaming. - Verified that the migration function is idempotent, allowing for safe re-execution without data loss.
1 parent 0bb6db1 commit c739921

File tree

109 files changed

+2404
-1968
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2404
-1968
lines changed

.github/skills/code-standards/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ description: NetAlertX coding standards and conventions. Use this when writing c
1212
- code has to be maintainable, no duplicate code
1313
- follow DRY principle - maintainability of code is more important than speed of implementation
1414
- code files should be less than 500 LOC for better maintainability
15+
- DB columns must not contain underscores, use camelCase instead (e.g., deviceInstanceId, not device_instance_id)
1516

1617
## File Length
1718

docs/API_EVENTS.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ The Events API provides access to **device event logs**, allowing creation, retr
5858
"success": true,
5959
"events": [
6060
{
61-
"eve_MAC": "00:11:22:33:44:55",
62-
"eve_IP": "192.168.1.10",
63-
"eve_DateTime": "2025-08-24T12:00:00Z",
64-
"eve_EventType": "Device Down",
65-
"eve_AdditionalInfo": "",
66-
"eve_PendingAlertEmail": 1
61+
"eveMac": "00:11:22:33:44:55",
62+
"eveIp": "192.168.1.10",
63+
"eveDateTime": "2025-08-24T12:00:00Z",
64+
"eveEventType": "Device Down",
65+
"eveAdditionalInfo": "",
66+
"evePendingAlertEmail": 1
6767
}
6868
]
6969
}
@@ -102,11 +102,11 @@ The Events API provides access to **device event logs**, allowing creation, retr
102102
"count": 5,
103103
"events": [
104104
{
105-
"eve_DateTime": "2025-12-07 12:00:00",
106-
"eve_EventType": "New Device",
107-
"eve_MAC": "AA:BB:CC:DD:EE:FF",
108-
"eve_IP": "192.168.1.100",
109-
"eve_AdditionalInfo": "Device detected"
105+
"eveDateTime": "2025-12-07 12:00:00",
106+
"eveEventType": "New Device",
107+
"eveMac": "AA:BB:CC:DD:EE:FF",
108+
"eveIp": "192.168.1.100",
109+
"eveAdditionalInfo": "Device detected"
110110
}
111111
]
112112
}
@@ -127,9 +127,9 @@ The Events API provides access to **device event logs**, allowing creation, retr
127127
"count": 10,
128128
"events": [
129129
{
130-
"eve_DateTime": "2025-12-07 12:00:00",
131-
"eve_EventType": "Device Down",
132-
"eve_MAC": "AA:BB:CC:DD:EE:FF"
130+
"eveDateTime": "2025-12-07 12:00:00",
131+
"eveEventType": "Device Down",
132+
"eveMac": "AA:BB:CC:DD:EE:FF"
133133
}
134134
]
135135
}
@@ -159,9 +159,9 @@ The Events API provides access to **device event logs**, allowing creation, retr
159159
1. Total events in the period
160160
2. Total sessions
161161
3. Missing sessions
162-
4. Voided events (`eve_EventType LIKE 'VOIDED%'`)
163-
5. New device events (`eve_EventType LIKE 'New Device'`)
164-
6. Device down events (`eve_EventType LIKE 'Device Down'`)
162+
4. Voided events (`eveEventType LIKE 'VOIDED%'`)
163+
5. New device events (`eveEventType LIKE 'New Device'`)
164+
6. Device down events (`eveEventType LIKE 'Device Down'`)
165165

166166
---
167167

@@ -187,7 +187,7 @@ Event endpoints are available as **MCP Tools** for AI assistant integration:
187187
```
188188

189189
* Events are stored in the **Events table** with the following fields:
190-
`eve_MAC`, `eve_IP`, `eve_DateTime`, `eve_EventType`, `eve_AdditionalInfo`, `eve_PendingAlertEmail`.
190+
`eveMac`, `eveIp`, `eveDateTime`, `eveEventType`, `eveAdditionalInfo`, `evePendingAlertEmail`.
191191

192192
* Event creation automatically logs activity for debugging.
193193

docs/API_SESSIONS.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ curl -X DELETE "http://<server_ip>:<GRAPHQL_PORT>/sessions/delete" \
106106
"success": true,
107107
"sessions": [
108108
{
109-
"ses_MAC": "AA:BB:CC:DD:EE:FF",
110-
"ses_Connection": "2025-08-01 10:00",
111-
"ses_Disconnection": "2025-08-01 12:00",
112-
"ses_Duration": "2h 0m",
113-
"ses_IP": "192.168.1.10",
114-
"ses_Info": ""
109+
"sesMac": "AA:BB:CC:DD:EE:FF",
110+
"sesDateTimeConnection": "2025-08-01 10:00",
111+
"sesDateTimeDisconnection": "2025-08-01 12:00",
112+
"sesDuration": "2h 0m",
113+
"sesIp": "192.168.1.10",
114+
"sesAdditionalInfo": ""
115115
}
116116
]
117117
}
@@ -194,12 +194,12 @@ curl -X GET "http://<server_ip>:<GRAPHQL_PORT>/sessions/calendar?start=2025-08-0
194194
"success": true,
195195
"sessions": [
196196
{
197-
"ses_MAC": "AA:BB:CC:DD:EE:FF",
198-
"ses_Connection": "2025-08-01 10:00",
199-
"ses_Disconnection": "2025-08-01 12:00",
200-
"ses_Duration": "2h 0m",
201-
"ses_IP": "192.168.1.10",
202-
"ses_Info": ""
197+
"sesMac": "AA:BB:CC:DD:EE:FF",
198+
"sesDateTimeConnection": "2025-08-01 10:00",
199+
"sesDateTimeDisconnection": "2025-08-01 12:00",
200+
"sesDuration": "2h 0m",
201+
"sesIp": "192.168.1.10",
202+
"sesAdditionalInfo": ""
203203
}
204204
]
205205
}

docs/DEBUG_PLUGINS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo
4343
17:31:05 [Scheduler] run for PIHOLE: YES
4444
17:31:05 [Plugin utils] ---------------------------------------------
4545
17:31:05 [Plugin utils] display_name: PiHole (Device sync)
46-
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
46+
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
4747
17:31:05 [Plugins] setTyp: subnets
4848
17:31:05 [Plugin utils] Flattening the below array
4949
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
5252
17:31:05 [Plugins] Convert to Base64: True
5353
17:31:05 [Plugins] base64 value: b'MTkyLjE2OC4xLjAvMjQgLS1pbnRlcmZhY2U9ZXRoMQ=='
5454
17:31:05 [Plugins] Timeout: 10
55-
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
55+
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
5656
🔻
5757
17:31:05 [Plugins] SUCCESS, received 2 entries
5858
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')]

docs/NOTIFICATIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following device properties influence notifications. You can:
3636
On almost all plugins there are 2 core settings, `<plugin>_WATCH` and `<plugin>_REPORT_ON`.
3737

3838
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.
39-
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.
39+
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.
4040

4141
Click the **Read more in the docs.** Link at the top of each plugin to get more details on how the given plugin works.
4242

docs/NOTIFICATION_TEMPLATES.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ HTML email tables are **not affected** by these templates.
1010

1111
1. Go to **Settings → Notification Processing**.
1212
2. Set a template string for the section you want to customize, e.g.:
13-
- **Text Template: New Devices**`{devName} ({eve_MAC}) - {eve_IP}`
13+
- **Text Template: New Devices**`{devName} ({eveMac}) - {eveIp}`
1414
3. Save. The next notification will use your format.
1515

1616
**Before (default):**
1717
```
1818
🆕 New devices
1919
---------
2020
devName: MyPhone
21-
eve_MAC: aa:bb:cc:dd:ee:ff
21+
eveMac: aa:bb:cc:dd:ee:ff
2222
devVendor: Apple
23-
eve_IP: 192.168.1.42
24-
eve_DateTime: 2025-01-15 10:30:00
25-
eve_EventType: New Device
23+
eveIp: 192.168.1.42
24+
eveDateTime: 2025-01-15 10:30:00
25+
eveEventType: New Device
2626
devComments:
2727
```
2828

29-
**After (with template `{devName} ({eve_MAC}) - {eve_IP}`):**
29+
**After (with template `{devName} ({eveMac}) - {eveIp}`):**
3030
```
3131
🆕 New devices
3232
---------
@@ -51,7 +51,7 @@ When a template is **empty**, the section uses the original vertical `Header: Va
5151
Use `{FieldName}` to insert a value from the notification data. Field names are **case-sensitive** and must match the column names exactly.
5252

5353
```
54-
{devName} ({eve_MAC}) connected at {eve_DateTime}
54+
{devName} ({eveMac}) connected at {eveDateTime}
5555
```
5656

5757
- No loops, conditionals, or nesting — just simple string replacement.
@@ -66,34 +66,34 @@ All four device sections (`new_devices`, `down_devices`, `down_reconnected`, `ev
6666
| Variable | Description |
6767
|----------|-------------|
6868
| `{devName}` | Device display name |
69-
| `{eve_MAC}` | Device MAC address |
69+
| `{eveMac}` | Device MAC address |
7070
| `{devVendor}` | Device vendor/manufacturer |
71-
| `{eve_IP}` | Device IP address |
72-
| `{eve_DateTime}` | Event timestamp |
73-
| `{eve_EventType}` | Type of event (e.g. `New Device`, `Connected`, `Device Down`) |
71+
| `{eveIp}` | Device IP address |
72+
| `{eveDateTime}` | Event timestamp |
73+
| `{eveEventType}` | Type of event (e.g. `New Device`, `Connected`, `Device Down`) |
7474
| `{devComments}` | Device comments |
7575

76-
**Example (new_devices/events):** `{devName} ({eve_MAC}) - {eve_IP} [{eve_EventType}]`
76+
**Example (new_devices/events):** `{devName} ({eveMac}) - {eveIp} [{eveEventType}]`
7777

78-
**Example (down_devices):** `{devName} ({eve_MAC}) {devVendor} - went down at {eve_DateTime}`
78+
**Example (down_devices):** `{devName} ({eveMac}) {devVendor} - went down at {eveDateTime}`
7979

80-
**Example (down_reconnected):** `{devName} ({eve_MAC}) reconnected at {eve_DateTime}`
80+
**Example (down_reconnected):** `{devName} ({eveMac}) reconnected at {eveDateTime}`
8181

8282
### `plugins`
8383

8484
| Variable | Description |
8585
|----------|-------------|
86-
| `{Plugin}` | Plugin code name |
87-
| `{Object_PrimaryId}` | Primary identifier of the object |
88-
| `{Object_SecondaryId}` | Secondary identifier |
89-
| `{DateTimeChanged}` | Timestamp of change |
90-
| `{Watched_Value1}` | First watched value |
91-
| `{Watched_Value2}` | Second watched value |
92-
| `{Watched_Value3}` | Third watched value |
93-
| `{Watched_Value4}` | Fourth watched value |
94-
| `{Status}` | Plugin event status |
95-
96-
**Example:** `{Plugin}: {Object_PrimaryId} - {Status}`
86+
| `{plugin}` | Plugin code name |
87+
| `{objectPrimaryId}` | Primary identifier of the object |
88+
| `{objectSecondaryId}` | Secondary identifier |
89+
| `{dateTimeChanged}` | Timestamp of change |
90+
| `{watchedValue1}` | First watched value |
91+
| `{watchedValue2}` | Second watched value |
92+
| `{watchedValue3}` | Third watched value |
93+
| `{watchedValue4}` | Fourth watched value |
94+
| `{status}` | Plugin event status |
95+
96+
**Example:** `{plugin}: {objectPrimaryId} - {status}`
9797

9898
## Section Headers Toggle
9999

docs/PLUGINS_DEV.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ Quick reference:
179179

180180
| Column | Name | Required | Example |
181181
|--------|------|----------|---------|
182-
| 0 | Object_PrimaryID | **YES** | `"device_name"` or `"192.168.1.1"` |
183-
| 1 | Object_SecondaryID | no | `"secondary_id"` or `null` |
182+
| 0 | objectPrimaryId | **YES** | `"device_name"` or `"192.168.1.1"` |
183+
| 1 | objectSecondaryId | no | `"secondary_id"` or `null` |
184184
| 2 | DateTime | **YES** | `"2023-01-02 15:56:30"` |
185-
| 3 | Watched_Value1 | **YES** | `"online"` or `"200"` |
186-
| 4 | Watched_Value2 | no | `"ip_address"` or `null` |
187-
| 5 | Watched_Value3 | no | `null` |
188-
| 6 | Watched_Value4 | no | `null` |
185+
| 3 | watchedValue1 | **YES** | `"online"` or `"200"` |
186+
| 4 | watchedValue2 | no | `"ip_address"` or `null` |
187+
| 5 | watchedValue3 | no | `null` |
188+
| 6 | watchedValue4 | no | `null` |
189189
| 7 | Extra | no | `"additional data"` or `null` |
190190
| 8 | ForeignKey | no | `"aa:bb:cc:dd:ee:ff"` or `null` |
191191

@@ -243,7 +243,7 @@ Control which rows display in the UI:
243243
{
244244
"data_filters": [
245245
{
246-
"compare_column": "Object_PrimaryID",
246+
"compare_column": "objectPrimaryId",
247247
"compare_operator": "==",
248248
"compare_field_id": "txtMacFilter",
249249
"compare_js_template": "'{value}'.toString()",
@@ -267,7 +267,7 @@ To import plugin data into NetAlertX tables for device discovery or notification
267267
"mapped_to_table": "CurrentScan",
268268
"database_column_definitions": [
269269
{
270-
"column": "Object_PrimaryID",
270+
"column": "objectPrimaryId",
271271
"mapped_to_column": "scanMac",
272272
"show": true,
273273
"type": "device_mac",
@@ -345,7 +345,7 @@ See [PLUGINS_DEV_SETTINGS.md](PLUGINS_DEV_SETTINGS.md) for complete settings doc
345345

346346
### Plugin Output Format
347347
```
348-
Object_PrimaryID|Object_SecondaryID|DateTime|Watched_Value1|Watched_Value2|Watched_Value3|Watched_Value4|Extra|ForeignKey
348+
objectPrimaryId|objectSecondaryId|DateTime|watchedValue1|watchedValue2|watchedValue3|watchedValue4|Extra|ForeignKey
349349
```
350350
9 required columns, 4 optional helpers = 13 max
351351

docs/PLUGINS_DEV_CONFIG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ It also describes plugin output expectations and the main plugin categories.
7777
* `database_column_definitions`
7878
* `mapped_to_table`
7979

80-
**Example:** `Object_PrimaryID → devMAC`
80+
**Example:** `objectPrimaryId → devMAC`
8181

8282
---
8383

@@ -88,9 +88,9 @@ Output values are pipe-delimited in a fixed order.
8888

8989
#### Identifiers
9090

91-
* `Object_PrimaryID` and `Object_SecondaryID` uniquely identify records (for example, `MAC|IP`).
91+
* `objectPrimaryId` and `objectSecondaryId` uniquely identify records (for example, `MAC|IP`).
9292

93-
#### Watched Values (`Watched_Value1–4`)
93+
#### Watched Values (`watchedValue1–4`)
9494

9595
* Used by the core to detect changes between runs.
9696
* Changes in these fields can trigger notifications.
@@ -114,7 +114,7 @@ Output values are pipe-delimited in a fixed order.
114114
### 7. Persistence
115115

116116
* Parsed data is **upserted** into the database.
117-
* Conflicts are resolved using the combined key: `Object_PrimaryID + Object_SecondaryID`.
117+
* Conflicts are resolved using the combined key: `objectPrimaryId + objectSecondaryId`.
118118

119119
---
120120

docs/PLUGINS_DEV_DATASOURCES.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Query the NetAlertX SQLite database and display results.
107107
{
108108
"function": "CMD",
109109
"type": {"dataType": "string", "elements": [{"elementType": "input", "elementOptions": [], "transformers": []}]},
110-
"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",
110+
"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",
111111
"localized": ["name"],
112112
"name": [{"language_code": "en_us", "string": "SQL to run"}],
113113
"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.
118118

119119
```sql
120120
SELECT
121-
e.EventValue as Object_PrimaryID,
122-
d.devName as Object_SecondaryID,
121+
e.EventValue as objectPrimaryId,
122+
d.devName as objectSecondaryId,
123123
e.EventDateTime as DateTime,
124-
e.EventType as Watched_Value1,
125-
d.devLastIP as Watched_Value2,
126-
null as Watched_Value3,
127-
null as Watched_Value4,
124+
e.EventType as watchedValue1,
125+
d.devLastIP as watchedValue2,
126+
null as watchedValue3,
127+
null as watchedValue4,
128128
e.EventDetails as Extra,
129129
d.devMac as ForeignKey
130130
FROM
@@ -181,7 +181,7 @@ Then set data source and query:
181181
```json
182182
{
183183
"function": "CMD",
184-
"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'",
184+
"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'",
185185
"localized": ["name"],
186186
"name": [{"language_code": "en_us", "string": "SQL to run"}]
187187
}

0 commit comments

Comments
 (0)