You are previewing Learning Nagios 4.
O'Reilly logo
Learning Nagios 4

Book Description

For system administrators who want a fast, easily understood introduction to Nagios 4, this is the perfect book. Get to grips with the latest version of this powerful monitoring tool and transform the stability of your whole system.

In Detail

One of the most important challenges in system monitoring is to detect and report any malfunctioning system or device as soon as possible, so that you as an administrator are aware of the problem before a user runs into one.

Nagios is a powerful monitoring tool that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. It monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert the technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers.

"Learning Nagios 4" is a practical, beginner-level book that introduces you to setting up Nagios and walks you through all the basics of configuring it. It will guide you through the process of getting Nagios 4 up and running, using the web interface and monitoring IT systems. This book will also help you with understanding the typical problems encountered in setting up large-scale Nagios environments, as well as guide you through creating your very own Nagios plug-ins.

"Learning Nagios 4" will introduce Nagios to the system administrators who are interested in monitoring their systems as well as networks. This book starts by guiding you through setting up and configuring your first instance of Nagios so you can quickly start using it to ensure your IT is working properly.

The book also covers using SNMP to monitor various network-enabled devices. You will also find out how to use NSClient++ to monitor Microsoft Windows systems. The book explains distributed monitoring using multiple Nagios instances. Also, if you want to create your own plug-ins for Nagios, this book will teach you how to do so using programming languages like C and scripting languages like PHP, Perl, shell and Python.

By the end of this book, you will have all the necessary knowledge you need to set up Nagios 4 as well as for using Nagios in a large, distributed environment that monitors a large number of computers, services, and devices.

What You Will Learn

  • Install and configure Nagios to administer your network and system
  • Deploy agents and plug-ins, and monitor assets with advanced features of Nagios
  • Notify users of current and future incidents to protect the availability, performance, and security of monitored assets
  • Configure and work your way around the Nagios web interface
  • Pass service and host check results over the network using NSCA
  • Set up a working and usable distributed monitoring system using NSClient++
  • Develop custom plug-ins responsible for performing checks and analyzing results
  • Use the web interface to manage scheduled downtimes for hosts and services
  • Implement adaptive monitoring to modify various check-related parameters
  • Make use of SSH and NRPE to perform remote checks
  • Use SNMP to retrieve information from a device, set options, and also cover means for a device to notify other machines about a failure
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Learning Nagios 4
      1. Table of Contents
      2. Learning Nagios 4
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Introducing Nagios
        1. Understanding the basics of Nagios
          1. The benefits of monitoring resources
          2. Main features
        2. Soft and hard states
        3. What's new in Nagios 4.0
        4. Summary
      9. 2. Installing Nagios 4
        1. Installation
          1. Upgrading from previous versions
          2. Installing prerequisites
          3. Obtaining Nagios
          4. Setting up users and groups
          5. Compiling and installing Nagios
          6. Compiling and installing Nagios plugins
          7. Setting up Nagios as a system service
          8. Resolving errors with script for Nagios system service
        2. Configuring Nagios
          1. Creating the main configuration file
          2. Understanding macro definitions
          3. Configuring hosts
          4. Configuring host groups
          5. Configuring services
          6. Configuring service groups
          7. Configuring commands
          8. Configuring time periods
          9. Configuring contacts
          10. Configuring contact groups
          11. Verifying the configuration
          12. Understanding notifications
          13. Templates and object inheritance
        3. Summary
      10. 3. Using the Nagios Web Interface
        1. Setting up the web interface
          1. Configuring the web server
          2. Creating an administrative user for Nagios
          3. Accessing the web interface
          4. Troubleshooting
        2. Using the web interface
          1. Checking the tactical overview
          2. Viewing the status map
        3. Managing hosts
          1. Checking statuses
          2. Viewing host information
        4. Managing services
          1. Checking statuses
          2. Viewing service information
        5. Managing downtime
          1. Checking downtime statuses
          2. Scheduling downtime
        6. Managing comments
        7. Nagios information
          1. Viewing process information
          2. Checking performance information
        8. Generating reports
        9. Changing the look of the Nagios web interface
        10. Third-party Nagios web interfaces
        11. Summary
      11. 4. Using the Nagios Plugins
        1. Understanding how checks work
        2. Monitoring using the standard network plugins
          1. Testing the connection to a remote host
          2. Testing the connectivity using TCP and UDP
        3. Monitoring the e-mail servers
          1. Checking the POP3 and IMAP servers
          2. Testing the SMTP protocol
        4. Monitoring network services
          1. Checking the FTP server
          2. Verifying the DHCP protocol
          3. Monitoring the Nagios process
          4. Testing the websites
        5. Monitoring the database systems
          1. Checking MySQL
          2. Checking PostgreSQL
          3. Checking Oracle
          4. Checking other databases
        6. Monitoring the storage space
          1. Checking the swap space
          2. Monitoring the disk status using SMART
          3. Checking the disk space
          4. Testing the free space for remote shares
        7. Monitoring the resources
          1. Checking the system load
          2. Checking the processes
          3. Monitoring the logged-in users
        8. Monitoring other operations
          1. Checking for updates with APT
          2. Monitoring the UPS status
          3. Gathering information from the lm-sensors
          4. Using the dummy check plugin
          5. Manipulating other plugins' output
        9. Additional and third-party plugins
          1. Monitoring the network software
          2. Using third-party plugins
        10. Summary
      12. 5. Advanced Configuration
        1. Creating maintainable configurations
        2. Configuring the file structure
        3. Defining the dependencies
          1. Creating the host dependencies
          2. Creating the service dependencies
        4. Using the templates
          1. Creating the templates
          2. Inheriting from multiple templates
        5. Using the custom variables
        6. Understanding flapping
        7. Summary
      13. 6. Notifications and Events
        1. Creating effective notifications
          1. Using multiple notifications
          2. Sending instant messages via Jabber
          3. Notifying users with text messages
          4. Integrating with HipChat
        2. Understanding escalations
          1. Setting up escalations
          2. Understanding how escalations work
        3. Sending commands to Nagios
          1. Adding comments to hosts and services
          2. Scheduling host and service checks
          3. Modifying custom variables
        4. Creating event handlers
          1. Restarting services automatically
          2. Modifying notifications
        5. Using adaptive monitoring
        6. Summary
      14. 7. Passive Checks and NSCA
        1. Understanding passive checks
          1. Configuring passive checks
          2. Sending passive check results for hosts
          3. Sending passive check results for services
          4. Troubleshooting errors
        2. Using NSCA
          1. Downloading NSCA
          2. Compiling NSCA
          3. Configuring the NSCA server
          4. Sending results over NSCA
          5. Configuring NSCA for secure communication
        3. Summary
      15. 8. Monitoring Remote Hosts
        1. Monitoring over SSH
          1. Configuring the SSH connection
          2. Using the check_by_ssh plugin
          3. Performing multiple checks
          4. Troubleshooting the SSH-based checks
        2. Monitoring using NRPE
          1. Obtaining NRPE
          2. Compiling NRPE
          3. Configuring the NRPE daemon
          4. Setting up NRPE as a system service
          5. Configuring Nagios for NRPE
          6. Using command arguments with NRPE
          7. Troubleshooting NRPE
        3. Comparing NRPE and SSH
        4. Alternatives to SSH and NRPE
        5. Summary
      16. 9. Monitoring using SNMP
        1. Introducing SNMP
          1. Understanding data objects
        2. Working with SNMP and MIB
          1. Using graphical tools
        3. Setting up an SNMP agent
        4. Using SNMP from Nagios
          1. Receiving traps
          2. Using additional plugins
        5. Summary
      17. 10. Advanced Monitoring
        1. Monitoring Windows hosts
          1. Setting up NSClient++
          2. Performing tests using check_nt
          3. Performing checks with NRPE protocol
          4. Performing passive checks using NSCA Protocol
        2. Understanding distributed monitoring
          1. Introducing obsessive notifications
          2. Configuring Nagios instances
          3. Performing freshness checking
        3. Using templates for distributed monitoring
          1. Creating the host and service objects
          2. Customizing checks with custom variables
        4. Summary
      18. 11. Programming Nagios
        1. Introducing Nagios customizations
        2. Programming in C with libnagios
        3. Creating custom active checks
          1. Testing the correctness of the MySQL database
          2. Monitoring local time with a time server
          3. Writing plugins correctly
        4. Checking websites
        5. Virtualization and clouds
          1. Monitoring VMware
          2. Monitoring Amazon Web Services
        6. Writing commands to send notifications
        7. Managing Nagios
          1. Using passive checks
        8. Summary
      19. 12. Using the Query Handler
        1. Introducing the query handler
          1. Communicating with the query handler
          2. Using the query handler programmatically
        2. Using the core service
        3. Introducing Nagios Event Radio Dispatcher
          1. Displaying real-time status updates
          2. Displaying checks using Gource
        4. Summary
      20. Index