You are previewing Nagios Core Administration Cookbook - Second Edition.
O'Reilly logo
Nagios Core Administration Cookbook - Second Edition

Book Description

Over 90 hands-on recipes that will employ Nagios Core as the anchor of monitoring on your network

About This Book

  • Master the advanced configuration techniques of Nagios Core to model your network better by improving hosts, services, and contacts

  • Filter and improve the notifications that Nagios Core sends in response to failed checks, which can greatly assist you when diagnosing problems

  • Pull Nagios Core's data into a database to write clever custom reports of your own devise

  • Who This Book Is For

    If you are a network or system administrator and are looking for instructions and examples on working with Nagios Core, then this book is for you. Some basic shell command-line experience is required, and some knowledge of scripting would be helpful when we discuss how plugins work.

    What You Will Learn

  • Manage the configuration of Nagios Core with advanced techniques to achieve fine detail in your checks

  • Find, install, and even write your own check plugins

  • Filter notifications to send them to the right people or programs at the right time

  • Work around difficult network accessibility issues and delegate checks to other machines

  • Tweak a Nagios Core server to achieve both high performance and redundancy in case of disaster

  • Process the results of checks performed by other machines to monitor backups and similar processes

  • Extend Nagios Core to allow advanced scripting, reporting, and network visualization behavior

  • In Detail

    Nagios Core is an open source monitoring framework suitable for any network that ensures both internal and customer-facing services are running correctly and manages notification and reporting behavior to diagnose and fix outages promptly. It allows very fine configuration of exactly when, where, what, and how to check network services to meet both the uptime goals of your network and systems team and the needs of your users.

    This book shows system and network administrators how to use Nagios Core to its fullest as a monitoring framework for checks on any kind of network services, from the smallest home network to much larger production multi-site services. You will discover that Nagios Core is capable of doing much more than pinging a host or to see whether websites respond.

    The recipes in this book will demonstrate how to leverage Nagios Core's advanced configuration, scripting hooks, reports, data retrieval, and extensibility to integrate it with your existing systems, and to make it the rock-solid center of your network monitoring world.

    Style and approach

    Each chapter contains a set of step-by-step recipes to perform an example of a commonly performed task related to network administration. The book begins by focusing closely on the properties and configuration of Nagios Core itself, and gradually moves on to other pieces of software that can support, manage, and extend the system.

    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 code file.

    Table of Contents

    1. Nagios Core Administration Cookbook Second Edition
      1. Table of Contents
      2. Nagios Core Administration Cookbook Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why Subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Understanding Hosts, Services, and Contacts
        1. Introduction
        2. Creating a new network host
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Creating a new HTTP service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Creating a new e-mail contact
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Verifying configuration
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Creating a new hostgroup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Creating a new servicegroup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Creating a new contactgroup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Creating a new time period
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Running a service on all hosts on a group
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      9. 2. Working with Commands and Plugins
        1. Introduction
        2. Finding a plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Installing a plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Removing a plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Creating a new command
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Customizing an existing command
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Using an alternative check command for hosts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Writing a new plugin from scratch
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Implementing threshold checks in a plugin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Using macros as environment variables in a plugin
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
          5. See also
      10. 3. Working with Checks and States
        1. Introduction
        2. Specifying how frequently to check a host or service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Changing thresholds for PING RTT and packet loss
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Changing thresholds for disk usage
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Scheduling downtime for a host or service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Managing brief outages with flapping
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Adjusting flapping percentage thresholds for a service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      11. 4. Configuring Notifications
        1. Introduction
        2. Configuring notification periods
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Configuring notifications for groups
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Choosing states for notification
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Specifying the number of failed checks before notification
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Automating contact rotation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Defining an escalation for repeated notifications
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Defining a custom notification method
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Filtering notifications based on a host or service value
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      12. 5. Monitoring Methods
        1. Introduction
        2. Monitoring PING for any host
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Monitoring SSH for any host
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Checking an alternative SSH port
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Monitoring mail services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Monitoring web services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Checking that a website returns a given string
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Monitoring database services
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Monitoring the output of an SNMP query
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Monitoring a RAID or other hardware device
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        11. Creating an SNMP OID for monitoring
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      13. 6. Enabling Remote Execution
        1. Introduction
        2. Monitoring local services on a remote machine with NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Setting the listening address for NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Setting allowed client hosts for NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Creating new NRPE command definitions securely
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Giving limited sudo(8) privileges to NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Using check_by_ssh with key authentication instead of NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Using check_mk instead of NRPE
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      14. 7. Using the Web Interface
        1. Introduction
        2. Using the Tactical Overview
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Viewing and interpreting availability reports
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Viewing and interpreting trends
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Viewing and interpreting notification history
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Adding comments on hosts or services in the web interface
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Viewing configuration in the web interface
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Scheduling checks from the web interface
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more
          5. See also
        9. Acknowledging a problem via the web interface
          1. Getting started
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      15. 8. Managing Network Layout
        1. Introduction
        2. Creating a network host hierarchy
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Using the network map
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Choosing icons for hosts
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Establishing a host dependency
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Establishing a service dependency
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Monitoring individual nodes in a cluster
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Using the network map as an overlay
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      16. 9. Managing Configuration
        1. Introduction
        2. Grouping configuration files in directories
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        3. Keeping a configuration under version control
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        4. Configuring host roles using groups
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Building groups using regular expressions
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        6. Using inheritance to simplify configuration
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        7. Defining macros in a resource file
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        8. Using another object's directives in a host or service check
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Using custom directives
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        10. Dynamically building host definitions
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      17. 10. Security and Performance
        1. Introduction
        2. Using authentication for the Nagios Core web interface
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Using authenticated contacts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Writing debugging information to the Nagios log file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Monitoring Nagios performance with nagiostats
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Setting up a redundant monitoring host
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      18. 11. Automating and Extending Nagios Core
        1. Introduction
        2. Allowing and submitting passive checks
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Submitting passive checks from a remote host with NSCA
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Submitting passive checks in response to SNMP traps
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Setting up an event handler script
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        6. Tracking host and service states with Nagiosgraph
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Reading status in a MySQL database with NDOUtils
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Reading status from a Unix socket with MK Livestatus
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Writing customized Nagios Core reports
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        10. Getting extra visualizations with NagVis
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        11. Writing custom Nagios Core management scripts
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
      19. Index