Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Learning Nagios 4
Learning Nagios 4

Learning Nagios 4: 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.

eBook
$19.99 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Learning Nagios 4

Chapter 1. Introducing Nagios

Imagine you're working as an administrator of a large IT infrastructure. You just started receiving e-mails that a web application just stopped working. When you try to access the same page, it just doesn't load. What are the possibilities? Is it the router? Is it the firewall? Perhaps the machine hosting the page is down? Before you even start thinking rationally on what to do, your boss calls about the critical situation and demands explanations. In all this panic, you'll probably start plugging everything in and out of the network, rebooting the machine…and that doesn't help.

After hours of nervous digging into the issue, you've finally found the solution: the web server was working properly, but it would time out communication with the database server. This was because the machine with the DB did not receive the correct IP as yet another box ran out of memory and killed the DHCP server on it. Imagine how much time it would take to find all that manually? It would be a nightmare if the database server was in another branch of the company or in a different time zone and perhaps guys over there were still sleeping.

But what if you had Nagios up and running across your entire company? You would just go to the web interface and see that there are no problems with the web server and the machine on which it is running. There would also be a list of issues—the machine serving IP addresses to the entire company does not do its job and the database is down. If the setup also monitored the DHCP server itself, you'd get a warning e-mail that little swap memory is available on it or too many processes are running. Maybe it would even have an event handler for such cases to just kill or restart noncritical processes. Also, Nagios will try to restart the dhcpd process over the network in case it is down.

In the worst case, Nagios would speed up hours of investigation to 10 minutes. In the best case, you would just get an e-mail that there was such a problem and another e-mail that it's already fixed. You would just disable a few services and increase the swap size for the DHCP machine and solve the problem once and for all. Nobody would even notice that there was such a problem.

Understanding the basics of Nagios


Nagios is a tool for system monitoring. It means that Nagios watches computers or devices on your network and ensures that they are working as they should. Nagios constantly checks if other machines are working properly. It also verifies that various services on those machines are working fine. In addition, Nagios accepts other processes or machines reporting their status, for example, a web server can directly report if it is not overloaded to Nagios.

The main purpose of system monitoring is to detect as soon as possible any system that is not working properly so that users of that system will not report the issue to you first.

System monitoring in Nagios is split into two categories of objects: hosts and services. Hosts represent a physical or virtual device on your network (servers, routers, workstations, printers, and so on). Services are particular functionalities, for example, a Secure Shell (SSH) server (sshd process on the machine) can be defined as a service to be monitored. Each service is associated with a host on which it is running. In addition, machines can be grouped into host groups.

A major benefit of Nagios' performance checks is that it only uses four distinct states—Ok, Warning, Critical, and Unknown. It is also based on plugins—this means if you want to check something that's not yet possible to do, you just need to write a simple piece of code, and that's it!

The approach to only offer three states allows administrators to ignore monitoring values themselves and just decide on what the warning/critical limits are. This is a proven concept, and is far more efficient than monitoring graphs and analyzing trends. For example, system administrators tend to ignore things such as gradually declining storage space. People often simply ignore the process until a critical process runs out of disk space. Having a strict limit to watch is much better, because you always catch a problem regardless of whether it turns from warning to critical in 15 minutes or in a week. This is exactly what Nagios does. Each check performed by Nagios is turned from numeric values (such as the amount of disk space or CPU usage) to one of the three possible states.

Another benefit is a report stating that X services are up and running, Y are in warning state, and Z are currently critical, which is much more readable than a matrix of values. It saves you the time of analyzing what's working and what's failing. It can also help prioritize what needs to be handled first, and which problems can be handled later.

Nagios performs all of its checks using plugins. These are external components for which Nagios passes information on what should be checked and what the warning and critical limits are. Plugins are responsible for performing the checks and analyzing results. The output from such a check is the status (working, questionable, or failure) and additional text describing information on the service in details. This text is mainly intended for system administrators to be able to read the detailed status of a service.

Nagios comes with a set of standard plugins that allow performance checks for almost all services your company might offer. See Chapter 4, Using the Nagios Plugins, for detailed information on plugins that are developed along with Nagios. Moreover, if you need to perform a specific check (for example, connect to a Web service and invoke methods), it is very easy to write your own plugins. And that's not all—they can be written in any language and it takes less than 15 minutes to write a complete check command! Chapter 11, Programming Nagios, talks about that ability in more detail.

The benefits of monitoring resources

There are many reasons for you to ensure that all your resources are working as expected. If you're still not convinced after reading the introduction to this chapter, here are a few important points why it is important to monitor your infrastructure.

The main reason is quality improvement. If your IT staff can notice failures quicker by using a monitoring tool, they will also be able to respond to them much faster. Sometimes it takes hours or days to get the first report of a failure even if many users bump into errors. Nagios ensures that if something is not working, you'll know about it. In some cases, event handling can even be done so that Nagios can switch to the backup solution until the primary process is fixed. A typical case would be to start a dial-up connection and use it as a primary connection in cases when the company VPN is down.

Another reason is much better problem determination. Very often what the users report as a failure is far from the root cause of the problem, such as an email system is down due to the LDAP service not working correctly. If you define dependencies between hosts correctly, then Nagios will point out that the POP3 e-mail server is assumed to be "not working" because the LDAP service that it depends upon has a problem. Nagios will start checking the e-mail server as soon as the problem with LDAP has been resolved.

Nagios is also very flexible when it comes down to notifying people of what isn't functioning correctly. In most cases, your company has a large IT team or multiple teams. Usually, you want some people to handle servers, others to handle network switches/routers/modems. There might also be a team responsible for network printers or a division is made based on geographical locations. You can instruct Nagios on who is responsible for particular machines or groups of machines, so that when something is wrong, the right people will get to know of it. You can also use Nagios' web interface to manage who is working on what issue.

Monitoring resources not only is useful for finding problems, but also saves you from having them—Nagios handles warnings and critical situations differently. This means that it's possible to be aware of situations that may become problems really soon. For example, if your disk storage on an e-mail server is running out, it's better to be aware of this situation before it becomes a critical issue.

Monitoring can also be set up on multiple machines across various locations. These machines will then communicate all their results to a central Nagios server so that information on all hosts and services in your system can be accessed from a single machine. This gives you a more accurate picture of your IT infrastructure, as well as allows testing more complex systems such as firewalls. For example, it is vital that a testing environment is accessible from a production environment, but not the other way around.

It is also possible to set up a Nagios server outside the company's intranet (for example, over a dedicated DSL) to make sure that traffic from the Internet is properly blocked. It can be used to check if only certain services are available, for example, verify that only SSH and Hypertext Transfer Protocol (HTTP) are accessible from external IP addresses, and that services such as databases are inaccessible to users.

Main features

Nagios' main strength is flexibility—it can be configured to monitor your IT infrastructure in the way you want it. It also has a mechanism to react automatically to problems and has a powerful notification system. All of this is based on a clear object definition system, which in turn is based on a few types of objects, shown as follows:

  • Commands: These are definitions of how Nagios should perform particular types of checks. They are an abstraction layer on top of actual plugins that allow you to group similar types of operations.

  • Time periods: These are date and time spans at which an operation should or should not be performed. For example, Monday–Friday, 09:00–17:00.

  • Hosts and host groups: These are devices along with the possibility to group hosts. A single host might be a member of more than one group.

  • Services: These are various functionalities or resources to monitor on a specific host. For example, CPU usage, storage space, or Web server.

  • Contacts and contact groups: These are people that should be notified with information on how and when they should be contacted; contacts can be grouped, and a single contact might be a member of more than one group.

  • Notifications: These define who should be notified of what, for example, all errors for the linux-servers host group should go to the linux-admins contact group during working hours and to the critsit-team contact group outside of working hours. Notifications are not strictly an object, but a combination of all the preceding objects and are an essential part of Nagios.

  • Escalations: These are an extension to notifications; they define that after an object is in same state for specific period of time, other people should get notified of certain events—for example, a critical server being down for more than 4 hours should alert IT management so that they track the issue.

A beneficial feature of using Nagios is that it is a mature dependency system. For any administrator, it is obvious that if your router is down, then all machines accessed via it will fail. Some systems don't take that into account, and in such cases, you get a list of several failing machines and services. Nagios allows you to define dependencies between hosts to reflect actual network topology. For example, if a router that connects you to the rest of your network is down, Nagios will not perform checks for the subsequent parts and machines that are dependent on the router. This is illustrated in the following figure:

You can also define that a particular service depends on another service, either on the same host or a different host. In case one of the dependent services is down, a check for a service is not even performed.

For example, in order for your company's intranet application to function properly, both an underlying Web server and database server must be running properly. So, if a database service is not working properly, Nagios will not perform checks and/or not send notifications that your application is not working, because the root cause of the problem is that the database is not working properly. The database server might be on the same host or a different host. If the database is not working properly, if the dependent machine is down or not accessible, all services dependent on the database service will not be checked as well.

Nagios offers a consistent system of macro definitions. These are variables that can be put into all object definitions and depend on the context. They can be put inside commands, and depending on the host, service, and many other parameters, macro definitions are substituted accordingly. For example, a command definition might use an IP address of the host it is currently checking in all remote tests. It also makes it possible to put information such as the previous and current status of a service in a notification e-mail. Nagios 3 also offers various extensions to macro definitions, which make it an even more powerful mechanism.

Nagios also offers mechanism for scheduling planned downtimes. This is mainly used when maintenance of the IT infrastructure is to be carried out, and servers and/or services they provide are out of order for a period of time. You can let Nagios know that such an event will occur, and it will not send notifications about problems with hosts and/or services that have a scheduled downtime. In such cases, dependencies are also taken into consideration—if a database has a scheduled downtime, notifications for the services that depend on it will not be sent out. Nagios can also notify people of planned downtimes automatically. This allows creating an integrated process of scheduling downtimes that will also handle informing users.

Soft and hard states


Nagios works by checking if a particular host or service is working correctly and storing its status. Because the status of a service is only one of our possible values, it is crucial that it actually reflects what the current status is. In order to avoid detecting random and temporary failures, Nagios uses soft and hard states to describe what the current status is for a host or service.

Imagine that an administrator is restarting a Web server, and this operation makes connecting to the webpages unavailable for 5 seconds. Since such restarts are usually done at night to lower the number of users affected, this is an acceptable period of time. However, a problem might be that Nagios will try to connect to the server and notice it is actually down. If it would only rely on a single result, Nagios could trigger an alert that a Web server is down. It would actually be up and running again in a few seconds, but it could take a couple of minutes for Nagios to find that out.

To handle situations where a service is down for a very short time, or the test has temporarily failed, soft states were introduced. When a previous status of a check is unknown or is different from the previous one, Nagios will re-test the host or service a couple of times to make sure the change is permanent. Nagios assumes that the new result is a soft state. After additional tests have verified that the new state is permanent, it is considered a hard state.

Each host and service check defines the number of retries to perform before assuming a change is permanent. This allows more flexibility over how many failures should be treated as an actual problem instead of a temporary one. Setting the number of checks to 1 will cause all changes to be treated as hard instantly. The following figure is an illustration of soft and hard state changes, assuming that number of checks to be performed is set to 3:

This feature is very useful for checks that should skip short outages of a service or use a protocol that might fail in case of extensive traffic—such as ICMP or UDP. Monitoring devices over SNMP is also an example of a check that can fail in cases where a single check fails; nevertheless, the check will eventually succeed during the second or third check.

Note

The following section is mainly intended for people already familiar with Nagios' functionality and who only want to know what's been added to the new version.

If you are not experienced with Nagios, you may skip this section, because the features are described throughout the book.

What's new in Nagios 4.0


The 4.0 version of Nagios is a major release, and many changes have been made since the release of Nagios 3 in 2008. This version contains both new features and multiple improvements to existing functionality.

Nagios has also changed its name —it is now called Nagios Core, which is used to indicate the core, open source project for monitoring. This was also needed as more commercial solutions using Nagios were introduced. However, Nagios Core is still often referred to as simply Nagios, and throughout this book, any reference to Nagios indicates Nagios Core.

This release introduces a new element of Nagios—libnagios. It provides many data structures and algorithms that Nagios has already been using and allows using it in third-party applications and add-ons. This is especially useful for plugins and applications that communicate with Nagios, because they can depend on the library already being installed and can benefit from implementations optimized for performance. This functionality is described in more detail in Chapter 11, Programming Nagios, and Chapter 12, Using the Query Handler.

Another new feature is the query handler—it is a generic mechanism for communicating between the Nagios service and add-ons. It is a two-way communication protocol using Unix sockets for sending and receiving data.

It can be used to communicate with various parts of Nagios and allows easy integration with third-party solutions, such as allowing an application to run checks instead of a plugin. It can be used also for retrieving updates from service or host checks, and allows registering an application as the handler for a check or notification. The Nagios Event Radio Dispatcher (NERD), which works on top of the query handler, also allows subscribing to host and service status changes and updates.

Chapter 12, Using the Query Handler, talks about the query handler and NERD in more detail, as well as shows actual examples of using it.

Nagios 4 has introduced several minor features and improvements. Nagios 4 handling for hosts and services has been combined—this means that performing checks, sending notifications, and running events works the same for both types of objects. It is also possible to specify a parent service, which indicates dependencies between services, similar to how it works now for hosts.

An important goal of the Nagios 4 release is to improve Nagios' stability and scalability. Many parts of the Nagios internals have been optimized in terms of CPU and memory usage.

Previous versions of Nagios (up to 3.x) have worked as a single Nagios process, starting child processes to perform checks, notifications, and event handlers. This becomes an issue when running a large number of child processes because of how Unix operating systems create child processes—a process using a lot of memory consumes more resources to start a child process. Nagios 4 uses its main process for scheduling events and multiple worker processes for running the child processes. The workers do not use many resources, and are able to spawn child processes much faster.

Multiple components of Nagios were also optimized for performance. The event processing, macro expansion, and configuration parsing are now much faster, which improves startup time for Nagios as well as regular operations.

Nagios 4 also introduces a few backward incompatibilities. First, embedded Perl has been removed. This includes the Perl support, as well as all options related to it. The main reason was that this feature has caused many problems related to memory leaks, and disabling it has improved Nagios performance. This is also related to the new approach that Nagios worker processes mentioned earlier in the chapter.

It is no longer possible to define groups that include each other, that is, hostgroup1 including hostgroup2 and vice versa. This used to work in previous Nagios versions, but generates an error in Nagios 4.

The obsess_over_host and obsess_over_service options were merged as the obsess option. In Nagios 4, they are defined as aliases and will be removed in future versions of Nagios. Also, setting host and service obsess to different values is no longer possible.

All of the changes mentioned earlier in this section make Nagios 4 much less resource intensive. This allows monitoring more services and hosts without additional investment in servers. Thus, you should consider upgrading your Nagios setup even if you do not plan on using any of the new features.

Summary


In this chapter, we learned the basics of Nagios as a tool for performing system monitoring. It can be used to ensure that services are working correctly, problems are detected earlier, and appropriate people are aware when something's wrong.

We learned the basic types of objects in Nagios— commands, hosts, services, time periods, contacts, as well as object grouping. We have also found out about notifications and escalations, which can be used to notify administrators about problems.

The chapter also introduced the concept of dependencies that helps in understanding the root cause of complex problems.

We also learned the most important changes that Nagios 4 brings and how they can be used.

The next chapter will guide us through the process of setting up and configuring Nagios and the standard Nagios plugins.

Left arrow icon Right arrow icon

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
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 21, 2014
Length: 400 pages
Edition :
Language : English
ISBN-13 : 9781783288649
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Mar 21, 2014
Length: 400 pages
Edition :
Language : English
ISBN-13 : 9781783288649
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 158.97
Nagios Core Administration Cookbook Second Edition
$54.99
Learning Nagios 4
$48.99
Nagios Core Administration Cookbook
$54.99
Total $ 158.97 Stars icon

Table of Contents

12 Chapters
Introducing Nagios Chevron down icon Chevron up icon
Installing Nagios 4 Chevron down icon Chevron up icon
Using the Nagios Web Interface Chevron down icon Chevron up icon
Using the Nagios Plugins Chevron down icon Chevron up icon
Advanced Configuration Chevron down icon Chevron up icon
Notifications and Events Chevron down icon Chevron up icon
Passive Checks and NSCA Chevron down icon Chevron up icon
Monitoring Remote Hosts Chevron down icon Chevron up icon
Monitoring using SNMP Chevron down icon Chevron up icon
Advanced Monitoring Chevron down icon Chevron up icon
Programming Nagios Chevron down icon Chevron up icon
Using the Query Handler Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(10 Ratings)
5 star 70%
4 star 10%
3 star 0%
2 star 10%
1 star 10%
Filter icon Filter
Top Reviews

Filter reviews by




D. Barrett Jun 18, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As a longtime user of GroundWork, I've always had an abstraction layer between me and Nagios. I'd always thought that having a better understanding of the internals of GroundWork would make it easier for me to use, but I didn't take the opportunity to learn about Nagios until now.The book, Learning Nagios 4, by Wojciech Kocjan, weighs in at 400 pages and is the second edition. I found the book to be very well written, and it contained a lot of good technical information that I thought was interesting and beneficial.Chapter 1 introduces Nagios to the unfamiliar user, and Wojciech gives good examples that ensure system administrators that Nagios is suitable for them. can provide IT staff with a very good system to check infrastructure and software to ensure it's working correctly.Chapter 2 runs through installing and configuring Nagios. I was very pleased to see a book providing instructions on installing software from source, as it's rather unusual in my experience to find books that don't just provide installation by package manager. Going through common Nagios configurations was also interesting, as I learnt a few quirks about templates and precedence.Chapter 3 is all about the web interface that compliments Nagios. As a user of Nagios by proxy through GroundWork I was a little shocked at the Web GUI and how different it was to the interface I was used to, but it is nice to see Nagios 4 has implemented PHP support so there's a bigger avenue for theme customisation.Chapter 4 talks about the basic plugins that are provided with Nagios. If you're a follower of my blog you would've seen my Nagios plugins for OS X Server, some of which were co-authored with/by my friend Jedda Wignall. I learnt quite a bit about the inbuilt plugins that come with Nagios, including the plugins that can schedule package manager checks - very cool!Chapter 5 discusses advanced configuration details, mainly about templates and the nuances to inheritance, along with describing what flapping actually is. I thought the section on using multiple configurations (like OS type, location etc) to generate a configuration for a specific machine was quite interesting, and would allow the user to create advanced host settings with relative ease.Chapter 6 was a chapter that I found very interesting as it focused on alerts and contacts. As a former member of a very small team we were inundated by emails every day and it became hard to keep track of what was coming in. The authors example of constant email flooding was exactly what happened to us. It's worth spending a bit more time setting up proper alerts to make sure the right information reaches the right people, rather than spamming everyone constantly.Chapter 7 talks about passive checks, and how they compare to the normal active checks. NCSA, or the Nagios Service Check Acceptor is also discussed, which is a daemon on the client end that can send check results back to the monitoring service securely. I've not used either types of passive checks, so learning about them was quite interesting. I'm looking forward to putting them into good use some time.Chapter 8 contains a ton of great information and detail about the remote server checks performed by SSH, and the Nagios Remote Plugin Executor (NRPE). The author provides good arguments for choosing either of the services, depending on your requirements. I hadn't actually heard of NRPE before, but it looks to be quite powerful without the overhead of SSH connections by the host.Chapter 9 is all about SNMP and how it can interact with Nagios. In past experience I've only ever had bash scripts to process SNMP responses, but now I know how to implement it properly into Nagios without having a conduit processing script. I also never really knew much about SNMP, so it was good to learn about what SNMP actually is, not just how to interact with it, which can be an issue in some technical books where interacting is explained, but the source/destination isn't.Chapter 10 starts off by covering getting Nagios working with Windows clients, which to me isn't very applicable as I'm purely a Linux/Unix/OS X man myself so my eyes glazed over as I pushed through that section. Having said that, it's good to know Nagios monitoring is fully supported in Windows with the appropriate software installed. Another concept that is looked at in Chapter 10 is the setup and configuration of a multi-server master/slave setup with multiple Nagios servers. Now, unfortunately (or fortunately, depending on which way you look at it) I've not been in a position where I've needed to have multiple Nagios servers performing checks, but it's useful to know that it's possible, and to have some instructions on getting it set up.Chapter 11 is probably my favourite chapter of the book because it's all about programming Nagios plugins. The book has a multitude of examples written in different languages. I've always done my scripts in Bash, but had never even thought of writing plugins in PHP, which is my strongest language. Having seen code for a few languages (like Tcl) that I've heard of but not used, this book has encouraged me to try other languages for Nagios plugins, and not limit myself to Bash.Chapter 12, the final chapter, talks about the query handler which is used for two-way communications with Nagios. There's also a section on Nagios Event Radio Dispatcher (or NERD) which can be used for a real-time notification system for alerts.Overall, I would highly recommend this book to any sysadmins looking to implement an excellent monitoring solution that is easy to set up, yet powerful enough through its extensive plugin collection and flexibility. After reading this book I've come away with a stronger knowledge of Nagios that will benefit my work in the future.Note: I was provided with a free eBook to review this book, however, this review is 100% genuine and contains my true thoughts about the book.
Amazon Verified review Amazon
Thomas Weaver May 11, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book starts out by explain what Nagios is, what it can do, and why it is so popular, it then moves on to a step by step guide on how to install Nagios 4. Throughout the book step by step guides are given for both RedHat and Debian based systems although the book does state it mainly focuses on Ubuntu.You quickly have a basic installation and start to gather the basics of how everything works, the book then moves on to how Nagios can be used and its GUI. This gives you all the information you need to be able to start using Nagios and quickly start learning more advanced operations. This is the first time as well the book starts to talk about popular 3rd party additions, how to install them, and how to extend the Nagios functionality. The book then takes you through more advanced options about monitoring remote hosts, distributing load, using and creating your own plugins and new functionality introduced in Nagios 4.The book goes through monitoring all types of devices and operating systems, including Windows, Linux, network devices and 3rd Parties such as Amazon AWS and VMWare. In the final chapters example custom plugins are given in a multitude of languages including php, perl, python, tcl and explains how each one works and interacts with Nagios.The detail the books goes in to in every chapter from start to finish makes it appeal to the beginners, but the summary at the beginning of each chapter allows more advanced users to skip bits they already know. I would advise however not to to skip any as the book is full of great advise and gotchas from a clearly experienced author that will get even the most experienced asking themselves questions. For the beginners illustrations are used to help get the point across and to explain how Nagios fits together making it really easy to understand. The book does go through some 3rd party applications and plugins but I feel it could refer to a few more especially alternatives to the NSCA Daemon etc which has its limitations. This however is possibly a journey the reader should take on their own and the book does give the correct information and links to the reader to investigate things themselves. Beginners will love the troubleshooting sections in this book as Nagios can be a pain to debug sometimes and the tips given throughout the book are invaluable.This is a great book for beginners and Nagios masters a like. A beginner will have the skill to go it alone after reading the book and the confidence that they are doing things the correct way which with Nagios can be the one question you ask yourself the most. More advanced users will benefit from the lists of configuration options as a reference but also some great ideas on how to set things up and expand in the future. A must read for anyone either administering a current set up or looking at starting from scratch.
Amazon Verified review Amazon
Luca Nov 28, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Con questo testo son arrivato alla configurazione di un sistema completo e implementazione dei monitoraggi.Ovviamente lo step successivo è stato un lavoro di analisi e di creatività per trovare i punti da monitorare del mio sistema ela realizzazione di piccole procedure che restituissero i dati a Nagios.Il libro mi ha permesso un'ottima comprensione dello strumento.
Amazon Verified review Amazon
Stephen E. Fritz Aug 01, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Learning Nagios 4 by Wojciech Kocjan is an ambitious project. Its preface sets out its goal: to be a practical guide for setting up Nagios 4. It begins with installation, describes the tools available and their configuration and concludes with more advanced topics such as programming service checks and using query handlers. In between, it systematically covers the most important tools available to the sysadmin and how to use them. If that scope sounds ambitious, its 400 page length presages the thoroughness of its content.Although there is abundant documentation available from the project maintainers, that documentation is thorough, almost too much so. Equal weight is given to the less-commonly used options in that documentation, and reading it can become a burden. Kocjan's book, by selecting the most important topics, is better focused for practical implementations. The book thus achieves a practicality that only an experienced professional can attain.Nagios 4 -- a September 2013 milestone release -- is a good point for experienced administrators to review the application from the basics up. Periodic continuing education is important and milestone releases are an appropriate time to thoroughly review skills from the foundation up. Yet the book is also written at a level appropriate to new Nagios administrators. While a thorough knowledge of basic Linux skills is necessary, even those unfamiliar with Nagios will be able to build a monitoring system. While stating it is focused on Ubuntu, there is adequate discussion of installations from source and RPM-based distributions for administrators of other Linux distributions to understand Nagios. However, there are likely details specific to those other distributions that are not covered and will require additional research on the administrators part.Installation and ConfigurationThe book begins with basic installation and configuration tasks. The author's experience is evident. While some of the material looks like it is drawn directly from the maintainer's documentation, the format is much more practical. As opposed to the topic-based organization of the maintainer's technical documentation, the author's format is organized in an order that reflects a real-world implementation. For instance, the author includes a concise discussion of topology definitions with host definitions -- the point at which an administrator would define topology. Descriptions of the web interface and basic plugins follows. These are illustrated with practical examples.The author proceeds with advanced topics, such as organizing definitions in a maintainable manner with suggested sets of definitions and version control. Indeed, troubleshooting a Nagios installation that is not well organized will invariably add a great deal of time simply searching for errors in a poorly organized system. That organization is the foundation upon which more advanced definitions such as dependencies and templates are built.Having established a well-defined framework, the author then addresses the whole point of a monitoring system: events, notifications and escalations and event handlers. These are also illustrated with practical examples. Event handlers are often afforded only light coverage in Nagios manuals; that is not the case here. Event handlers a a Nagios strength that automate responses to events; the code required to restart a web server serves as an example. Adaptive monitoring is also often overlooked altogether, but is adequately described here.Advanced Nagios 4 Configuration and FeaturesEstablishing this solid foundation is only half the book. The second half explores much more advanced topics such as workload distribution, scalability and extending Nagios to monitor additional platforms.The Nagios Service Check Acceptor (NSCA) is more difficult to understand and implement, but the author does a good job explaining and providing an example. So, too, is the description and illustration of load distribution using ssh and the Nagios Remote Plugin Executor (NRPE), preferable to ssh because it reduces Nagios server overhead. SNMP is a protocol that, well-implemented, affords a great deal of availability and performance data. However, it can be a bit difficult to learn and understand. Here, the author's experience is evident as the text provides a very practical, understandable and thorough description of the protocol and its application.Finally, the last quarter of the book addresses the most advanced topics, such as Windows, distributed monitoring, programming and query handlers.Windows is ubiquitous in the enterprise, but requires expertise to monitor using Nagios. NSClient++ is the agent used and it provides NSCA, NRPE and other functionality. It also acts as an "interpretor" for Nagios to record Windows-specific data. Yet here, the author does not explore deploying and maintaining NSClient++ using Active Directory Group Policy Objects. Rather, the example provided is limited to manual installation and configuration -- an onerous and possibly impractical task for a Windows enterprise. However, the descriptions and examples provided are otherwise thorough and practical.Distributed monitoring is discussed only at a high level and examples are rather basic. However, implementing a distributed Nagios implementation is a complex task worthy of a book itself. This book lays out the reasons and higher-level architecture of distributed Nagios well enough for an administrator to recognize when it is required and with the necessary architectural understanding to research and design it.Programming, too, is covered at a high level. Several languages may be used and the author uses C for examples. Examples include web services, VMWare and Amazon Web Services -- topics of current and practical interest.The book ends with a discussion of Query Handlers -- a feature new to Nagios 4. Think of it as a Unix domain sockets communications implementation for Nagios. Query Handlers, using tools such as the Nagios Event Radio Dispatcher (NERD) and Google's open source Gource provide a framework to receive real-time updates from Nagios.ConclusionLearning Nagios 4 has an ambitious scope. Kocjan has the experience to deliver a thorough and well-organized book. The expertise is apparent from his recommendations for organized definitions and the logic flow of the presentation. The book is detailed enough for a new Nagios administrator to learn the application quickly. There is enough detail for seasoned administrators to learn about advanced features and how they are implemented. Even experts can benefit from a top to bottom review of the milestone Nagios 4 release.
Amazon Verified review Amazon
Richard J Breiten Jun 30, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As a 12-year veteran of system administration and systems engineering, system and network monitoring has always been one of those areas that could be improved. While Nagios has led the way in many ways with system monitoring, the newest Nagios 4 version leapfrogs ahead of where they were.This book by Wojciech Kocjan, a sys admin and programmer with 10 years experience, weighs in at 345 pages and is the second edition. I found the book well-written and contained good technical information, both for the novice and experienced user alike.Chapters 1/2 - The book begins by introducing the reader to Nagios and provides excellent explanations on how and why Nagios works as it does. The overview, while brief, still does a great job at explaining the terminology and provides some familiarity to the way Nagios handles events and monitoring. The book also provides a ground-up approach to installing Nagios and steps the reader through the same steps which would be required for an administrator in the real-world. The author goes to great lengths to aid the reader in being able to set up their own Nagios environment using Ubuntu, from downloading the source to installation, all the way to installing assorted plugins and setting up Nagios as a service. Extensive explanations on setting up monitoring hosts and hostgroups are also detailed, with diagrams and sample code explaining the steps a user would take. A particularly helpful portion of Chapter 2 in particular surrounds discussing notifications and how they are triggered within the environment - a topic which I, personally, would have poured over reading when I first began tinkering with Nagios.Chapter 3 - The book continues into discussing the setup and configuration of the web interface, as well as managing downtimes, services, and systems. Additionally, a brief exploration of third-party Nagios web interfaces is discussed towards the end of the chapter in the event the user prefers a different UI.Chapter 4 - Following setup and configuration of Nagios as well as the web interface, the author then takes the reader through explaining plugins and how they report status. Various scenarios for monitoring different system types is explored, including database and email systems, storage space, resources such as system load, etc, which the reader could find particularly helpful. The chapter finishes up with an exploration of third-party plugins and how to create their commands for different checks.Chapter 5 - One thing I appreciate the author delved into, however briefly, is advanced topics, including creating templates for hosts and custom variables. While this is still an introductory book, this topic can go a long way in helping a harried and frazzled system admin (because, honestly, who isn't these days?) in setting these up in their environment. In addition, some time is devoted to describing to the read what "flapping" is and its implications in the Nagios environment - a topic which, to date, I don't think has been explained quite as succinctly.Chapter 6 - This is devoted to discussing notifications and events, which ends up taking Nagios to 10. Being able to monitor and quantify your systems and network is great, but what good is it if you can't include notifications like instant messaging when you're offsite? Discussion of setting up notifications and escalations lends the reader to understanding how to be able to up their game by allowing Nagios to provide the information to the reader and team. Spending more time up front on setting up proper alerting and reporting will go far in keeping the reader's team from being inundated by emails, as in the author's example.Chapter 7 - Passive checks and utilization of NCSA (Nagios Service Check Acceptor) rounds out Chapter 7 with an explanation on understanding and setting up passive checks. Again, generic code, graphs, and examples are provided so the reader can follow along in their own Ubuntu VM (you are creating snapshots as you go along, right?). NCSA is a daemon specifically for sending check results back to Nagios securely. Speaking from experience, setting this up can be time-consuming and frustrating, but the author lends himself to explaining the intricacies well, hopefully keeping the reader from experiencing these pains.Chapter 8 - This holds almost a treasure trove full of information on using SSH and NRPE (Nagios Remote Plugin Executor) for monitoring and securely sending check results back to Nagios Core. NRPE lends itself to the same powerful execution as SSH without the overhead of connections back to the host. Discussion and examples of setting up the SSH and NRPE connections is provided, allowing the reader to be able to follow along in setting up their own connections.Chapter 9 - SNMP and monitoring are discussed in Chapter 9 with particular attention given to understanding Object Identifiers (OIDs) and how to leverage them in the environment. Delving into SNMP a bit with MIB and using various checks within Nagios to perform checks and alerts, as well as providing the reader a graphical way to understand and view SNMP data is provided. This can be particularly helpful for the admin not well-versed in using the command-line for parsing and understanding the readout from SNMP. Again, as in the rest of the text, graphs and illustrations are provided which explain and layout the information for the reader to hopefully set up their own SNMP agents and receive traps and data back into Nagios.Chapter 10 - More advanced topics are briefly discussed in Chapter 10, including distributed monitoring and specifically monitoring Windows hosts with NSClient++. I have had the most experience thus far in monitoring Windows clients, so it was refreshing to see the author spend some time in discussing setup and configuration of NSClient++ for the reader. Distributed monitoring can become cumbersome in setting up, but the author does a decent job in discussing obsessive notifications with additional sample code and diagrams for the reader to get their feet wet on the topic. Pulling from a previous chapter, some additional time is spent on utilizing templates for distributed environments, something that is invaluable in the Nagios ecosystem.Chapter 11/12 - The remainder of the book centers around discussing programming and customizing Nagios to the reader's heart's desire. Different Nagios file parsers are discussed, with links to the different language parsers, as well as an upper-level overview of utilizing libnagios for programming in C. A discussion on creating custom active checks with sample code, as well as discussion on writing the reader's own plugins the correct way is reviewed. A brief mention of monitoring VMware and AWS (Amazon Web Services) is provided, with some additional sample code to get the reader started. An introduction and explanation on the preferred way of using query handlers is discussed with attention to communicating with it programmatically.In conclusion, this is well-written and constructed, and definitely worth a read for any sysadmin or sysengineer looking to get started with using Nagios and setting up an outstanding (free!) monitoring solution. The addition of plugins extends Nagios usability and allows a flexibility and strength that puts it over to the top. While I've had experience in using and administering systems with Nagios before, this is a fantastic introduction and even intemediary book with enough meat to keep the reader following along with examples and sample code to construct their own monitoring environment, whether at home or in a large-scale production network at the office. Well worth the read and outstanding effort from Wojciech Kocjan, definitely a job well done. For additional information on the book, visit <a href=http://www.packtpub.com/learning-nagios-4/book>PacktPub</a>.Please note, I was provided a free copy of the book to review; however, this in no way detracts from the excellent job Wojciech has done in the formulation of this text nor the fantastic format and samples contained.
Amazon Verified review Amazon