You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/skills/code-standards/SKILL.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,22 @@ description: NetAlertX coding standards and conventions. Use this when writing c
8
8
- ask me to review before going to each next step (mention n step out of x) (AI only)
9
9
- before starting, prepare implementation plan (AI only)
10
10
- ask me to review it and ask any clarifying questions first
11
-
- add test creation as last step - follow repo architecture patterns - do not place in the root of /test
11
+
- add test creation as last step - follow repo architecture patterns - do not place in the root of `/test`
12
12
- code has to be maintainable, no duplicate code
13
13
- follow DRY principle - maintainability of code is more important than speed of implementation
14
14
- code files should be less than 500 LOC for better maintainability
15
15
- DB columns must not contain underscores, use camelCase instead (e.g., deviceInstanceId, not device_instance_id)
16
-
- treat DB as temporary storage for stats, long term configuration should be stored in the /config folder, the /config folder should allow you to restore most of your functionality (excluding historical data)
16
+
- treat DB as temporary storage for stats, long-term configuration should be stored in the `/config` folder, the `/config` folder should allow you to restore most of your functionality (excluding historical data)
17
+
- never access DB directly from application layers, always use helper functions in `server/db/db_helper.py` and implement new functionality in handlers (e.g., `DeviceInstance` in `server/models/device_instance.py`)
18
+
- always validate and normalize MAC addresses before writing to DB (use `normalize_mac` from `plugin_helper.py`)
19
+
- all subprocess calls must set explicit timeouts
20
+
- use `timeNowUTC` from `utils.datetime_utils` for all time-related operations and DB timestamps (store all timestamps in UTC)
21
+
- use sanitizers from `server/helper.py` for user input before storing in DB
22
+
- reuse shared mocks and factories from `test/db_test_helpers.py` for tests, never redefine them locally
23
+
- use environment variables for runtime paths, never hardcode paths or use relative paths
24
+
- follow existing code style and structure, and ensure backward compatibility with existing installations when submitting PRs
25
+
- all code needs to be scalable to handle large networks with thousands of devices (10k+) without performance degradation
@@ -170,6 +170,7 @@ Get notified about a new release, what new functionality you can use and about b
170
170
-[Fing](https://www.fing.com/) - Network scanner app for your Internet security (Commercial, Phone App, Proprietary hardware)
171
171
-[NetBox](https://netboxlabs.com/) - The gold standard for Network Source of Truth (NSoT) and IPAM.
172
172
-[Zabbix](https://www.zabbix.com/) or [Nagios](https://www.nagios.org/) - Strong focus on infrastructure monitoring.
173
+
-[Domotz](https://www.domotz.com/) - Commercial network monitoring and remote management platform aimed at MSPs, IT teams, and multi-site environments.
173
174
-[NetAlertX](https://netalertx.com) - The streamlined, discovery-focused choice for real-time asset intelligence and noise-free alerting.
Copy file name to clipboardExpand all lines: docs/ADVISORY_EYES_ON_GLASS.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,9 @@ For Managed Service Providers (MSPs) and Network Operations Centers (NOC), "Eyes
4
4
5
5

6
6
7
+
> [!TIP]
8
+
> If you are using Grafana check the `/metrics` endpoint that exposes **Prometheus-compatible metrics** for NetAlertX, including aggregate device counts and per-device status. See the [Metrics API endpoint](./API_METRICS.md) documentation for details.
Copy file name to clipboardExpand all lines: docs/ADVISORY_MULTI_NETWORK.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,20 +12,25 @@ Effective multi-network monitoring starts with understanding how NetAlertX "sees
12
12
***Manual Entry:** For static assets where only ICMP (ping) status is needed.
13
13
14
14
> [!TIP]
15
-
> Explore the [remote networks](./REMOTE_NETWORKS.md) documentation for more details on how to set up the approaches menationed above.
15
+
> Explore the [remote networks](./REMOTE_NETWORKS.md) documentation for more details on how to set up the approaches mentioned above.
16
16
17
17
---
18
18
19
19
### 2. Automating IT Asset Inventory with Workflows
20
20
21
-
[Workflows](./WORKFLOWS.md) are the "engine" of NetAlertX, reducing manual overhead as your device list grows.
21
+
[Workflows](./WORKFLOWS.md) are the "engine" of NetAlertX, reducing manual overhead as your device list grows. See some examples below:
22
+
23
+
#### A. Logical Ownership & VLAN Tagging
24
+
25
+
Create a workflow triggered on **Device Creation** to:
22
26
23
-
***A. Logical Ownership & VLAN Tagging:** Create a workflow triggered on **Device Creation** to:
24
27
1. Inspect the IP/Subnet.
25
28
2. Set `devVlan` or `devOwner` custom fields automatically.
26
29
30
+
#### B. Auto-Grouping:
31
+
32
+
Use conditional logic to categorize devices.
27
33
28
-
***B. Auto-Grouping:** Use conditional logic to categorize devices.
29
34
**Example:* If `devLastIP == 10.10.20.*`, then `Set devLocation = "BranchOffice"`.
30
35
31
36
```json
@@ -56,9 +61,9 @@ Effective multi-network monitoring starts with understanding how NetAlertX "sees
56
61
]
57
62
}
58
63
```
64
+
#### C. Sync Node Tracking
59
65
60
-
61
-
***C. Sync Node Tracking:** When using multiple instances, ensure all synchub nodes have a descriptive `SYNC_node_name` name to distinguish between sites.
66
+
When using multiple instances, ensure all sync hub nodes have a descriptive `SYNC_node_name` name to distinguish between sites.
62
67
63
68
> [!TIP]
64
69
> Always test new workflows in a "Staging" instance. A misconfigured workflow can trigger thousands of unintended updates across your database.
@@ -107,6 +112,7 @@ As your environment grows, tuning the underlying engine is vital to maintain a s
107
112
***Plugin Scheduling:** Avoid "Scan Storms" by staggering plugin execution. Running intensive tasks like `NMAP` or `MASS_DNS` simultaneously can spike CPU and cause database locks.
108
113
***Database Health:** Large-scale monitoring generates massive event logs. Use the **[DBCLNP (Database Cleanup)](https://www.google.com/search?q=https://docs.netalertx.com/PLUGINS/%23dbclnp)** plugin to prune old records and keep the SQLite database performant.
109
114
***Resource Management:** For high-device counts, consider increasing the memory limit for the container and utilizing `tmpfs` for temporary files to reduce SD card/disk I/O bottlenecks.
115
+
* Enable the `DEEP_SLEEP` setting.
110
116
111
117
> [!IMPORTANT]
112
118
> For a deep dive into hardware requirements, database vacuuming, and specific environment variables for high-load instances, refer to the full **[Performance Optimization Guide](https://docs.netalertx.com/PERFORMANCE/)**.
Copy file name to clipboardExpand all lines: docs/DEVICE_FIELD_LOCK.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Quick Reference Guide - Device Field Lock/Unlock System
2
2
3
+
> For how scan overwrite rules (`SET_ALWAYS`, `SET_EMPTY`) and source tracking work under the hood, see [Device Source Fields](./DEVICE_SOURCE_FIELDS.md).
4
+
3
5
## Overview
4
6
5
7

Copy file name to clipboardExpand all lines: docs/DEVICE_SOURCE_FIELDS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Understanding Device Source Fields and Field Updates
2
2
3
+
> For the UI guide on locking and unlocking individual fields, see [Device Field Lock/Unlock](./DEVICE_FIELD_LOCK.md).
4
+
3
5
When the system scans a network, it finds various details about devices (like names, IP addresses, and manufacturers). To ensure the data remains accurate without accidentally overwriting manual changes, the system uses a set of "Source Rules."
4
6
5
7

@@ -17,6 +19,8 @@ Every piece of information for a device has a **Source**. This source determines
17
19
|**NEWDEV**| This value was initialized from `NEWDEV` plugin settings. |**Always**|
18
20
|**(Plugin Name)**| The value was found by a specific scanner (e.g., `NBTSCAN`). |**Only if specific rules are met**|
19
21
22
+
> For how `USER` and `LOCKED` sources are set through the UI (lock/unlock buttons), see [Device Field Lock/Unlock](./DEVICE_FIELD_LOCK.md).
23
+
20
24
---
21
25
22
26
## How Scans Update Information
@@ -34,6 +38,8 @@ Some plugins are configured to be "authoritative." If a field is in the **SET_AL
34
38
* The scanner will **always** overwrite the current value with the new one.
35
39
**Note: It will still never overwrite a `USER` or `LOCKED` field.*
36
40
41
+
> On large networks, enabling `SET_ALWAYS` on name-resolution fields (e.g., `devName`) widens the resolution scope and increases DNS query volume. See [Performance — Plugin Field Authority](./PERFORMANCE.md#plugin-field-authority-set_always-and-set_empty) for details.
Copy file name to clipboardExpand all lines: docs/PERFORMANCE.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,41 @@ For example, the **ICMP plugin** allows scanning only IPs that match a specific
95
95
96
96
---
97
97
98
+
## Plugin Field Authority: `SET_ALWAYS` and `SET_EMPTY`
99
+
100
+
Plugins can be configured to control how aggressively they overwrite existing device field values via two settings:
101
+
102
+
| Setting | Behaviour |
103
+
|---|---|
104
+
|`<PLUGIN>_SET_ALWAYS`| Plugin always overwrites the field, as long as it can resolve a value and the field is not `USER`/`LOCKED`|
105
+
|`<PLUGIN>_SET_EMPTY`| Plugin only writes when the field is currently empty |
106
+
107
+
Both settings accept a list of field names (e.g., `devName`, `devFQDN`). See [Name resolution](./NAME_RESOLUTION.md) and [Field locking](./DEVICE_SOURCE_FIELDS.md) docs for details.
108
+
109
+
### Performance Impact of `SET_ALWAYS` on Name Resolution
110
+
111
+
By default, name resolution (DIGSCAN, NBTSCAN, NSLOOKUP, AVAHISCAN) only runs against **devices that have no name yet**. This keeps DNS query volume proportional to new devices discovered, not the total inventory.
112
+
113
+
When **any** name-resolution plugin has `devName` in its `SET_ALWAYS` list, the system additionally runs a second resolution pass against **all devices whose name is not `USER`/`LOCKED` protected**. This allows a higher-priority plugin (e.g., DIGSCAN) to overwrite names previously set by a lower-priority one (e.g., NBTSCAN).
114
+
115
+
**Cost:** one DNS query per unprotected, already-named device per name-resolution cycle.
116
+
117
+
| Scenario | Devices resolved per cycle |
118
+
|---|---|
119
+
| No `SET_ALWAYS` on `devName`| Only new/unknown devices |
120
+
|`SET_ALWAYS: devName` on any plugin | New/unknown devices **+** all unprotected named devices |
121
+
122
+
> [!WARNING]
123
+
> On large installations (thousands of devices), enabling `SET_ALWAYS: devName` significantly increases DNS query volume and cycle duration. To mitigate:
124
+
>
125
+
> * Increase the scan interval of name-resolution plugins (`DIGSCAN_RUN_SCHD`, `NBTSCAN_RUN_SCHD`, etc.).
126
+
> * Mark devices whose name should never change as `USER` or `LOCKED` — they are excluded from the re-resolve pass entirely.
127
+
> * Use `SET_ALWAYS` only on the highest-priority plugin; leave lower-priority plugins without it.
128
+
129
+
The actual number of DB rows updated is logged at `verbose` level under `[Update Device Name] SET_ALWAYS re-resolve - DB rows updated`.
130
+
131
+
---
132
+
98
133
## Storing Temporary Files in Memory
99
134
100
135
On devices with slower I/O, you can improve performance by storing temporary files (and optionally the database) in memory using `tmpfs`.
Copy file name to clipboardExpand all lines: docs/PLUGINS_DEV_UI_COMPONENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ Configure how your plugin's data is displayed in the NetAlertX web interface.
7
7
Plugin results are displayed in the UI via the **Plugins page** and **Device details tabs**. You control the appearance and functionality of these displays by defining `database_column_definitions` in your plugin's `config.json`.
8
8
9
9
Each column definition specifies:
10
+
10
11
- Which data field to display
11
12
- How to render it (label, link, color-coded badge, etc.)
12
13
- What CSS classes to apply
@@ -275,6 +276,7 @@ Replaces specific values with display strings or HTML.
Copy file name to clipboardExpand all lines: docs/WORKFLOW_EXAMPLES.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,22 +45,22 @@ Sometimes devices are manually archived (e.g., no longer expected on the network
45
45
],
46
46
"enabled": "Yes"
47
47
}
48
-
```
48
+
````
49
49
50
50
### 🔍 Explanation
51
51
52
-
- Trigger: Listens for updates to device records.
53
-
- Conditions:
54
-
- `devIsArchived` is `1` (archived).
55
-
- `devPresentLastScan` is `1` (device was detected in the latest scan).
56
-
- Action: Updates the device to set `devIsArchived` to `0` (unarchived).
52
+
* **Trigger**: Listens for updates to device records.
53
+
* **Conditions**:
57
54
58
-
### ✅ Result
55
+
* `devIsArchived` is `1` (archived).
56
+
* `devPresentLastScan` is `1` (device was detected in the latest scan).
57
+
* **Action**:
59
58
60
-
Whenever a previously archived device shows up during a network scan, it will be automatically unarchived — allowing it to reappear in your device lists and dashboards.
59
+
* Updates the device to set `devIsArchived` to `0` (unarchived).
61
60
61
+
### ✅ Result
62
62
63
-
Here is your updated version of **Example 2** and **Example 3**, fully aligned with the format and structure of **Example 1** for consistency and professionalism:
63
+
Whenever a previously archived device shows up during a network scan, it will be automatically unarchived — allowing it to reappear in your device lists and dashboards.
64
64
65
65
---
66
66
@@ -107,7 +107,7 @@ When new devices join your network, assigning them to the correct network node i
107
107
### 🔍 Explanation
108
108
109
109
***Trigger**: Activates when a new device is added.
0 commit comments