• Latest
  • Trending
  • All
Server Monitoring withNagios on Hyper-V - PeopleAreGeek

Server Monitoring with Nagios on Hyper-V: Step-by-Step Setup Guide (2026)

May 27, 2026
WordPress Security Hardening Checklist: 34 Scored Controls with Copy-Paste Fixes - cover image

WordPress Security Hardening Checklist: 34 Scored Controls with Copy-Paste Fixes

June 3, 2026
Maximizing Website Speed with Image Optimization Techniques for 2026 - cover image

Maximizing Website Speed with Image Optimization Techniques for 2026

June 3, 2026
SSL certificate renewal manager - 8 ACME clients, expiry calculator and monitoring - cover image

SSL Certificate Renewal Manager: certbot, acme.sh, lego, Caddy, cert-manager

June 3, 2026
CORS policy generator - 14 server and framework configs with presets and live security review - cover image

CORS Policy Generator: Headers + Nginx, Apache, Express, FastAPI, Django Config

June 3, 2026
netsh wlan command reference - 72 commands with example output and copy - cover image

netsh wlan Commands: Windows Wi-Fi Cheat Sheet (Show Password, Profiles, Hotspot)

June 2, 2026
Fix: ESXi Host Not Responding / Disconnected in vCenter (2026) - cover image

Fix: ESXi Host Not Responding / Disconnected in vCenter (2026)

June 1, 2026
VMware ESXi Purple Screen of Death (PSOD): Diagnose and Recover (2026) - cover image

VMware ESXi Purple Screen of Death (PSOD): Diagnose and Recover (2026)

June 1, 2026
VMware PowerCLI command generator cover

VMware PowerCLI Command Generator: VM, Snapshots, Networking, esxcli

June 1, 2026
dd Command Generator: Write ISO to USB, Image Disks, Wipe Drives - cover image

dd Command Generator: Write ISO to USB, Image Disks, Wipe Drives

June 1, 2026
SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding - cover image

SSH Tunnel Command Generator: Local, Remote and Dynamic Forwarding

June 1, 2026
sed Command Generator: Build Substitute, Delete and Print Commands - cover image

sed Command Generator: Build Substitute, Delete and Print Commands

May 31, 2026
VMware Workstation and Hyper-V on the Same Machine (2026 Fix) - cover image

VMware Workstation and Hyper-V on the Same Machine (2026 Fix)

May 31, 2026
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
Wednesday, June 3, 2026
  • Login
People Are Geek
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools
No Result
View All Result
People Are Geek
No Result
View All Result
Home Server & Admin Tools

Server Monitoring with Nagios on Hyper-V: Step-by-Step Setup Guide (2026)

by People Are Geek
May 27, 2026
in Server & Admin Tools
0
Server Monitoring withNagios on Hyper-V - PeopleAreGeek
0
SHARES
6
VIEWS
Share on FacebookShare on Twitter

Setup guide Nagios + Hyper-V · 15 min read · Updated May 2026

Nagios Core is the boring, reliable monitoring tool that has watched datacenter floors since 1999 and still owns a comfortable share of small-to-medium sysadmin shops in 2026. Running it as a virtual machine on Hyper-V (Windows Server or Windows 11 Pro with the Hyper-V role) gives you a free monitoring server, snapshots, easy backup, and isolation from the hosts being monitored. This guide walks through the complete setup: provision the VM in Hyper-V Manager, install Nagios Core on Ubuntu 24.04 inside it, configure probes for HTTP / SSH / MySQL / disk usage, wire mail and Telegram alerts, and bake in the routine maintenance habits that keep monitoring honest. Plan two to three hours for the full install on a fresh VM; subsequent additions of probed hosts take five to ten minutes each.

Contents

  1. Why Nagios + Hyper-V in 2026
  2. Step 1: Create the Nagios VM in Hyper-V
  3. Step 2: Install Ubuntu 24.04 LTS and harden it
  4. Step 3: Install Nagios Core 4.5
  5. Step 4: Configure your first host and probes
  6. Step 5: Mail alerts (SMTP via msmtp)
  7. Step 6: Telegram alerts via bot webhook
  8. Step 7: Custom dashboard and views
  9. Step 8: Snapshot and routine maintenance
  10. FAQ

Why Nagios + Hyper-V in 2026

Three reasons keep Nagios relevant despite a crowded monitoring market. The plugin ecosystem (over 5,000 community checks in monitoring-plugins) covers practically every workload a small or medium ops team will encounter. The data model is opinionated: hosts have states (UP / DOWN / UNREACHABLE), services have states (OK / WARNING / CRITICAL / UNKNOWN), and that’s it. You can reason about the system in your head, which becomes priceless during a 3 am incident. Configuration is plain text files versioned in git, with no proprietary database. Nothing magic, nothing surprising.

Running Nagios as a Hyper-V guest gives you what self-hosted monitoring needs: snapshots before every config change so a typo never takes down the watcher itself, backup-friendly VHDX files that fit a normal Windows backup workflow, and isolation from the production hosts (you do not want monitoring to share fate with the things it monitors). Hyper-V is free with any Windows Pro or Server license that already runs on your network.

1

Create the Nagios VM in Hyper-V

Open Hyper-V Manager (Windows + R, type virtmgmt.msc). Right-click your server in the left pane, then New > Virtual Machine.

Recommended specs for a fresh Nagios VM monitoring up to 50 hosts:

  • Generation 2 (UEFI, Secure Boot). Required for modern Ubuntu boot.
  • 2 vCPU, 4 GB RAM (dynamic, min 2 GB / max 6 GB).
  • 30 GB VHDX dynamic disk on a fast volume (Nagios is I/O light but log retention adds up).
  • External virtual switch bound to your management LAN (the VM needs to reach probed hosts).
  • Set the VM’s MAC address to static if your DHCP uses MAC reservations.

In the VM settings, under Security, set Microsoft UEFI Certificate Authority as the secure boot template (matches Ubuntu’s signed bootloader). Under Integration Services, enable all (especially “Time synchronization” and “Heartbeat”) so the VM stays clock-aligned with the host.

2

Install Ubuntu 24.04 LTS and harden it

Mount the Ubuntu 24.04 LTS server ISO (download from ubuntu.com). Boot the VM, follow the installer with these choices: minimal install, no LVM, OpenSSH selected, no other snaps. After install, log in and run the standard hardening pass:

sudo apt update
sudo apt upgrade -y
sudo apt install -y ufw fail2ban unattended-upgrades

# Open SSH and (later) Nagios web UI
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

# Set hostname for clarity
sudo hostnamectl set-hostname nagios-01

If you want the full hardening procedure (SSH key-only, AppArmor enforce, auditd, etc.), follow our Ubuntu 24.04 hardening checklist. A monitoring server is a juicy target — harden it before pointing it at production.

Static IP recommended. Edit /etc/netplan/00-installer-config.yaml to set a static IP. A monitoring server with a DHCP-changing address will cause hours of “why are the probes failing?” debugging.
3

Install Nagios Core 4.5

Ubuntu 24.04 ships Nagios 4.4 in apt; the 4.5.x line has notable bug fixes. The cleanest approach in 2026 is to compile from the official tarball.

# Build dependencies
sudo apt install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils \
  php libapache2-mod-php libgd-dev libssl-dev libmcrypt-dev bc gawk dc build-essential

# Create the nagios user/group
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -aG nagcmd nagios
sudo usermod -aG nagcmd www-data

# Download and extract Nagios Core 4.5.x
cd /tmp
wget https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-4.5.9/nagios-4.5.9.tar.gz
tar xzf nagios-4.5.9.tar.gz
cd nagios-4.5.9
./configure --with-command-group=nagcmd
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
sudo make install-webconf

# Install the standard plugins
cd /tmp
wget https://nagios-plugins.org/download/nagios-plugins-2.4.12.tar.gz
tar xzf nagios-plugins-2.4.12.tar.gz
cd nagios-plugins-2.4.12
./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install

Set the web UI password and start the service:

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
# Enter a strong password when prompted

sudo systemctl enable nagios apache2
sudo systemctl start nagios apache2
sudo a2enmod cgi rewrite
sudo systemctl reload apache2

Open http://nagios-01.local/nagios (or the IP) in your browser. You should see the Nagios login page. Log in with nagiosadmin and the password you just set.

Nagios Core Version 4.5.9 Current Status > Hosts: 1 UP (localhost) Services: 8 OK
4

Configure your first host and probes

Nagios reads its config from /usr/local/nagios/etc/objects/. Create a host file per monitored target.

sudo mkdir -p /usr/local/nagios/etc/servers
sudo nano /usr/local/nagios/etc/nagios.cfg
# Add this line:
cfg_dir=/usr/local/nagios/etc/servers

Example host file at /usr/local/nagios/etc/servers/web01.cfg:

define host {
    use             linux-server
    host_name       web01
    alias           Production web server
    address         10.0.0.10
    max_check_attempts 5
    check_period    24x7
    contact_groups  admins
}

define service {
    use                 generic-service
    host_name           web01
    service_description HTTPS
    check_command       check_http!--ssl -H peoplearegeek.com
}

define service {
    use                 generic-service
    host_name           web01
    service_description SSH
    check_command       check_ssh
}

define service {
    use                 generic-service
    host_name           web01
    service_description Disk root partition
    check_command       check_disk!20%!10%!/
}

define service {
    use                 generic-service
    host_name           web01
    service_description MySQL port
    check_command       check_tcp!3306
}

For deeper checks on remote Linux hosts (CPU, memory, disk per partition, specific processes), install NRPE on each target then point Nagios at it:

# On the monitored host
sudo apt install -y nagios-nrpe-server monitoring-plugins
# Add nagios-01 IP to allowed_hosts in /etc/nagios/nrpe.cfg
sudo systemctl restart nagios-nrpe-server

Verify the config and reload Nagios:

sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# Should print "Things look okay - No serious problems were detected"

sudo systemctl reload nagios
5

Mail alerts (SMTP via msmtp)

Nagios calls /usr/bin/mail when it needs to alert. The easiest sane setup in 2026 is msmtp as a sendmail replacement, configured to relay through an SMTP server (your hosting provider, SendGrid, AWS SES, or your own postfix).

sudo apt install -y msmtp msmtp-mta mailutils

# Edit /etc/msmtprc
sudo nano /etc/msmtprc
defaults
auth           on
tls            on
tls_starttls   on
logfile        /var/log/msmtp.log

account        default
host           smtp.your-provider.com
port           587
from           nagios@yourdomain.com
user           nagios@yourdomain.com
password       your-smtp-app-password

Set permissions and test:

sudo chmod 600 /etc/msmtprc
echo "Test from nagios" | mail -s "Nagios test" you@yourdomain.com
# You should receive the email in less than a minute

By default, Nagios already calls notify-host-by-email and notify-service-by-email commands defined in /usr/local/nagios/etc/objects/commands.cfg. Update the contact email address in /usr/local/nagios/etc/objects/contacts.cfg to your real one, reload Nagios, trigger a test alert (stop a probed service briefly), and confirm the email arrives.

6

Telegram alerts via bot webhook

Mail is for the record; Telegram is for “you need to look at this now”. Five minutes to wire it up.

Create a bot via @BotFather on Telegram, save the token. Send /start to your new bot from your account, then visit https://api.telegram.org/bot<TOKEN>/getUpdates in a browser to find your chat_id.

Create the notification script /usr/local/nagios/libexec/notify-telegram.sh:

#!/bin/bash
TOKEN="123456:ABC-DEF..."
CHAT_ID="987654321"

MESSAGE="*[$1]* $2: $3
Host: \`$4\`
Service: \`$5\`
State: $6 ($7)
$8"

curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendMessage" \
    -d "chat_id=${CHAT_ID}" \
    -d "parse_mode=Markdown" \
    -d "text=${MESSAGE}"
sudo chmod +x /usr/local/nagios/libexec/notify-telegram.sh
sudo chown nagios:nagios /usr/local/nagios/libexec/notify-telegram.sh

Register the command and attach to your admin contact:

# /usr/local/nagios/etc/objects/commands.cfg - append:
define command {
    command_name notify-by-telegram
    command_line /usr/local/nagios/libexec/notify-telegram.sh \
      "$NOTIFICATIONTYPE$" "$HOSTSTATE$" "$SERVICESTATE$" \
      "$HOSTNAME$" "$SERVICEDESC$" "$SERVICESTATE$" \
      "$SERVICESTATEID$" "$SERVICEOUTPUT$"
}

# /usr/local/nagios/etc/objects/contacts.cfg - add to the contact block:
service_notification_commands notify-service-by-email,notify-by-telegram
host_notification_commands    notify-host-by-email,notify-by-telegram

Reload Nagios and force a test by stopping a probed service. The Telegram message lands within seconds.

7

Custom dashboard and views

The default Nagios UI is functional but visually dated. Two community projects modernise it without touching the core:

  • Thruk (thruk.org): a Perl-based replacement frontend that consumes the same Nagios config. Better filtering, business-hour reporting, mobile-friendly. sudo apt install thruk.
  • NagVis: visual map plugin that overlays host status on a network diagram or a building floor plan. Useful when stakeholders want a “green / red lights” view instead of a status grid.

Both can run side-by-side with the stock Nagios CGI UI; pick whichever your team finds easier on the eyes.

8

Snapshot and routine maintenance

Take a Hyper-V checkpoint (right-click VM > Checkpoint) now that the install is clean. This is your rollback point if a config change later goes wrong. Repeat after every significant config change.

Routine maintenance cadence:

  • Weekly: glance at /var/log/nagios.log for repeated transient warnings (often signal flapping that needs flapping detection thresholds adjusted).
  • Monthly: run sudo apt upgrade on the Nagios VM, take a checkpoint before, restart Nagios after.
  • Quarterly: audit the host list — every monitored host should still exist, every existing host should be monitored. Drift here is the silent killer of monitoring usefulness.
  • Yearly: review and tighten the alert thresholds. New WARNING / CRITICAL levels based on the last 12 months of operating data give better signal than the defaults.

Need to monitor without a server?

SecurityWatch is a browser-side monitor that watches uptime, TLS certificates, HTTP headers and drift on a list of sites with localStorage watchlist and webhook alerts. Complementary to Nagios for the public-facing layer.

Try SecurityWatch →

Common pitfalls and how to avoid them

  • Alert fatigue. If your team starts ignoring Nagios emails, the threshold is too sensitive. Raise the WARNING level until alerts mean “human attention needed” rather than “Nagios talks again”.
  • Probed host firewalls. A probed host with a firewall blocking the Nagios server IP looks DOWN; sudo ufw allow from 10.0.0.5 on the host (where 10.0.0.5 is the Nagios IP) is often the missing piece.
  • Time drift between hosts. If Nagios and the probed hosts disagree on time, log correlation breaks and SSL probes fail intermittently. Verify NTP on every host (timedatectl status).
  • Forgetting to monitor Nagios itself. Add a check from a second machine (a cheap VPS, your laptop) to verify the Nagios web UI responds. “Who watches the watchers” is not a joke when the watcher is silent because the watcher itself crashed.

FAQ

Why Nagios in 2026 instead of Zabbix or Prometheus?

Use Nagios when you want a simple, time-tested tool that an on-call engineer can debug at 3 am without consulting documentation. Use Zabbix when you need built-in time-series graphing, native templating and a database-backed config UI. Use Prometheus + Grafana when you have a microservices stack with native metric endpoints and want long-term trending. All three are valid choices for different organisations; the worst choice is to not monitor at all.

Can I run Nagios in WSL2 instead of a Hyper-V VM?

Technically yes, but not recommended for production monitoring. WSL2 shuts down when you log out of the Windows session, which kills monitoring. A proper Hyper-V VM runs whether you are signed in or not. Reserve WSL2 for development or learning the install procedure.

How many hosts can a single Nagios VM monitor?

With 2 vCPU and 4 GB RAM, the configuration we deployed comfortably handles 100-200 hosts and 1,000-2,000 services. Past that, look at NDOUtils for performance optimisation or scale horizontally with multiple Nagios instances and Thruk as the federated frontend.

Can I monitor Windows hosts from Nagios?

Yes. Install NSClient++ on each Windows host (free, MSI installer), open port 5666 from the Nagios server, and use the check_nt or check_nrpe commands. Standard checks: CPU load, memory usage, disk free, service status, event log entries, scheduled task state.

Should I use Nagios XI (the paid version)?

Nagios XI adds a config UI, dashboards, reporting and commercial support to Nagios Core. Worth the licence cost if your team prefers a web GUI over editing text files, or if you need vendor support contractually. For small teams comfortable with files-in-git, Core + Thruk is feature-complete.

How do I back up the Nagios config?

Put /usr/local/nagios/etc/ in a git repository. Commit before every change. Push to a remote. That gives you point-in-time rollback for a single file plus a complete history. Combine with the Hyper-V checkpoints for a layered restore strategy (file-level via git, VM-level via Hyper-V).

PeopleAreGeek tools to go further

SecurityWatch (browser-based monitoring) SecuChecker (WordPress audit) HTTP Headers Checker SSL Certificate Checker TLS Version Selector Companion: Securing the Ubuntu 24.04 host Developer Error Fix Hub
ShareTweetPin
People Are Geek

People Are Geek

I'm Stephane, a network and systems engineer with over 15 years of hands-on experience on production infrastructure, virtualization (ESXi, Proxmox), networking, and self-hosting. Earlier in my career I built and ran a Linux resource site that became a well-known reference for sysadmins. Today I focus on cybersecurity, and I also work as a technical trainer, teaching networking and security to people who do it for a living. Everything on People Are Geek comes from real-world practice, not theory. I build every tool on this site myself, and I write about what I've actually deployed, broken, and fixed. If it's here, I've used it.

People Are Geek

Copyright © 2017 JNews.

Navigate Site

  • About PeopleAreGeek
  • All Tools and Articles
  • Contact
  • Cookie Policy
  • Hyper-V Hub: Tools, Error Fixes and Lab Guides
  • Linux Hub: Cross-Distro Reference, Articles, Tools
  • Page de test Codex
  • Privacy Policy
  • Sample Page
  • Terms of Service
  • VMware vSphere & ESXi Hub: Tools, Error Fixes and Guides

Follow Us

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Online Tools
  • Network Tools
  • Developer Tools
  • Security Tools

Copyright © 2017 JNews.