Skip to content
Merged

sync #1678

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
197e3a3
feat: add adguard_export plugin and tests
natecj May 20, 2026
ca7a699
fix: address PR review feedback on adguard_export plugin
natecj May 23, 2026
0387d74
Merge pull request #1634 from netalertx/next_release
jokob-sk May 24, 2026
a95aaa4
Merge pull request #1653 from netalertx/next_release
jokob-sk May 24, 2026
8e391f5
Translated using Weblate (Japanese)
May 24, 2026
bfe5bc0
Merge pull request #1654 from netalertx/next_release
jokob-sk May 25, 2026
494340a
Merge pull request #1655 from netalertx/next_release
jokob-sk May 26, 2026
1ede51c
Merge pull request #1658 from netalertx/next_release
jokob-sk May 26, 2026
93e534c
refactor: use DeviceInstance model instead of direct SQLite query
natecj May 27, 2026
75c266c
Merge pull request #1660 from netalertx/next_release
jokob-sk May 28, 2026
6845104
Translated using Weblate (Russian)
YoSafeguard May 28, 2026
727fe0e
Merge branch 'main' into feat/adguard-export-plugin
jokob-sk May 29, 2026
8f1da10
Merge pull request #1649 from natecj/feat/adguard-export-plugin
jokob-sk May 29, 2026
2ca5a80
Merge pull request #1665 from netalertx/next_release
jokob-sk Jun 2, 2026
52defd2
Merge pull request #1668 from netalertx/next_release
jokob-sk Jun 2, 2026
6819f14
feat(server): optional default for get_setting_value
Kartalops Jun 3, 2026
01d37fa
Merge pull request #1669 from Arvuno/feat/setting-value-default
jokob-sk Jun 3, 2026
718c2a9
Merge pull request #1670 from netalertx/next_release
jokob-sk Jun 4, 2026
62c4833
Merge pull request #1672 from netalertx/next_release
jokob-sk Jun 14, 2026
3e08505
Merge pull request #1673 from netalertx/next_release
jokob-sk Jun 15, 2026
4075aa4
Merge pull request #1675 from netalertx/next_release
jokob-sk Jun 17, 2026
3752d74
Merge pull request #1676 from netalertx/next_release
jokob-sk Jun 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions front/php/templates/language/ja_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"CustProps_cant_remove": "削除できません。少なくとも1つのプロパティが必要です。",
"DAYS_TO_KEEP_EVENTS_description": "これはメンテナンス設定です。イベントエントリを保持する日数を指定します。それより古いイベントは定期的に削除されます。プラグインイベント履歴にも適用されます。",
"DAYS_TO_KEEP_EVENTS_name": "古いイベントの削除",
"DEEP_SLEEP_description": "",
"DEEP_SLEEP_name": "",
"DEEP_SLEEP_description": "処理サイクル間のアイドル待機時間を延長することで、CPU使用率を低減します。この機能を有効にすると、スキャンが最大1分間遅延したり、UIの反応が悪くなったりする場合があります。",
"DEEP_SLEEP_name": "ディープスリープ",
"DISCOVER_PLUGINS_description": "このオプションを無効にすると、初期化と設定の保存が高速化されます。無効にした場合、プラグインは検出されず、<code>LOADED_PLUGINS</code> 設定に新しいプラグインを追加することはできません。",
"DISCOVER_PLUGINS_name": "プラグインの検出",
"DevDetail_Children_Title": "親子関係",
Expand Down Expand Up @@ -249,8 +249,8 @@
"Device_TableHead_Name": "名前",
"Device_TableHead_NetworkSite": "ネットワークサイト",
"Device_TableHead_Owner": "所有者",
"Device_TableHead_ParentRelType": "関係種別",
"Device_TableHead_Parent_MAC": "親ネットワークノード",
"Device_TableHead_ParentRelType": "関係",
"Device_TableHead_Parent_MAC": "親ノード",
"Device_TableHead_Port": "ポート",
"Device_TableHead_PresentLastScan": "検出",
"Device_TableHead_ReqNicsOnline": "OnlineのNICが必要",
Expand Down Expand Up @@ -346,7 +346,7 @@
"Gen_LockedDB": "エラー - DBがロックされている可能性があります - F12で開発者ツール→コンソールを確認するか、後で試してください。",
"Gen_NetworkMask": "ネットワークマスク",
"Gen_New": "New",
"Gen_No_Data": "",
"Gen_No_Data": "データなし",
"Gen_Offline": "オフライン",
"Gen_Okay": "Ok",
"Gen_Online": "オンライン",
Expand Down Expand Up @@ -808,4 +808,4 @@
"settings_system_label": "システム",
"settings_update_item_warning": "以下の値を更新してください。以前のフォーマットに従うよう注意してください。<b>検証は行われません。</b>",
"test_event_tooltip": "設定をテストする前に、まず変更を保存してください。"
}
}
2 changes: 1 addition & 1 deletion front/php/templates/language/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"AppEvents_ObjectType": "Тип объекта",
"AppEvents_Plugin": "Плагин",
"AppEvents_Type": "Тип",
"BACKEND_API_URL_description": "Используется для обеспечения связи между фронтендом и бэкендом. По умолчанию это значение установлено на <code>/server</code> и, как правило, не должно изменяться.",
"BACKEND_API_URL_description": "Используется для обеспечения связи между фронтендом и бэкендом. По умолчанию это значение установлено на <code>/server</code> и, как правило, не должно изменяться.",
"BACKEND_API_URL_name": "URL-адрес серверного API",
"BackDevDetail_Actions_Ask_Run": "Вы хотите выполнить действие?",
"BackDevDetail_Actions_Not_Registered": "Действие не зарегистрировано:· ",
Expand Down
140 changes: 140 additions & 0 deletions front/plugins/adguard_export/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# adguard_export — NetAlertX Plugin

> **Direction:** NetAlertX → AdGuard Home
> Syncs known devices from the NetAlertX database to AdGuard Home as **persistent clients**, keeping device names, MAC addresses, and IP identifiers in sync.

---

## What it does

On every run the plugin:

1. Reads all (or only *known*) devices from the NetAlertX database.
2. Fetches the current list of persistent clients from AdGuard Home via its REST API.
3. **Adds** clients that are in NetAlertX but not yet in AdGuard Home.
4. **Updates** clients whose name, identifiers, or device-type tag have changed.
5. Optionally **deletes** clients that have been removed from NetAlertX (see `DELETE` setting).

Device types set in NetAlertX (e.g. `Smartphone`, `Laptop`, `NAS`) are automatically mapped to the corresponding AdGuard Home `device_*` tags (e.g. `device_phone`, `device_laptop`, `device_nas`).

---

## Requirements

| Requirement | Notes |
|---|---|
| AdGuard Home | v0.107+ (REST API must be enabled) |
| Python packages | `requests`, `pytz` — already present in the NetAlertX container |
| AdGuard credentials | A user account with permission to manage clients |

---

## Installation

1. Copy the `adguard_export/` folder into `/app/front/plugins/` inside your NetAlertX container (or mount it as a volume).
2. Restart NetAlertX so the plugin is discovered.
3. Open **Settings → Plugins → AdGuard (Device Export)** and configure the settings below.

---

## Settings

| Setting key | Default | Description |
|---|---|---|
| `ADGUARDEXP_RUN` | `disabled` | When to run: `disabled`, `once`, or `schedule` |
| `ADGUARDEXP_RUN_SCHD` | `0 * * * *` | Cron schedule (default: hourly) |
| `ADGUARDEXP_URL` | `http://localhost:3000` | Base URL of AdGuard Home web UI |
| `ADGUARDEXP_USER` | `admin` | AdGuard Home username |
| `ADGUARDEXP_PASSWORD` | *(empty)* | AdGuard Home password |
| `ADGUARDEXP_VERIFYSSL` | `true` | Verify TLS cert; set `false` for self-signed certs |
| `ADGUARDEXP_INCLUDE_OFFLINE` | `true` | When `true`, devices not seen in the last scan are still exported |
| `ADGUARDEXP_INCLUDE_NEW` | `false` | When `false`, devices flagged as new/unknown are excluded until identified |
| `ADGUARDEXP_USEMAC` | `true` | Use MAC address as primary client identifier; falls back to IP |
| `ADGUARDEXP_DELETE` | `false` | ⚠ Delete AdGuard clients no longer present in NetAlertX |

---

## AdGuard Home client identifiers

AdGuard Home identifies a client by one or more **ids**, which can be:

- A MAC address (e.g. `aa:bb:cc:dd:ee:ff`)
- An IP address (e.g. `192.168.1.42`)
- A CIDR range
- A ClientID string

When `ADGUARDEXP_USEMAC=true`, the plugin prefers the device's MAC address and includes the last known IP as a secondary identifier. When `ADGUARDEXP_USEMAC=false`, only the IP address is used.

---

## Device type tags

The plugin maps NetAlertX device types to valid AdGuard Home `device_*` tags automatically:

| NetAlertX type | AdGuard tag |
|---|---|
| Smartphone, Phone, Mobile | `device_phone` |
| Laptop, Notebook | `device_laptop` |
| Desktop, Server, Hypervisor | `device_pc` |
| Tablet | `device_tablet` |
| Smart TV, SmartTV, TV | `device_tv` |
| NAS | `device_nas` |
| Printer | `device_printer` |
| IP Camera, Camera | `device_camera` |
| Game Console | `device_gameconsole` |
| Speaker, Assistant, Virtual Assistance | `device_audio` |
| AP, Gateway, Router, House Appliance | `device_other` |

Devices with an unrecognised or empty type are exported without a tag.

---

## Safe deletion

When `ADGUARDEXP_DELETE=true`, the plugin only removes clients it previously created — it will never delete clients you added manually in AdGuard Home. Ownership is tracked in a local state file at:

```text
/app/db/state.ADGUARDEXP.json
```

---

## Logs

Plugin logs are written to:

```text
/tmp/log/plugins/script.ADGUARDEXP.log
```

Result rows (used by the NetAlertX UI) are written to:

```text
/tmp/log/plugins/last_result.ADGUARDEXP.log
```

---

## Troubleshooting

| Symptom | Likely cause |
|---|---|
| `Connection failed` in logs | Wrong `ADGUARDEXP_URL` or AdGuard Home is unreachable from the NetAlertX container |
| `HTTP error: 401` | Wrong username / password |
| `HTTP error: 400` | Client already exists with conflicting ids — check AdGuard Home for duplicate entries |
| Devices not appearing | `ADGUARDEXP_INCLUDE_NEW=false` and devices are flagged as new/unknown; identify them in NetAlertX first |
| SSL errors | Set `ADGUARDEXP_VERIFYSSL=false` for self-signed certificates |

---

## Related plugins

- **adguard_import** — the reverse direction: imports devices *from* AdGuard Home *into* NetAlertX.

---

### Other info

- Version: 1.0.0
- Maintainer: [natecj](https://github.com/natecj)
- Release Date: 10-May-2026
Loading
Loading