Deployment guide

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.

1

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.small recommended).
  • 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.

2

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 -
3

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.log

MySQL root password (used by Nagios for data storage):

cat /stage/scripts/mysql_root_password.log
4

Access 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>/nagios

The 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.

5

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.cfg

Example 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.cfg

Verify the configuration:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart Nagios to apply the changes:

systemctl restart nagios

Server 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 nagios

Apache HTTP Server:

systemctl status httpd
systemctl stop httpd
systemctl start httpd

Scripts 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.sh

Troubleshooting

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.log after 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