Nagios FAQs for DevOps Interviews: Quick Guide (2026)
Quick Nagios interview cheat sheet: plugin exit codes, SOFT vs HARD states, notifications, event handlers, NRPE on port 5666, perf data and Prometheus.
Nagios interview FAQs come back to a small set of ideas: how a plugin reports status through exit codes 0 to 3, how object definitions tie hosts, services, commands and contacts together, why a problem must turn HARD before anyone is notified, and how remote checks run through NRPE on port 5666. This page is a quick-reference sheet for those ideas, written for the last evening before an interview.
It is the short companion to our scenario-based Nagios interview questions, which walk through longer incident stories. Here each answer is two or three sentences, and every behaviour described was checked against the Nagios Core 4 documentation in November 2026.
Key takeaways
- A Nagios plugin returns 0 for OK, 1 for WARNING, 2 for CRITICAL and 3 for UNKNOWN. Nagios reads the exit code, not the text.
- Notifications fire only on HARD state changes. A check has to fail
max_check_attemptstimes in a row before a SOFT problem becomes HARD. - Event handlers run on both SOFT and HARD changes, which is why they are used for automatic fixes before anyone is paged.
- Performance data follows a pipe (
|) in plugin output, and Nagios Core only reads the first 4 KB of output by default. - The Nagios Core 4.5 line is current. The latest tag on the official GitHub repository at the time of writing is 4.5.14.
How to use this cheat sheet
Interviewers who ask about Nagios usually want proof that you have run it, not that you memorised a feature list. They tend to start with a plain definition, then ask how a check result becomes an alert, and then push into a real situation such as a flapping service or a remote disk check. The sections below follow that order. Read the direct answer first, then the short explanation, and say both out loud. If you can explain the soft and hard state rules without notes, you will handle most follow-up questions.
Many teams now run Prometheus alongside or instead of Nagios, so expect a comparison question too. We cover that at the end, and our guide to using Prometheus and Grafana together fills in the other side.
Core concepts
1. What is Nagios Core?
Nagios Core is the open source monitoring engine at the centre of the Nagios family. It schedules checks against hosts and services, runs small external programs called plugins to do the actual checking, keeps track of state, and sends notifications when something breaks or recovers. Nagios XI is the commercial product built on top of it, with a web configuration interface and reporting.
2. What is a plugin, and why does Nagios not check anything itself?
A plugin is any executable that tests one thing and exits with a status code. Nagios Core deliberately knows nothing about disks, HTTP or databases. It runs the plugin, reads the exit code and the first line of output, and acts on them. This is why you can monitor almost anything: write a shell or Python script that follows the plugin rules and Nagios will treat it like any official plugin.
3. What do the plugin return codes mean?
| Exit code | Service state | Host state |
|---|---|---|
| 0 | OK | UP |
| 1 | WARNING | UP (or DOWN/UNREACHABLE with aggressive host checking) |
| 2 | CRITICAL | DOWN/UNREACHABLE |
| 3 | UNKNOWN | DOWN/UNREACHABLE |
A common trick question: a host check that returns WARNING is treated as UP by default. Only aggressive host checking changes that.
4. Which object types do you define in Nagios configuration?
The ones that come up in every interview are hosts, services, commands, contacts, contact groups, host groups and time periods. A service always belongs to a host. A command object maps a short name such as check_http to the plugin command line, and contacts say who gets notified and through which notification command. Templates let you define shared settings once and inherit them with the use directive.
5. How do you check a configuration before restarting?
Run the binary in verify mode against the main config file. On a source install that usually looks like this:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
It reports missing objects, broken references and warnings without touching the running process. Always do this before a reload in production, because a bad config stops Nagios from starting.
States, retries and notifications
6. What is the difference between a SOFT and a HARD state?
A SOFT state is a problem Nagios has seen but not yet confirmed. When a check fails, Nagios retries it until the number of consecutive failures reaches max_check_attempts. Until then the state is SOFT. Once the limit is reached it becomes HARD. A change from one error status to another, such as WARNING to CRITICAL, is also a HARD change, and so is a recovery from a HARD problem.
7. When are notifications sent?
Only on HARD state changes: hard problems and hard recoveries. A service that fails once and then returns to OK before reaching max_check_attempts has a SOFT recovery, and no one is notified, because it was never a confirmed problem.
8. When do event handlers run?
On both SOFT and HARD state changes. The $SERVICESTATETYPE$ or $HOSTSTATETYPE$ macro tells the handler which kind it is, so a script can try a restart on the first SOFT CRITICAL and do nothing more if the problem turns HARD. This is the standard answer to "how do you auto-heal with Nagios".
9. Walk through a three-attempt example.
With max_check_attempts 3: the first CRITICAL is SOFT and runs the event handler. A WARNING on the second check is still SOFT. The third non-OK result makes it HARD, so the handler runs again and a problem notification goes out. A later move to HARD WARNING sends another notification, and the eventual return to OK sends a recovery notification.
10. What is flapping?
Flapping is a host or service that changes state too often in a short window, which would otherwise flood people with alerts. Nagios tracks recent state changes and, when flap detection is enabled, sends a single "flapping start" notification and then suppresses other notifications until the object settles. In an interview, mention that the real fix is to find out why the check is unstable: a tight threshold, a slow network or a plugin timeout.
11. What are passive checks?
An active check is one Nagios schedules and runs itself. A passive check result is submitted from outside, for example by a backup job reporting that it finished. Passive results suit jobs that run on their own schedule or hosts behind a firewall Nagios cannot reach. Note that passive host check results are treated as HARD unless passive_host_checks_are_soft is enabled.
12. How do you stop alerts during planned maintenance?
Schedule downtime for the host or service. While the downtime is active, Nagios does not send normal problem notifications for that object. It does send a DOWNTIMESTART notification when the window opens and a DOWNTIMEEND notification when it closes, so the team knows monitoring is back to normal.
13. What does acknowledging a problem do?
An acknowledgement tells Nagios and the team that someone is working on the issue. It disables further notifications for that same problem state. A normal acknowledgement is removed when the state changes, for example from WARNING to CRITICAL. A sticky acknowledgement stays in place until the object returns to OK or UP.
Remote checks and plugin output
14. What is NRPE and which port does it use?
NRPE (Nagios Remote Plugin Executor) is a small daemon on the monitored Linux host. The Nagios server runs check_nrpe, which asks the daemon to execute a locally defined plugin, such as a disk or load check, and send back the result. The default port in the official repository's examples is 5666/tcp, and it can be changed.
/usr/local/nagios/libexec/check_nrpe -H 10.0.0.15 -c check_disk
15. How should NRPE be secured?
Limit which servers may connect with the allowed_hosts setting, keep command arguments disabled unless you really need them, and define fixed commands in the NRPE configuration on the client. Allowing arbitrary arguments from the network lets anyone who can reach the port run plugins with values you did not choose.
16. How does a plugin report performance data?
After the human-readable text, the plugin prints a pipe symbol followed by label and value pairs. Nagios puts the text before the pipe into $SERVICEOUTPUT$ and the data after it into $SERVICEPERFDATA$. Graphing add-ons read that perf data to draw trends.
DISK OK - free space: / 12034 MB (61%) | /=7600MB;16000;18000;0;20000
17. Is there a limit on plugin output?
Yes. Nagios Core reads only the first 4 KB of a plugin's output so a runaway script cannot flood it. Changing the limit means editing MAX_PLUGIN_OUTPUT_LENGTH in the source and recompiling, which few teams bother to do.
18. How do you write a custom plugin?
Any script works if it prints one useful line and exits with 0, 1, 2 or 3. Keep it fast, add a timeout, and return UNKNOWN when the check itself fails (for example, the API is unreachable) instead of pretending the service is CRITICAL.
#!/bin/bash
count=$(ls /var/spool/app/queue | wc -l)
if [ "$count" -gt 500 ]; then echo "CRITICAL - queue $count | queue=$count"; exit 2
elif [ "$count" -gt 200 ]; then echo "WARNING - queue $count | queue=$count"; exit 1
else echo "OK - queue $count | queue=$count"; exit 0; fi
Operations and design questions
19. How do host dependencies and parents reduce noise?
Setting a router or switch as the parents of the hosts behind it lets Nagios mark those hosts UNREACHABLE instead of DOWN when the router fails. You then get one alert about the router rather than fifty about servers that are fine but unreachable. Service dependencies do the same for, say, an application that depends on its database.
20. How would you organise configuration for hundreds of hosts?
Split objects into files or directories by role, use templates for shared settings, apply services to host groups instead of individual hosts, and keep the whole tree in Git. Generate host files from an inventory with a script or a configuration management tool, and run the verify command in a pipeline before every reload.
21. How do you tune a check that alerts too often?
Look at history first. Raise max_check_attempts or set a shorter retry_interval so transient blips settle before going HARD, review the thresholds against real usage, and check the plugin timeout. Do not just disable notifications.
22. What happens if the Nagios server itself fails?
Nothing alerts you, which is the real risk. Teams usually run a second, independent check of the Nagios host from another system, and keep the configuration in version control so it can be rebuilt quickly.
23. Nagios Core vs Nagios XI: what should you say?
Core is the free engine configured through text files. XI is the commercial edition that adds a web configuration interface, wizards, dashboards and reporting. Mention which one you used and how you managed changes.
24. How does Nagios compare with Prometheus?
| Area | Nagios Core | Prometheus |
|---|---|---|
| Model | Runs checks and records a state | Scrapes metrics and stores time series |
| Alert logic | Plugin thresholds plus soft/hard states | PromQL alert rules evaluated over series |
| Best fit | Fixed servers, network gear, up/down checks | Dynamic, containerised services |
| Configuration | Object definition files | YAML and service discovery |
A fair answer is that many organisations keep Nagios for infrastructure and network checks while using Prometheus for Kubernetes workloads. Our Prometheus interview questions cover that side.
Last-minute revision checklist
- Say the four return codes and the host-state exception without hesitating.
- Explain SOFT to HARD with a three-attempt example.
- Know that notifications need HARD changes and handlers run on both.
- Describe NRPE, its default port and how you secured it.
- Write a five-line plugin with performance data on a whiteboard.
- Explain parents, dependencies, downtime and acknowledgements.
- Have one honest story about a noisy check you fixed.
For broader monitoring study, see the 55+ Nagios interview questions and advanced Nagios questions, and the DevOps interview questions hub. If you want hands-on practice with monitoring stacks, our Prometheus and Grafana course runs in the Kharadi, Pune classroom and live online.
Frequently asked questions
Is Nagios still asked about in DevOps interviews?
Yes, mostly in companies with large fixed server estates, network teams and managed service providers. Cloud-native teams ask about it less and focus on Prometheus, but the ideas of checks, thresholds and alert fatigue carry over.
What is the latest Nagios Core version?
The 4.5 line is current. The newest tag on the official NagiosEnterprises GitHub repository when this page was checked in November 2026 was 4.5.14.
What does exit code 3 mean in Nagios?
UNKNOWN. Use it when the plugin could not perform the check, such as a timeout or bad arguments, rather than when the service is actually broken.
Why did a failing service not send an alert?
Usually because it was still SOFT. Notifications need a HARD state, which comes after max_check_attempts consecutive failures. Downtime, acknowledgement, disabled notifications or flap detection can also suppress it.
What port does NRPE use?
5666/tcp by default, as shown in the official NRPE repository. It can be changed in the configuration.
Can Nagios monitor containers?
It can check container hosts and service endpoints with plugins, but it does not discover short-lived containers on its own. Teams running Kubernetes usually pair it with Prometheus.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0