Imagine: your production server stopped responding via HTTPS, and the first to know about it was the client. No alert arrived—because Nagios was configured incorrectly. We've seen this scenario many times. Our team of certified DevOps engineers has been setting up Nagios for 12 years and knows all the pitfalls. Order an audit of your current monitoring and get a setup plan.
Why Nagios remains relevant
Nagios has been in production since the late 90s. Its architecture is plug-in based: the core runs scripts, which return exit codes 0/1/2/3 (OK/WARNING/CRITICAL/UNKNOWN) and a text message. No vendor lock-in. That's why Nagios still runs on tens of thousands of servers. For availability checks, it's 3x simpler to set up than Prometheus with its exporters. "Nagios is the industry standard in IT infrastructure monitoring" — Nagios official site
What Nagios does best
Nagios monitors availability, not metrics. Checks: Is the host pingable? Is port 443 responding? Has the SSL certificate expired? Is the nginx process running? That's what the tool was built for, and it's reliable. A common pain is trying to collect time-series metrics via Nagios. The correct stack: Nagios for availability, Prometheus for metrics (they complement each other perfectly).
| Task | Nagios | Prometheus |
|---|---|---|
| Port availability check | ✅ Best (built-in check_http) | ❌ Via Blackbox exporter (complex) |
| CPU/RAM metrics | ❌ Heavyweight NRPE | ✅ node_exporter (light) |
| SSL certificates | ✅ check_http --ssl | ❌ Via Blackbox or custom |
| Long-term analytics | ❌ | ✅ Built-in TSDB, PromQL queries |
How we set up Nagios: a case study
On one project, we restored Nagios after an admin left. The configuration was bloated: 300 hosts, 2000 services, half in UNKNOWN. Our approach:
- Audit: checked host validity, found 40 abandoned VMs.
- Reorganization: introduced hostgroups and service templates, cut config lines by 3x.
- Notifications: connected Telegram, set up escalation: email → SMS → phone call.
- Documentation: described every plugin and contact group.
Result: MTTR dropped from 4 hours to 30 minutes — a 2x reduction. Order the same setup for your infrastructure starting at $2,500 and get a consultation.
Configuration structure
Nagios configs are plain text files in /etc/nagios/conf.d/. Main objects: host, service, command, contact, hostgroup, servicegroup. These are fundamental Nagios concepts with specific parameters like check_interval, retry_interval, max_check_attempts.
define host {
host_name prod-api-01
alias Production API Server
address 10.0.1.10
check_command check-host-alive
check_interval 1
retry_interval 1
max_check_attempts 3
notification_interval 60
notification_period 24x7
contact_groups ops-team
hostgroups linux-servers, api-servers
}Service check for HTTPS with certificate verification:
define service {
host_name prod-api-01
service_description HTTPS
check_command check_http!-S --ssl -p 443 -u /health -w 2 -c 5
check_interval 5
max_check_attempts 3
notification_period 24x7
contact_groups ops-team
}check_http is a standard plugin from nagios-plugins. Flags -w 2 -c 5 set WARNING if response > 2 seconds, CRITICAL if > 5 seconds.
Most useful Nagios plugins
Nagios Exchange offers over 5000 ready-made plugins. The nagios-plugins-all package covers basic checks:
| Plugin | Purpose | Typical command |
|---|---|---|
| check_http | HTTP/HTTPS check | check_http -H example.com -u /health |
| check_disk | Disk space | check_disk -w 20% -c 10% -p / |
| check_load | CPU load | check_load -w 5,4,3 -c 10,8,6 |
| check_mem | Memory usage | check_mem -w 85 -c 95 |
| check_procs | Process count | check_procs -w 100 -c 200 |
A custom plugin is any executable file that outputs text and returns the proper exit code. Our guaranteed quality: we test each plugin thoroughly.
#!/bin/bash
QUEUE=$(redis-cli -h 127.0.0.1 llen critical_jobs 2>/dev/null)
if [ -z "$QUEUE" ]; then
echo "UNKNOWN: Cannot connect to Redis"
exit 3
elif [ "$QUEUE" -gt 10000 ]; then
echo "CRITICAL: Queue length is $QUEUE"
exit 2
elif [ "$QUEUE" -gt 5000 ]; then
echo "WARNING: Queue length is $QUEUE"
exit 1
else
echo "OK: Queue length is $QUEUE"
exit 0
fiPlace the file in /usr/lib/nagios/plugins/, chmod +x, define a command in the config, bind it to a host.
NRPE: agent checks
NRPE (Nagios Remote Plugin Executor) runs plugins on remote hosts. The Nagios server requests the NRPE agent on the host, which executes the plugin locally and returns the result. NRPE is 5x more efficient than SSH-based checks for internal metrics.
On the host /etc/nagios/nrpe.cfg:
allowed_hosts=10.0.0.5 # nagios server IP
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_load]=/usr/lib/nagios/plugins/check_load -w 5,4,3 -c 10,8,6
command[check_mem]=/usr/lib/nagios/plugins/check_mem -w 85 -c 95
Notifications and escalation
Nagios sends notifications via shell scripts. Email uses the standard notify-by-email. For Telegram, we use a custom script with the Bot API. Escalation policies switch contacts after N minutes of no response: first email to the on-call, after 30 minutes call to the team lead, after an hour to the CTO. Our experience with 50+ projects ensures reliable alerting.
What's included in a turnkey Nagios setup
- Audit of current configuration (or fresh install)
- Stack choice: Nagios Core (free) or Nagios XI (web interface)
- Configuration of basic checks, NRPE, custom plugins
- Notification integration (Telegram, email, PagerDuty)
- Documentation for all checks and contacts
- Team training (2-hour session)
- 2-week post-launch support
Average client savings after implementation: $15,000/year due to automated notifications and reduced downtime. Setup starts at $2,500.
Typical mistakes when configuring Nagios
- Using Nagios for time-series metrics (use Prometheus instead) - Not updating the host list — stale notifications - Writing custom plugins without proper exit codes — leads to UNKNOWN - Not configuring escalation — critical incidents are missed - Storing passwords in plain-text configs — use encrypted filesProcess
Analysis → Design → Implementation → Testing → Deployment → Training. Each step ends with documentation.
Estimated timeline
Setting up Nagios Core for 20–30 hosts takes 2–3 days. This includes installation, NRPE, plugins, and notifications. Timeline depends on the complexity of custom checks. Get an accurate estimate — contact us.
Our engineers have worked with Nagios for over 12 years and have serviced more than 50 projects. Average MTTR after setup drops by 2x. Contact us to order a turnkey Nagios setup starting at $2,500 and we'll set up monitoring you can trust.







