Skip to content

Repository files navigation

NetWatcher Agent

A lightweight network monitoring agent that reports metrics to the NetWatcher platform.

Features

  • MTR Checks - Traceroute analysis using Trippy
  • Ping Tests - ICMP latency monitoring with pro-bing
  • DNS Monitoring - DNS resolution time and record validation
  • Traffic Simulation - Synthetic UDP traffic between agents
  • System Information - Host metrics and status
  • Network Information - Interface and connectivity data
  • Speedtests - On-demand bandwidth testing
  • Auto-Updates - Automatic version updates from GitHub releases

Requirements

  • Platforms: Linux, macOS, Windows
  • Permissions: Root/Administrator (required for ICMP and raw sockets)
  • NetWatcher Controller: Running instance of netwatcher-oss

Quick Start

Linux

# Download and run the installer
curl -fsSL https://raw.githubusercontent.com/netwatcherio/agent/master/install.sh | sudo bash -s -- \
--workspace YOUR_WORKSPACE_ID \
--id YOUR_AGENT_ID \
--pin YOUR_AGENT_PIN

Windows (PowerShell as Administrator)

# Download the installerInvoke-WebRequest-Uri "https://raw.githubusercontent.com/netwatcherio/agent/master/install.ps1"-OutFile "install.ps1"# Run the installer
.\install.ps1 -Workspace YOUR_WORKSPACE_ID -Id YOUR_AGENT_ID -Pin "YOUR_AGENT_PIN"

Note: If you encounter an execution policy error, run PowerShell as Administrator and use:

powershell -ExecutionPolicy Bypass -File install.ps1 -Workspace YOUR_WORKSPACE_ID -Id YOUR_AGENT_ID -Pin "YOUR_AGENT_PIN"

macOS

# Download and run the installer (user-level, no sudo)
curl -fsSL https://raw.githubusercontent.com/netwatcherio/agent/master/install-macos.sh | bash -s -- \
--workspace YOUR_WORKSPACE_ID \
--id YOUR_AGENT_ID \
--pin YOUR_AGENT_PIN
# Or system-level (requires sudo, runs at boot)
curl -fsSL https://raw.githubusercontent.com/netwatcherio/agent/master/install-macos.sh | sudo bash -s -- \
--workspace YOUR_WORKSPACE_ID \
--id YOUR_AGENT_ID \
--pin YOUR_AGENT_PIN \
--system

For detailed macOS installation and administration documentation, see docs/agent-installation-macos.md.

Self-Hosted Deployment

For self-hosted NetWatcher instances:

# Linux
curl -fsSL https://raw.githubusercontent.com/netwatcherio/agent/master/install.sh | sudo bash -s -- \
--host your-controller.example.com \
--ssl true \
--workspace 1 \
--id 42 \
--pin 123456789
# Windows
powershell -ExecutionPolicy Bypass -File install.ps1 -Host "your-controller.example.com"-SSL $true-Workspace 1-Id 42-Pin "123456789"

Configuration

The agent stores its configuration in config.conf:

ParameterDescription
CONTROLLER_HOSTController hostname (e.g., api.netwatcher.io)
CONTROLLER_SSLUse HTTPS/WSS (true or false)
WORKSPACE_IDWorkspace ID
AGENT_IDAgent ID
AGENT_PINInitial authentication PIN

Configuration Locations

PlatformPath
Linux/opt/netwatcher-agent/config.conf
macOS (user-level)~/netwatcher-agent/config.conf
macOS (system-level)/var/root/netwatcher-agent/config.conf
WindowsC:\Program Files\NetWatcher-Agent\config.conf

Service Management

Linux (systemd)

sudo systemctl status netwatcher-agent # Check status
sudo systemctl restart netwatcher-agent # Restart
sudo journalctl -u netwatcher-agent -f # View logs

Windows

Get-Service-Name NetWatcherAgent # Check statusRestart-Service-Name NetWatcherAgent # RestartGet-EventLog-LogName Application -Source NetWatcherAgent -Newest 20# View logs

macOS (launchd)

# User-level service
launchctl list | grep com.netwatcher.agent # Check status
tail -f ~/netwatcher-agent/agent.log # View logs
launchctl stop com.netwatcher.agent && launchctl start com.netwatcher.agent # Restart# System-level service
sudo launchctl list | grep com.netwatcher.agent # Check status
sudo tail -f /var/root/netwatcher-agent/agent.log # View logs

Installer Options

Linux (install.sh)

FlagDescription
--workspace, -wWorkspace ID (required for install)
--id, -iAgent ID (required for install)
--pin, -pAgent PIN (required for install)
--hostController host (default: api.netwatcher.io)
--sslUse SSL/HTTPS — true or false (default: true)
--install-dirInstallation directory (default: /opt/netwatcher-agent)
--versionInstall a specific version tag
--forceForce reinstallation or skip uninstall confirmation
--no-serviceSkip systemd service creation
--no-startDon't start the service after installation
--updateUpdate only the binary (preserves config and service)
--uninstallUninstall the agent
--debugEnable debug output
# Update to latest
sudo ./install.sh --update
# Update to specific version
sudo ./install.sh --update --version v20260219-5c692b8
# Uninstall
sudo ./install.sh --uninstall
# Force uninstall without confirmation
sudo ./install.sh --uninstall --force

macOS (install-macos.sh)

FlagDescription
--workspace, -wWorkspace ID (required for install)
--id, -iAgent ID (required for install)
--pin, -pAgent PIN (required for install)
--hostController host (default: api.netwatcher.io)
--sslUse SSL/HTTPS — true or false (default: true)
--install-dirInstallation directory (default: ~/netwatcher-agent)
--systemInstall as system-level service (requires sudo)
--userInstall as user-level service (default, no sudo)
--forceForce reinstallation or skip uninstall confirmation
--no-serviceSkip launchd service creation
--no-startDon't start the service after installation
--versionInstall a specific version tag
--updateUpdate only the binary (preserves config and service)
--uninstallUninstall the agent
--debugEnable debug output
# Update to latest
./install-macos.sh --update
# Update to specific version
./install-macos.sh --update --version v20260219-5c692b8
# Uninstall
./install-macos.sh --uninstall
# Force uninstall without confirmation
./install-macos.sh --uninstall --force

Windows (install.ps1)

FlagDescription
-WorkspaceWorkspace ID (required for install)
-IdAgent ID (required for install)
-PinAgent PIN (required for install)
-ControllerHostController host (default: api.netwatcher.io)
-SSLUse SSL/HTTPS (default: $true)
-InstallDirInstallation directory (default: C:\Program Files\NetWatcher-Agent)
-VersionInstall a specific version tag
-ForceForce reinstallation
-NoStartDon't start the service after installation
-UpdateUpdate only the binary (preserves config and service)
-UpdateVersionSpecific version to update to (used with -Update)
-UninstallUninstall the agent
# Update to latest
.\install.ps1 -Update
# Update to specific version
.\install.ps1 -Update -UpdateVersion "v20260219-5c692b8"# Uninstall
.\install.ps1 -Uninstall
# Force uninstall without confirmation
.\install.ps1 -Uninstall -Force

Troubleshooting

Failed Auto-Updates

If the agent's auto-update fails (e.g., read-only /tmp, network issues), use the install script to manually update. See Installer Options above for all flags.

# Linux
sudo ./install.sh --update
# Windows
.\install.ps1 -Update

Manual Binary Replacement

If the install script isn't available, manually replace the binary:

# 1. Stop the service
sudo systemctl stop netwatcher-agent
# 2. Download the latest release# Visit: https://github.com/netwatcherio/agent/releases/latest# Download the appropriate file for your platform (e.g., linux-amd64.zip)# 3. Extract and replacecd /opt/netwatcher-agent
unzip ~/Downloads/netwatcher-*.zip -d /tmp/nw-update
cp /tmp/nw-update/netwatcher-agent ./netwatcher-agent
chmod +x ./netwatcher-agent
# 4. Verify and restart
./netwatcher-agent --version
sudo systemctl start netwatcher-agent

Common Issues

IssueSolution
Auto-update fails with "read-only file system"Updated agents create .tmp folder locally instead of using /tmp. Update manually with --update flag.
Service fails to start after updateCheck logs: journalctl -u netwatcher-agent -n 50. Rollback if needed by restoring .backup file.
Agent not connecting to controllerVerify config.conf settings, check firewall, ensure controller is reachable.
"Unauthorized" errorsRe-bootstrap with correct PIN or generate new agent credentials in the dashboard.

Viewing Logs

# Linux - Follow logs live
sudo journalctl -u netwatcher-agent -f
# Linux - Last 100 lines
sudo journalctl -u netwatcher-agent -n 100
# macOS - User-level
tail -f ~/netwatcher-agent/agent.log
# macOS - System-level
sudo tail -f /var/root/netwatcher-agent/agent.log
# Windows
Get-EventLog -LogName Application -Source NetWatcherAgent -Newest 50

Building from Source

git clone https://github.com/netwatcherio/agent
cd agent
go build -o netwatcher-agent

Libraries

License

GNU Affero General Public License v3.0

About

A lightweight network monitoring agent that reports metrics to the NetWatcher platform.

Topics

Resources

Stars

8 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages