https://github.com/bkahlert/netmon
A network monitor that detects and displays changes in your home network
https://github.com/bkahlert/netmon
embedded fritz2 javascript kmp kotlin monitor multiplatform network raspberry-pi rpi
Last synced: 3 months ago
JSON representation
A network monitor that detects and displays changes in your home network
- Host: GitHub
- URL: https://github.com/bkahlert/netmon
- Owner: bkahlert
- License: mit
- Created: 2023-07-28T11:57:21.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-08T00:59:23.000Z (over 1 year ago)
- Last Synced: 2025-02-01T23:41:32.338Z (5 months ago)
- Topics: embedded, fritz2, javascript, kmp, kotlin, monitor, multiplatform, network, raspberry-pi, rpi
- Language: Kotlin
- Homepage:
- Size: 52.1 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Netmon [](https://github.com/bkahlert/netmon/blob/master/LICENSE) [](https://www.buymeacoffee.com/bkahlert)
## About
**Netmon** is a network monitor that detects and displays changes in your home network.
It uses `nmap` to detect devices and additionally used mDNS and NetBIOS to resolve hostnames.
[
Loading screen](./docs/netmon-loading.gif)[
Recent network scan](./docs/netmon-running.gif)The application consists of three independent parts:
- a JVM-based network scanner that publishes appearing and disappearing hosts using MQTT,
- a Kotlin/JS and [Fritz2](https://github.com/jwstegemann/fritz2) based web interface that display the results, by subscribing to MQTT, and
- a [Ansible-based installer](ansible/README.md) that installs everyone on a Raspberry Pi (including the Pi 1 and Zero).[
Netmon on a Raspberry Pi Zero with an 7-inch screen](./docs/netmon-rpi0.jpg)Find detailed installation instructions in [ansible/README.md](ansible/README.md).
## Development
### Run locally
#### Run the scanner component locally
```shell
./gradlew runShadow
```#### Run the web display component locally
```shell
./gradlew jsBrowserDevelopmentRun --continuous
```### Run remotely
If you [installed Netmon on a Raspberry Pi](ansible/README.md), you can use
the handy [patch tool](ansible/patch).Just switch the directory, make [patch](ansible/patch) executable, and
set the `HOST` to work with:```shell
cd ansible
chmod +x patch
export HOST=foo.local
```#### Build and update the remote scanner component
```shell
SCANNER=1 ./patch
```#### Build and update the remote web display component
```shell
WEB_DISPLAY=1 ./patch
```#### Build and update the remote scanner *and* web display component
```shell
SCANNER=1 WEB_DISPLAY=1 ./patch
```> 💡 You can export your preferred settings, e.g. `export SCANNER=1 WEB_DISPLAY=1` to only have to type `./patch`.
### MQTT
#### Publish a host event
```shell
BROKER_HOST=test.mosquitto.org BROKER_PORT=1883
mqtt pub -t "dt/netmon/test/en0/10.10.10.0/24/host" -m '{
"event": "host",
"type": "up",
"host": {
"ip": "10.10.10.10",
"name": "test.local",
"status": "up",
"since": 1692455344
}
}' -r -h "$BROKER_HOST" -p "$BROKER_PORT"
```#### Subscribe to host events
```shell
BROKER_HOST=test.mosquitto.org BROKER_PORT=1883
mqtt sub -t dt/netmon/+/+/+/+/host -h "$BROKER_HOST" -p "$BROKER_PORT" -J
```#### Delete a retained host event
```shell
BROKER_HOST=test.mosquitto.org BROKER_PORT=1883
mqtt pub -t "dt/netmon/test/en0/10.10.10.0/24/host" -m '' -r -h "$BROKER_HOST" -p "$BROKER_PORT"
```### Update MQTT.js
```shell
(cd mqtt.js && ./build.sh)
```See [mqtt.js/README.md](mqtt.js/README.md) for details.
## Contributing
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You
can also support this project by making
a [PayPal donation](https://www.paypal.me/bkahlert) to ensure this journey continues indefinitely!Thanks again for your support, it is much appreciated! :pray:
## License
MIT. See [LICENSE](LICENSE) for more details.