LinuxCommandLibrary

nagios3

Monitor servers and services

TLDR

Start nagios3

$ nagios3 /etc/nagios3/nagios.cfg
copy

Start nagios3 in daemon mode
$ nagios3 -d
copy

Start nagios3, print service check scheduling information to stdout, then shutdown
$ nagios3 -s
copy

Verify configuration file
$ nagios3 -v
copy

SYNOPSIS

nagios3 [-v] [-d] [-f config_file] [-u user] [-g group] [-p pid_file] [-c command_file] [-s] [-r] [-m] [-V] [-L log_level] [-e] [-N]

PARAMETERS

-v
    Verify configuration files and exit. This performs a comprehensive check for errors in the Nagios configuration.

-d
    Start Nagios in daemon mode. This is the typical way Nagios runs in the background.

-f config_file
    Specify the main Nagios configuration file to use. This file typically includes or points to other configuration files.

-u user
    Run Nagios as the specified user. This is important for security best practices.

-g group
    Run Nagios as the specified group. Used in conjunction with the -u option.

-p pid_file
    Specify an alternate PID file where the process ID of the Nagios daemon will be stored.

-c command_file
    Use specified external command file. This file is used for writing commands to Nagios, such as disabling notifications or scheduling checks.

-s
    Dump program status and statistics to standard output and exit. Useful for quick checks of the daemon's internal state.

-r
    Restart the Nagios daemon. This usually sends a SIGHUP signal to an existing Nagios process, causing it to reload its configuration.

-m
    Do not set up signal handlers. This is typically used for debugging purposes.

-V
    Print version information to standard output and exit.

-L log_level
    Set the daemon's log level (e.g., info, debug, warning). This controls the verbosity of log messages.

-e
    Perform environment checks before starting. This helps ensure necessary prerequisites are met.

-N
    Don't perform any external command checks. Useful when debugging configuration or startup issues.

DESCRIPTION

nagios3 refers to Nagios Core version 3, a powerful, open-source monitoring system designed to keep tabs on IT infrastructure. It provides comprehensive monitoring of hosts, services, network protocols, applications, and more, ensuring the availability and performance of critical systems.

Nagios proactively identifies problems, such as overloaded servers, crashed applications, or unreachable network devices, before they impact end-users. When issues arise, it can send alerts via various notification methods, including email, SMS, and custom scripts. The system tracks the state of monitored objects, records event logs, and provides a historical record of alerts and recoveries. Its highly extensible plugin architecture allows users to monitor virtually any aspect of their environment, making it a flexible solution for diverse IT landscapes. While nagios3 is the core daemon executable, it is typically managed by init scripts or systemd rather than being run directly by users.

CAVEATS

nagios3 is an older version of Nagios Core, largely superseded by Nagios 4 and the commercial Nagios XI. It is primarily run as a background daemon and typically managed by system init scripts (e.g., systemctl, /etc/init.d/nagios3) rather than being executed directly by end-users. Configuring Nagios can be complex due to its reliance on multiple configuration files and a specific syntax. While powerful, its web interface and some features may appear dated compared to modern monitoring solutions.

CONFIGURATION FILES

Nagios relies heavily on a structured set of configuration files to define what to monitor and how. These include the main nagios.cfg, and separate files for hosts (hosts.cfg), services (services.cfg), commands (commands.cfg), contacts (contacts.cfg), timeperiods, and host/service groups. These files are typically located in /etc/nagios3/ or /usr/local/nagios/etc/.

WEB INTERFACE

A key component of Nagios 3 is its comprehensive web-based user interface, usually accessible via a web server like Apache. This interface provides real-time status dashboards, historical reports, alert summaries, and allows users to acknowledge problems, schedule downtime, and submit passive checks.

PLUGINS

Nagios's flexibility comes from its extensive plugin architecture. Nagios plugins are external executables (scripts or compiled programs) that perform checks on hosts and services. Nagios itself simply executes these plugins and processes their output to determine the state of a monitored object (OK, WARNING, CRITICAL, UNKNOWN).

HISTORY

Nagios was originally created by Ethan Galstad in 1999 as "NetSaint." Due to trademark issues, it was rebranded as "Nagios" in 2002. Nagios 3 was a significant evolutionary step, released around 2007, bringing improved performance, better scalability, and enhanced features over its predecessors. It established Nagios as one of the leading open-source monitoring solutions. Although it remains functional, development has since moved to Nagios 4 and newer versions, including the commercial Nagios XI. Nagios 3 installations are still found in legacy environments.

SEE ALSO

nrpe(8), nsca(8), nagios-plugins(1), systemctl(1), init(8), kill(1)

Copied to clipboard