Nagios Core
Overview
Nagios Core is an open-source infrastructure monitoring system for servers, network devices, applications and services. It alerts administrators when issues are detected and when they are resolved.
This SecureAnyCloud AMI runs Nagios Core on Linux, available from the AWS Marketplace, and this guide covers its deployment and configuration.
What you get:
- Nagios Core 4.5.6 with the web administration portal on port 80
- Apache HTTP Server to serve the Nagios web interface
- MySQL database for Nagios data storage
- Randomly generated Nagios admin and MySQL credentials
- OS package update script to keep the system current
- AWS CLI v2 for AWS service integration
- Systems Manager Agent (SSM) for remote management
- CloudWatch Agent for monitoring
- Latest security patches applied at build time
- 24/7 SecureAnyCloud support with a 24 hour response SLA
Prerequisites
Before you launch this AMI, make sure you have:
- An active AWS account
- An active subscription to the Nagios Core listing on AWS Marketplace
- An EC2 key pair for SSH access
- Familiarity with EC2 instance management and SSH
Recommended instance type: t3.small (2 vCPU, 2 GB RAM) or larger. The minimum requirements are 1 vCPU, 1 GB RAM and 20 GB of disk space.
Launch the AMI
- Open the AWS Marketplace and search for "Nagios Core SecureAnyCloud".
- Select Continue to Subscribe, accept the terms, then select Continue to Configuration.
- Choose your preferred Region and Software Version.
- Select Continue to Launch.
- Choose Launch through EC2 for full control over instance configuration.
- Select your instance type (
t3.smallrecommended). - Configure storage with a minimum of 20 GB gp3.
- Configure your Security Group with the following inbound rules:
Port Protocol Source Purpose
22 TCP Your IP SSH access
80 TCP Your IP Nagios administration portal
Important: Restrict port 80 to trusted IP addresses only. The Nagios web interface gives full access to the monitoring configuration.
Select your EC2 key pair and launch the instance.
Connect via SSH
When your instance is running and has passed both status checks (2/2), connect with SSH:
ssh -i your-key.pem ec2-user@<public-ip-address>To switch to the root user:
sudo su -Retrieve Nagios Credentials
The instance generates random Nagios administrator credentials and stores them locally. Read them as follows.
Nagios admin password:
cat /stage/scripts/nagios-credentials.logMySQL root password (used by Nagios for data storage):
cat /stage/scripts/mysql_root_password.logAccess the Nagios Web Interface
The Apache HTTP server starts automatically on boot, so Nagios Core is available immediately. Open your web browser and go to:
http://<public-ip-address>/nagiosThe Nagios login prompt appears. Enter:
- Username: nagiosadmin
- Password: the value from
/stage/scripts/nagios-credentials.log
After you log in, the Nagios Core dashboard shows the daemon status, version information and a navigation menu on the left.
Explore the Nagios Dashboard
The Nagios web interface provides several monitoring views.
Current Status
- Tactical Overview: high-level summary of all monitored hosts and services
- Map: visual network topology map
- Hosts: status of all monitored hosts
- Services: status of all monitored services
- Host Groups / Service Groups: grouped views
Reports
- Availability: uptime and availability reports
- Trends: performance trend analysis
- Alerts: alert history and summaries
System
- Comments / Downtime: scheduled maintenance windows
- Process Info: Nagios daemon status
- Configuration: current monitoring configuration
Adding a Host to Monitor
To add a host to monitor, create a configuration file:
sudo vi /usr/local/nagios/etc/objects/myserver.cfgExample host configuration:
define host { use linux-server host_name web-server-01 alias Production Web Server address 10.0.1.100 max_check_attempts 5 check_period 24x7 notification_interval 30 notification_period 24x7 } define service { use generic-service host_name web-server-01 service_description PING check_command check_ping!100.0,20%!500.0,60% } define service { use generic-service host_name web-server-01 service_description SSH check_command check_ssh }Include the new configuration file in the main Nagios config:
echo "cfg_file=/usr/local/nagios/etc/objects/myserver.cfg" >> /usr/local/nagios/etc/nagios.cfgVerify the configuration:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgRestart Nagios to apply the changes:
systemctl restart nagiosServer Components
Component Install Path
Nagios Core /usr/local/nagios
Note: the automatic OS package update script may update component versions on first boot.
Filesystem Layout
Mount Point Size Description
/ 38 GB Root filesystem
/boot 2 GB Operating system kernel files
Key Nagios directories:
Directory Purpose
/usr/local/nagios Nagios installation root
/usr/local/nagios/etc Configuration files
/usr/local/nagios/etc/objects Host, service, and command definitions
/usr/local/nagios/bin Nagios binaries
/usr/local/nagios/libexec Check plugins
/usr/local/nagios/var Runtime data and logs
/usr/local/nagios/share Web interface files
Managing Services
Nagios:
systemctl status nagios
systemctl stop nagios
systemctl start nagios
systemctl restart nagiosApache HTTP Server:
systemctl status httpd
systemctl stop httpd
systemctl start httpdScripts and Log Files
Script/Log Path Description
initial_boot_update.sh /stage/scripts Updates the OS with the latest packages on first boot
initial_boot_update.log /stage/scripts Output log for the boot update script
mysql_root_password.log /stage/scripts MySQL root database password
nagios-credentials.log /stage/scripts Nagios administrator credentials
On Startup
An OS package update script runs on first boot to bring the image fully up to date. To disable it, remove the script and its crontab entry:
rm -f /stage/scripts/initial_boot_update.sh crontab -e
# Delete the following line, save and exit: @reboot /stage/scripts/initial_boot_update.shTroubleshooting
Cannot access Nagios on port 80
- Verify that Apache is running:
systemctl status httpd - Verify that Nagios is running:
systemctl status nagios - Check that your security group allows port 80 from your IP.
- Check the Apache error logs:
tail -f /var/log/httpd/error_log
Nagios configuration error after adding hosts
- Always verify before restarting:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg - Check the configuration file for syntax errors.
- Make sure all referenced commands and templates exist.
Notifications not being sent
- Check that notification commands are configured in
/usr/local/nagios/etc/objects/commands.cfg. - Verify the contact email addresses in
/usr/local/nagios/etc/objects/contacts.cfg. - Make sure the mail service is configured on the instance.
Cannot log in to Nagios web interface
- Verify the credentials from
/stage/scripts/nagios-credentials.log. - Reset the nagiosadmin password:
htpasswd /usr/local/nagios/etc/htpasswd.users nagiosadmin
Security Recommendations
- Change the nagiosadmin password after your first login, using
htpasswd. - Restrict port access. Allow port 80 from trusted IPs only.
- Enable HTTPS. Configure Apache with SSL for encrypted access to the monitoring console.
- Secure the credential files. Delete
/stage/scripts/nagios-credentials.logafter you record the values. - Use NRPE for remote checks. Install the NRPE agent on monitored hosts for secure local checks.
- Limit command execution. Restrict which external commands can be run through the web interface.
- Keep Nagios updated. Apply security patches when they are available.
- Monitor the monitor. Set up external health checks for the Nagios instance itself.
Support
If you have any issues with this product, contact SecureAnyCloud support:
- Email: sales@secureanycloud.com
- Website: secureanycloud.com
- Support hours: 24/7, with a 24 hour response SLA
Deploy on AWS
Launch Nagios Core with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
Nagios Core is the open-source industry standard for IT infrastructure monitoring. It covers hosts, services, switches, applications and more, with alerting and a web dashboard.
This SecureAnyCloud image installs Nagios Core 4 with its CGI web UI behind Apache, secured with Basic authentication. It generates a unique admin password on the first boot of every VM.
What you get:
- 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
nagiosadminpassword generated at first boot, in a root-only file nagios4.serviceandapache2.serviceas enabled, active systemd units- 24/7 SecureAnyCloud support
Prerequisites
You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.
Standard_B2s is a good starting size. Choose a larger size to monitor many hosts.
Configure the network security group (NSG) to allow inbound 22/tcp from your management network and 80/tcp from the networks that need the Nagios UI. For public exposure, front port 80 with TLS (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 SecureAnyCloud, and select Create.
On the Basics tab, 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 select Review + create and Create.
Step 2 - Deploy from the Azure CLI
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:nagios-core-ubuntu-24-04:default:latest
az vm create \
--resource-group <your-rg> \
--name nagios \
--image sac1647283583153:nagios-core-ubuntu-24-04:default:latest \
--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 1010Step 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.txtBoth services report active. The unauthenticated health endpoint returns 200.
Step 5 - Retrieve your admin password
The first boot of your VM generates a unique password and writes it to a root-only file:
sudo cat /root/nagios-credentials.txtThe 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 also confirm the authenticated endpoint from the shell. Without credentials it returns 401, and with them it returns 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 the configuration and reload:
sudo /usr/sbin/nagios4 -v /etc/nagios4/nagios.cfg
sudo systemctl reload nagios4The config check must report Things look okay before you reload.
Step 8 - Confirm the runtime
/usr/sbin/nagios4 --version | head -2Enabling 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 with your own:
sudo apt-get update && sudo apt-get install -y certbot python3-certbot-apache
sudo certbot --apache -d your-domain.example.comBackup and maintenance
Your Nagios configuration lives in /etc/nagios4/. Back up /etc/nagios4/ regularly. Keep the OS patched with sudo apt update && sudo apt upgrade, and validate config changes with nagios4 -v before you reload. The service restarts cleanly with sudo systemctl restart nagios4.
Support
This image is backed by 24/7 SecureAnyCloud support. Contact us by email or 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.
Deploy on Azure
Launch Nagios Core on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com