Nagios Cheat Sheet
Reference for Nagios Core object configuration, check_ plugin usage, and service/host definitions for infrastructure monitoring.
2 PagesIntermediateFeb 5, 2026
Host Definition
A host object in a Nagios .cfg configuration file.
bash
define host { use linux-server host_name web1 alias Web Server 1 address 192.168.1.10 max_check_attempts 3 check_period 24x7 notification_interval 30 notification_period 24x7}
Service Definition
A service check monitoring HTTP and disk usage.
bash
define service { use generic-service host_name web1 service_description HTTP check_command check_http max_check_attempts 3 check_interval 5 retry_interval 1}define service { use generic-service host_name web1 service_description Disk Usage check_command check_disk!20%!10%!/}
Plugin Usage
Running Nagios plugins directly from the command line.
bash
/usr/lib/nagios/plugins/check_ping -H 8.8.8.8 -w 100.0,20% -c 500.0,60%/usr/lib/nagios/plugins/check_http -H example.com -p 443 -S/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p //usr/lib/nagios/plugins/check_nrpe -H web1 -c check_load
Key Concepts
Core Nagios terminology and status codes.
- host / service- Monitored objects; a host has one or more service checks attached
- check_command- Plugin invocation defining how a check is performed
- contact / contactgroup- Defines who is notified and via what method when checks fail
- exit codes- 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN — the plugin contract Nagios relies on
- NRPE- Agent enabling Nagios to execute plugins on remote hosts
- soft/hard state- Soft states are unconfirmed failures during retries; hard state triggers notification
Pro Tip
Write custom checks to always exit with the standard Nagios codes (0/1/2/3) and print a one-line status message to stdout — any script honoring this contract can be dropped in as a check_command with zero Nagios-side changes.
Was this cheat sheet helpful?
Explore Topics
#Nagios#NagiosCheatSheet#DevOps#Intermediate#HostDefinition#ServiceDefinition#PluginUsage#KeyConcepts#OOP#CheatSheet#SkillVeris