Book Image

Learning Nagios - Third Edition

By : Wojciech Kocjan, Piotr Beltowski
Book Image

Learning Nagios - Third Edition

By: Wojciech Kocjan, Piotr Beltowski

Overview of this book

Nagios, a powerful and widely used IT monitoring and management software for problem -solving. It detects problems related to your organizations infrastructure and helps in resolving the issue before it impacts the business. Following the success of the previous edition, this book will continue to help you monitor the status of network devices and also notify the system administrators of network problems. Starting with the fundamentals, the book will teach you how to install and configure Nagios for your environment. The book helps you learn how to end downtimes, adding comments and generating reports using the built-in Web interface of Nagios. Moving on, you will be introduced to the third-party web interfaces and applications for checking the status and report specific information. As you progress further in Learning Nagios, you will focus on the standard set of Nagios plugins and also focus on teach you how to efficiently manage large configurations and using templates. Once you are up to speed with this, you will get to know the concept and working of notifications and events in Nagios. The book will then uncover the concept of passive check and shows how to use NRDP (Nagios Remote Data Processor). The focus then shifts to how Nagios checks can be run on remote machines and SNMP (Simple Network Management Protocol) can be used from Nagios. Lastly, the book will demonstrate how to extend Nagios by creating custom check commands, custom ways of notifying users and showing how passive checks and NRDP can be used to integrate your solutions with Nagios. By the end of the book, you will be a competent system administrator who could monitor mid-size businesses or even large scale enterprises.
Table of Contents (19 chapters)
Learning Nagios - Third Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

Preface

This book is a practical guide to setting up Nagios, an open source network-monitoring tool. It is a system that checks whether hosts and services are working properly and notifies users when problems occur. The book covers the installation and configuring of Nagios 4 on various operating systems, with a focus on the Ubuntu Linux operating system. The book takes you through all the steps of compiling Nagios from source and installing and configuring advanced features such as redundant monitoring. It also mentions how to monitor various services, such as e-mail, WWW, databases, and file sharing. The book describes what SNMP is and how it can be used to monitor various devices. It also provides details of monitoring Windows computers. The book contains troubleshooting sections that aid you in case any problems arise while setting up Nagios functionalities. No previous experience with network monitoring is required, although it is assumed that you have a basic understanding of Unix systems. It also mentions examples to extend Nagios in JavaScript. The book also covers Nagios XI, a commercial offering built on top of the open source Nagios monitoring engine. It covers the basics of using Nagios XI as well as outlining the main differences between the open source version and the commercial product. When you finish this book, you'll be able to set up Nagios to monitor your network and will have a good understanding of what can be monitored.

What this book covers

Chapter 1, Introducing Nagios, talks about Nagios and system monitoring in general. It shows the benefits of using system-monitoring software and the advantages of Nagios in particular. It also introduces the basic concepts of Nagios.

Chapter 2, Installing Nagios 4, covers the installation of Nagios, from source code and using system packages such as rpm and deb. Installation from source code uses a fully automated script to set up Nagios that works on most Linux distributions; the process is explained in detail.

Chapter 3, Configuring Nagios, describes the process of configuring Nagios. Details on how to configure users, hosts, and services as well as information on how Nagios sends notifications to users are given in this chapter.

Chapter 4, Using the Built-in Web Interface, talks about how to use the Nagios web interface. It describes the basic views for hosts and services and provides detailed information about each item. It also introduces some features such as adding comments, scheduled downtimes, viewing detailed information, and generating reports.

Chapter 5, Using Additional Interfaces, mentions additional web interfaces that can be used to check the status of Nagios. The chapter mentions dashboards showing status, complete replacements for Nagios UI, as well as mobile applications that allow checking host and service status.

Chapter 6, Using the Nagios Plugins, goes through the standard set of Nagios plugins that allow you to perform checks of various services. It shows how you can check for standard services such as e-mail, Web, file, and database servers. It also describes how to monitor resources such as CPU usage, storage, and memory usage.

Chapter 7, Advanced Configuration, focuses on the efficient management of large configurations and the use of templates. It shows how dependencies between hosts and services can be defined and discusses custom variables and adaptive monitoring. It also introduces the concept of flapping and how it detects services that start and stop frequently.

Chapter 8, Notifications and Events, describes the notification system in more detail. It focuses on effective ways of communicating problems to users and how to set up problem escalations. It also describes how events work in Nagios and how they can be used to perform the automatic recovery of services.

Chapter 9, Passive Checks and NRDP, focuses on cases where external processes send results to Nagios. It introduces the concept of the passive check, which is not scheduled and run by Nagios, and gives practical examples of when and how it can be used. It also shows how to use the Nagios Remote Data Processor (NRDP) protocol to send notifications.

Chapter 10, Monitoring Remote Hosts, covers how Nagios checks can be run on remote machines. It walks through the details of deploying checks remotely over SSH using public key authentication. It also shows how Nagios Remote Plugin Executor (NRPE) can be used for deploying plugins remotely.

Chapter 11, Monitoring Using SNMP, describes how the Simple Network Management Protocol (SNMP) can be used from Nagios. It provides an overview of SNMP and its versions. It explains reading SNMP values from SNMP-aware devices and covers how that can then be used to perform checks from Nagios.

Chapter 12, Advanced Monitoring, focuses on how Nagios can be set up on multiple hosts and how that information could be gathered on a central server. It also covers how to monitor computers that run Windows.

Chapter 13, Programming Nagios, shows how to extend Nagios. It explains how to write custom check commands, how to create custom ways of notifying users, and how passive checks and NRDP can be used to integrate your solutions with Nagios. The chapter uses on JavaScript the programming language, but because of how Nagios works, the example can be implemented in any programming language.

What you need for this book

This book requires a Linux server to run Nagios on. As all of the examples are created using Ubuntu Linux, it is recommended that you use this distribution. However, the installation process should work on most Linux distributions. The book goes through the process of setting up Nagios and its web interface in Chapter 2, Installing Nagios 4, so installing it is not a prerequisite.

Who this book is for

This book is targeted at system administrators, both those who have no prior knowledge of Nagios and those experienced with it. It not only covers the basics of Nagios, but also the advanced features.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows:Code words in text are shown as follows: "The service-http service will define a check using check_http and optionally additional options for the check itself."

A block of code is set as follows:

 define service
 {
 use generic-service
 host_name mainrouter
 service_description OpenVPN
 check_command check_openvpn_remote
 check_interval 15
 max_check_attempts 3
 notification_interval 30
 notification_period 24x7
 }

Any command-line input or output is written as follows:

CHANGE_SVC_CHECK_COMMAND;linux1;PING;check_ping!500.0,50%

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "The shortcuts in this book are based on the Mac OS X 10.5+ scheme."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learning-Nagios-Third-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/LearningNagiosThirdEdition_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.