Выбрать главу

    host_notification_period        24x7

    service_notification_options    w,u,c,r

    host_notification_options       d,u,r

    service_notification_commands   notify-service-by-email

    host_notification_commands      notify-host-by-email

    register                        0 ; Template only

}

define contact{

    use             generic-contact

    contact_name    rhertzog

    alias           Raphael Hertzog

    email           hertzog@debian.org

}

define contact{

    use             generic-contact

    contact_name    rmas

    alias           Roland Mas

    email           lolando@debian.org

}

define contactgroup{

    contactgroup_name     falcot-admins

    alias                 Falcot Administrators

    members               rhertzog,rmas

}

define host{

    use                   generic-host ; Name of host template to use

    host_name             www-host

    alias                 www.falcot.com

    address               192.168.0.5

    contact_groups        falcot-admins

    hostgroups            debian-servers,ssh-servers

}

define host{

    use                   generic-host ; Name of host template to use

    host_name             ftp-host

    alias                 ftp.falcot.com

    address               192.168.0.6

    contact_groups        falcot-admins

    hostgroups            debian-servers,ssh-servers

}

# 'check_ftp' command with custom parameters

define command{

    command_name          check_ftp2

    command_line          /usr/lib/nagios/plugins/check_ftp -H $HOSTADDRESS$ -w 20 -c 30 -t 35

}

# Generic Falcot service

define service{

    name                  falcot-service

    use                   generic-service

    contact_groups        falcot-admins

    register              0

}

# Services to check on www-host

define service{

    use                   falcot-service

    host_name             www-host

    service_description   HTTP

    check_command         check_http

}

define service{

    use                   falcot-service

    host_name             www-host

    service_description   HTTPS

    check_command         check_https

}

define service{

    use                   falcot-service

    host_name             www-host

    service_description   SMTP

    check_command         check_smtp

}

# Services to check on ftp-host

define service{

    use                   falcot-service

    host_name             ftp-host

    service_description   FTP

    check_command         check_ftp2

}

This configuration file describes two monitored hosts. The first one is the web server, and the checks are made on the HTTP (80) and secure-HTTP (443) ports. Nagios also checks that an SMTP server runs on port 25. The second host is the FTP server, and the check include making sure that a reply comes within 20 seconds. Beyond this delay, a warning is emitted; beyond 30 seconds, the alert is deemed critical. The Nagios web interface also shows that the SSH service is monitored: this comes from the hosts belonging to the ssh-servers hostgroup. The matching standard service is defined in /etc/nagios3/conf.d/services_nagios2.cfg.

Note the use of inheritance: an object is made to inherit from another object with the “use parent-name”. The parent object must be identifiable, which requires giving it a “name identifier” property. If the parent object is not meant to be a real object, but only to serve as a parent, giving it a “register 0” property tells Nagios not to consider it, and therefore to ignore the lack of some parameters that would otherwise be required.

DOCUMENTATION List of object properties

A more in-depth understanding of the various ways in which Nagios can be configured can be obtained from the documentation provided by the nagios3-doc package. This documentation is directly accessible from the web interface, with the “Documentation” link in the top left corner. It includes a list of all object types, with all the properties they can have. It also explains how to create new plugins.

GOING FURTHER Remote tests with NRPE

Many Nagios plugins allow checking some parameters local to a host; if many machines need these checks while a central installation gathers them, the NRPE (Nagios Remote Plugin Executor) plugin needs to be deployed. The nagios-nrpe-plugin package needs to be installed on the Nagios server, and nagios-nrpe-server on the hosts where local tests need to run. The latter gets its configuration from /etc/nagios/nrpe.cfg. This file should list the tests that can be started remotely, and the IP addresses of the machines allowed to trigger them. On the Nagios side, enabling these remote tests is a simple matter of adding matching services using the new check_nrpe command.

Chapter 13. Workstation

Now that server deployments are done, the administrators can focus on installing the individual workstations and creating a typical configuration.

13.1. Configuring the X11 Server

The initial configuration for the graphical interface can be awkward at times; very recent video cards often don't work perfectly with the X.org version shipped in the Debian stable version.

A brief reminder: X.org is the software component that allows graphical applications to display windows on screen. It includes a driver that makes efficient use of the video card. The features offered to the graphical applications are exported through a standard interface, X11 (Squeeze contains its X11R7.5 version).

PERSPECTIVE X11, XFree86 and X.org