Detailed understanding of Checks and States in Nagios

Last updated on Nov 28 2021
Nitin Bajabalkar

Table of Contents

  Detailed understanding of Checks and States in Nagios

Nagios – Checks and States

Once the host and services are configured on Nagios, checks are used to see if the hosts and services are working as they are supposed to or not. Let us see an example to perform checks on host −

Consider that you have put your host definitions inside host1.cfg file in /usr/local/nagios/etc/objects directory.

cd /usr/local/nagios/etc/objects
gedit host1.cfg
This is how your host definitions look currently −
define host {
host_name host1
address 10.0.0.1
}

Now let us add check_interval directive. This directive is used to perform scheduled checks of the hosts for the number you set; by default it is in minutes. Using the definition below, checks on the host will be performed after every 3 minutes.

define host {
host_name host1
address 10.0.0.1
check_interval 3
}

In Nagios, 2 types of checks are performed on hosts and services −

  • Active Checks
  • Passive Checks

Active Checks

Active checks are initiated by Nagios process and then run on a regular scheduled basis. The check logic inside Nagios process starts the Active check. To monitor hosts and services running on remote machines, Nagios executes plugins and tells what information to collect. Plugin then gets executed on the remote machine where is collects the required information and sends then back to Nagios daemon. Depending on the status received on hosts and services, appropriate action is taken.

The figure shown below shows an active check −

image1 6

These are executed on regular intervals, as defined by check_interval and retry_interval.

Passive checks are performed by external processes and the results are given back to Nagios for processing.

Passive checks work as explained here −

image2 5

An external application checks the status on hosts/services and writes the result to External Command File. When Nagios daemon reads external command file, it reads and sends all the passive checks in the queue to process them later. Periodically when these checks are processed, notifications or alerts are sent depending on the information in check result.

The figure shown below shows a passive check −

image3 2

Thus, the difference between active and passive check is that active checks are run by Nagios and passive checks are run by external applications.

These checks are useful when you cannot monitor hosts/services on a regular basis.

Nagios stores the status of the hosts and services it is monitoring to determine if they are working properly or not. There would be many cases when the failures will happen randomly and they are temporary; hence Nagios uses states to check the current status of a host or service.

There are two types of states −

  • Soft state
  • Hard state

Soft state

When a host or service is down for a very short duration of time and its status is not known or different from previous one, then soft states are used. The host or the services will be tested again and again till the time the status is permanent.

Hard State

When max_check_attempts is executed and status of the host or service is still not OK, then hard state is used. Nagios executes event handlers to handle hard states.

The following figure shows soft states and hard states.

 

 

So, this brings us to the end of blog. This Tecklearn ‘Detailed understanding of Checks and States in Nagios’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Nagios and build a career in DevOps domain, then check out our interactive, Continuous Monitoring using Nagios Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/continuous-monitoring-using-nagios/

Continuous Monitoring using Nagios Training

About the Course

Tecklearn has specially designed this Continuous Monitoring using Nagios Training Course to advance your skills for a successful career in this domain. The course will cover different components of Nagios and how they are used in software development operations. You will get an in-depth knowledge of these concepts and will be able to work on related demos. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Nagios.

Why Should you take Continuous Monitoring using Nagios Training?

  • The average salary for Nagios Monitoring Engineer is $107,506 per year, ranging from $85,655 to $124,818.
  • Oracle, Raytheon, Abacus, Next, Apple, Wells Fargo & many other MNC’s worldwide use Nagios across industries.
  • According to Grand View Research, the DevOps market size is estimated to be worth $12.85 billion by 2025. DevOps professionals are highly paid and in-demand throughout industries including retail, eCommerce, finance, and technology.

What you will Learn in this Course?

Introduction to DevOps

  • What is Software Development
  • Software Development Life Cycle
  • Why DevOps?
  • What is DevOps?
  • DevOps Lifecycle
  • DevOps Tools
  • Benefits of DevOps
  • How DevOps is related to Agile Delivery
  • DevOps Implementation

Continuous Monitoring using Nagios

  • Introduction to Continuous Monitoring
  • Introduction to Nagios
  • Nagios Architecture
  • Monitoring Services in Nagios
  • Installing Nagios
  • Nagios Plugins (NRPE) and Objects
  • Nagios Commands and Notification
  • Monitoring of different servers using Nagios

Got a question for us? Please mention it in the comments section and we will get back to you.

 

0 responses on "Detailed understanding of Checks and States in Nagios"

Leave a Message

Your email address will not be published. Required fields are marked *