Nc
Application Stacks Azure

Nagios Core on Ubuntu 24.04 on Azure User Guide

| Product: Nagios Core on Ubuntu 24.04 LTS on Azure

Overview

Nagios Core is the open-source industry standard for IT infrastructure monitoring — hosts, services, switches, applications and more — with alerting and a web dashboard. This cloudimg image installs Nagios Core 4 with its CGI web UI behind Apache, secured with Basic authentication, and generates a unique admin password on the first boot of every VM. Backed by 24/7 cloudimg support.

What is included:

  • Nagios Core 4 with the standard monitoring plugins
  • The Nagios CGI web UI served by Apache on port 80, secured with Basic auth for user nagiosadmin
  • A per-VM nagiosadmin password generated at first boot, in a root-only file
  • nagios4.service + apache2.service as systemd units, enabled and active
  • 24/7 cloudimg support

Prerequisites

An active Azure subscription, an SSH key pair, and a VNet + subnet in the target region. Standard_B2s is a good starting point; scale up for monitoring many hosts. NSG inbound: allow 22/tcp from your management network and 80/tcp from the networks that need the Nagios UI (front port 80 with TLS for public exposure — see Enabling HTTPS).

Step 1 — Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Nagios Core by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22) and HTTP (80). Then Review + createCreate.

Step 2 — Deploy from the Azure CLI

az vm create \
  --resource-group <your-rg> \
  --name nagios \
  --image <marketplace-image-urn> \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard

az vm open-port --resource-group <your-rg> --name nagios --port 80 --priority 1010

Step 3 — Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 — Confirm the services are running

systemctl is-active nagios4.service apache2.service
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1/health.txt

Both services report active, and the unauthenticated health endpoint returns 200.

Step 5 — Retrieve your admin password

The password is generated uniquely on the first boot of your VM and written to a root-only file:

sudo cat /root/nagios-credentials.txt

The username is nagiosadmin; the password is the NAGIOS_ADMIN_PASSWORD value.

Step 6 — Sign in to the web UI

Browse to http://<vm-public-ip>/nagios4/ and sign in with nagiosadmin and the password from Step 5. You can confirm the authenticated endpoint from the shell — without credentials it returns 401, with them 200:

PW=$(sudo grep '^NAGIOS_ADMIN_PASSWORD=' /root/nagios-credentials.txt | cut -d= -f2-)
echo "unauthenticated: $(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1/nagios4/)"
echo "authenticated:   $(curl -s -o /dev/null -w '%{http_code}' -u "nagiosadmin:$PW" http://127.0.0.1/nagios4/)"

Step 7 — Add hosts and services

Nagios object definitions live in /etc/nagios4/. Add host and service definitions under /etc/nagios4/conf.d/ (or the configured cfg_dir), then verify and reload:

sudo /usr/sbin/nagios4 -v /etc/nagios4/nagios.cfg
sudo systemctl reload nagios4

The config check must report Things look okay before you reload.

Step 8 — Confirm the runtime

/usr/sbin/nagios4 --version | head -2

Enabling HTTPS

For production, terminate TLS at Apache with a real domain pointed at the VM's public IP. Install certbot and request a certificate (replace the domain):

sudo apt-get update && sudo apt-get install -y certbot python3-certbot-apache
sudo certbot --apache -d your-domain.example.com

Backup and maintenance

Your Nagios configuration lives in /etc/nagios4/. Keep the OS patched with sudo apt update && sudo apt upgrade, validate config changes with nagios4 -v before reloading, and back up /etc/nagios4/. The service restarts cleanly with sudo systemctl restart nagios4.

Support

This image is backed by 24/7 cloudimg support. Contact us by email and chat for help with host and service configuration, notifications, plugins, scaling and TLS.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.