7.5 Configuring Nagios

Nagios is an open source monitoring tool. You can configure it to monitor the health of the server systems and services. It also provides an alert and notification system.

The information in this section provides basic information to get you started using Nagios. For detailed information about configuring and using Nagios to monitor your server and services, see other sections in this guide. See also the open source Nagios Documentation at Nagios.org.

7.5.1 Configuring Nagios Authenticated Users and Contacts

Nagios user accounts are specific to the Nagios software. The accounts have nothing to do with the local server user names or eDirectory user names.

There are two levels of access for Nagios users:

  • Authenticated user: a Nagios user who is granted access to the web-based Nagios monitoring dashboard.

  • Authenticated contact: An authenticated Nagios user whose user name is also defined in the Nagios Object Contact configuration file (/etc/nagios/objects/contacts.cfg) and has permissions to access CGI information as defined in the Nagios CGI configuration file (/etc/nagios/cgi.cfg) and other object configuration for services that are monitored.

By default, the Nagios user nagiosadmin is already configured in Nagios as a user, a contact, and a member of the contact group admins. This user is also authorized to access server and services information and to issue host or service commands via the command CGI configuration file (/etc/nagios/cgi.cfg). However, you must configure a password for the nagiosadmin user in order to log in to the Nagios Service Details website. You must configure a valid email address for the nagiosadmin contact in order to receive alerts via the Nagios alert notification system.

Setting or Modifying the Password for the nagiosadmin User

By default, Nagios defines one default user nagiosadmin with no password in the /etc/nagios/htpasswd.users file. OES Remote Manager requires passwords to be set for any Nagios user. Thus, before you can access the web-based Nagios Service Details report for the first time, you must specify a password to use for the user nagiosadmin.

IMPORTANT:Do not delete the nagiosadmin user.

To configure a password for user nagiosadmin:

  1. Log in to OES Remote Manager as the Linux root user.

  2. Click the Configure icon in the toolbar to go the OES Remote Manager Configuration Options page.

  3. Under Nagios Configuration Options, click Nagios User Management.

  4. On the Nagios User Management page, specify nagiosadmin as the Nagios user name.

  5. Type a password, then type it again to confirm.

  6. Click Create User.

    The user name and password are saved in the /etc/nagios/htpasswd.users file. The password is stored in encrypted format. The password is enforced on the next login to Nagios.

  7. When a message confirms that the user nagiosadmin was created in Nagios with the password you provided, click OK to dismiss the message.

For information about configuring additional Nagios users and the tasks they can perform, see Section 7.8, Managing Nagios Users.

Setting or Modifying an Email Address for the nagiosadmin Contact

By default, Nagios defines the nagiosadmin user as a contact in the /etc/nagios/objects/contacts.cfg file. It sets the email for the contact to nagios@localhost. In order to receive notification alerts from the Nagios alert notification system, you must replace this email setting with a valid email address. You must restart Nagios to apply the changes.

IMPORTANT:Do not delete the nagiosadmin contact or its email definition line in the /etc/nagios/objects/contacts.cfg file.

To configure an email address for the contact nagiosadmin:

  1. Log in to OES Remote Manager as the Linux root user.

  2. Click the Configure icon in the toolbar to go the OES Remote Manager Configuration Options page.

  3. Under Nagios Configuration Options, click Edit Nagios object contact config file.

    This opens the /etc/nagios/objects/contacts.cfg file in the OES Remote Manager text editor.

  4. Scroll down to the contact definition section for nagiosadmin, and then replace nagios@localhost with the email address (such as bob@example.com) where you want to receive alert notifications that are sent to nagiosadmin.

  5. Click Save Changes.

    The changes are saved in the /etc/nagios/objects/contacts.cfg file. You can verify the new saved date for the file.

  6. Click the Configure icon in the toolbar to return to the OES Remote Manager Configuration Options page, then restart Nagios.

    1. Under Nagios Configuration Options, click Restart Nagios.

    2. When you are prompted to confirm the restart, click OK to proceed.

    3. Wait while Nagios is restarted with the rcnagios restart utility.

      When the restart is completed, OES Remote Manager returns to the Configuration Options page.

Using the Nagios admins Contact Group

Nagios defines a default contact group admins and adds the contact nagiosadmin as a member of the group in the contactgroup section of the /etc/nagios/objects/contacts.cfg file.

If you create additional Nagios users and contacts, you can add them to the admins group. It is not necessary to create additional contact groups. However, Nagios also allows you to create other contact groups to make it easier to set up authorizations for Nagios users who have different roles.

IMPORTANT:Do not remove the default contact group admins from the /etc/nagios/objects/contacts.cfg file. Do not remove the Nagios contact nagiosadmin from the group admins.

You can set up contacts, contact groups, and members of contact groups in the Nagios Object Contact configuration file on the OES Remote Manager Configuration Options page (or in the /etc/nagios/objects/contacts.cfg file). You must restart Nagios to apply the changes.

7.5.2 Configuring Nagios Monitoring

Nagios is automatically configured with basic monitoring settings for the server. The Nagios contact nagiosadmin has all the necessary authorizations to manage and use Nagios.

You can also define other Nagios users and set them up as contacts, set the CGI and object authorizations for Nagios contacts, specify the systems and services to monitor, specify display preferences for the dashboard, set up logging preferences, and set up notifications. As the Linux root user, you can go to the OES Remote Manager Configuration Options > Nagios Configuration Options in order to perform the tasks described in Table 7-2.

Table 7-2 Nagios Configuration Options

Nagios Configuration Option

Related File or Command

Description

Edit Nagios cgi config file

/etc/nagios/cgi.cfg

Defines the CGI parameters and which contacts or contact groups are allowed to access them.

Edit Nagios command config file

/etc/nagios/command.cfg

Defines commands, including service check, service notification, host check, host notification, service event handler, and host even handler.

Edit Nagios config file

/etc/nagios/nagios.cfg

Specifies the main log file where service and host events are logged. For more information, see Section 7.10, Configuring Nagios Logging.

You can configure other Nagios parameters as defined in the configuration file.

Edit Nagios object command config file

/etc/nagios/objects/commands.cfg

Provides you with some sample command definitions that you can reference in host, service, and contact definitions.

Edit Nagios object contact config file

/etc/nagios/objects/contacts.cfg

By default, defines the nagiosadmin user as a contact and adds the contact to the contact group admins. You must specify an email address to use for alert notifications sent to the nagiosadmin contact.

You can configure Nagios users as contacts and set up contact methods for each one, such as email, pager, cell phone, instant message, audio alert, and so on.

You can also add a contact as a member of the default contact group admins, or create other contact groups and add contacts as members.

Nagios User Management

/etc/nagios/htpasswd.users

Create a Nagios user name and password, or delete a Nagios user. You can also use this option to create the user name with a different password.

For more information, see Section 7.8, Managing Nagios Users.

Restart Nagios

rcnagios restart

Restart the Nagios daemon after you make changes to the configuration files.

OES Remote Manager provides a text editor to modify the configuration files from the web browser. The configuration options are described in-line in each of the Nagios configuration files. After you modify the configuration files, you must restart Nagios to apply the settings. You can alternatively log in to the server as the Linux root user and use a text editor to modify the configuration files in the /etc/nagios folder.

After you modify the configuration files, you should verify the configuration before you restart Nagios. The Nagios daemon will not start if the configuration contains errors.

To verify your configuration, run Nagios with the -v command line option:

/usr/sbin/nagios -v /etc/nagios/nagios.cfg

If critical data is missing or wrong, Nagios displays a warning or error message that identifies the line in the configuration file that seems to be the source of the problem. Nagios might print only the first error it encounters to prevent the error from cascading the problem to subsequent settings in the file. If you get an error message, correct the line in the configuration file, then repeat the verification until no errors occur. Warning messages can generally be safely ignored, because they are recommendations and not requirements.

7.5.3 Accessing the Nagios Website

The Nagios website configuration file (/etc/apache2/conf.d/nagios.conf) uses basic authentication by default. Information and passwords are sent in clear text.

IMPORTANT:You should access Nagios behind the firewall or via secure channels.

When you click Nagios Service Detail, the monitoring dashboard opens in a pop-up browser window. If the pop-up blocker is enabled for your web browser, ensure that you disable the browser's pop-up blocker for the Nagios website (http://<server_ip_address or localhost>/nagios).

Authentication is required by default. You are prompted to log in. You can log in as the default user nagiosadmin, or create and configure other Nagios users.

To access the Nagios Service dashboard via OES Remote Manager:

  1. Log in to OES Remote Manager as the Linux root user or as a LUM-enabled administrator user.

  2. Select Diagnose > Server Health Services.

  3. Click Nagios Service Detail.

  4. When you are prompted to authenticate by Nagios Access, specify the user name and password of a Nagios user account, then click OK.

To access Nagios reports via the native Nagios browser view:

  1. In a web browser, go to the Nagios URL:

    http://<server_ip_address>/nagios
  2. When you are prompted to authenticate by Nagios Access, specify the user name and password of a Nagios user account, then click OK.

  3. Under Monitoring on the left panel of the server's Nagios home page, click Service Detail.

7.5.4 Using Nagios Plug-Ins

Nagios plug-ins are extensions to Nagios that allow you to monitor hosts, devices, services, protocols, and applications. A plug-in performs a specific type of check and reports the results to Nagios.

The Nagios plug-ins package (nagios-plugins) provides a set of basic system monitoring plug-ins. It also includes plug-in libraries that are used by the basic plug-ins and additional plug-ins. You can also find Nagios plug-ins for a variety of services and applications on the Nagios Exchange website. Currently, OES does not provide plug-ins specifically designed for OES products and services.

Novell Support for Nagios plug-ins is limited to the plug-ins provided by Novell. For information about using the Nagios basic plug-ins, see the Nagios Plug-ins Documentation on the Nagios Plug-Ins Project website. If you use third-party plug-ins or open source plug-ins, you must refer to the providers of those plug-ins for support.

A Nagios plug-in can be compiled binaries (written in programming languages such as C or C++) or executable scripts (such as shell, Perl, or PHP). For information about how to create your own Nagios plug-ins, see the Nagios Plug-in Development Guidelines on the Nagios Plug-Ins Project website.

7.5.5 Using Object Configuration Files

Templates for Nagios object configuration files are in the /etc/nagios/objects directory. When you start or restart Nagios, it caches the object definitions in the /var/lib/nagios/objects.cache file. The CGIs read information from the cache file, rather than directly from the object configuration files, in order to prevent inconsistencies that can occur if you modify the configuration files after Nagios starts. Thus, if you modify a configuration file, you must restart Nagios to apply the change.

7.5.6 Additional Information

For detailed information about configuring and using Nagios to monitor your server and services, see the Nagios Documentation at Nagios.org.

For additional information about CGI permissions, see Authentication and Authorization in the CGIs in the Nagios Core documentation.