Ports and protocols and Add-ons and plugins in Nagios

Last updated on Nov 17 2021
Nitin Bajabalkar

Table of Contents

Ports and protocols and Add-ons and plugins in Nagios

Nagios – Ports and Protocols

This blog gives an idea of ports and protocols that Nagios comprises.

Protocols

The default protocols used by Nagios are as given under −

  • http(s), ports 80 and 443 − The product interfaces are web-based in Nagios. Nagios agents can use http to move data.
  • snmp, ports 161 and 162 − snmp is an important part of network monitoring. Port 161 is used to send requests to nodes and post 162 is used to receive results.
  • ssh, port 22 − Nagios is built to run natively on CentOS or RHEL Linux. Administrator can login into Nagios through SSH whenever they feel to do so and perform checks.

Ports

The Default ports used by common Nagios Plugins are as given under −

  • Butcheck_nt (nsclient++) 12489
  • NRPE 5666
  • NSCA 5667
  • NCPA 5693
  • MSSQL 1433
  • MySQL 3306
  • PostgreSQL 5432
  • MongoDB 27017, 27018
  • OracleDB 1521
  • Email (SMTP) 25, 465, 587
  • WMI 135, 445 / additional dynamically-assigned ports in 1024-1034 range

Nagios – Add-ons/Plugins

Plugins helps to monitor databases, operating systems, applications, network equipment, protocols with Nagios. Plugins are compiled executables or script (Perl or non-Perl) that extends Nagios functionality to monitor servers and hosts. Nagios will execute a Plugin to check the status of a service or host. Nagios can be compiled with support for an embedded Perl interpreter to execute Perl plugins. Without it, Nagios executes Perl and non-Perl plugins by forking and executing the plugins as an external command.

Types of Nagios Plugins

Nagios has the following plugins available in it −

Official Nagios Plugins − There are 50 official Nagios Plugins. Official Nagios plugins are developed and maintained by the official Nagios Plugins Team.

Community Plugins − There are over 3,000 third party Nagios plugins that have been developed by hundreds of Nagios community members.

Custom Plugins − You can also write your own Custom Plugins. There are certain guidelines that must be followed to write Custom Plugins.

Guidelines for Writing Custom Nagios Plugins

While writing custom plugin in Nagios, you need to follow the guidelines given below −

  • Plugins should provide a “-V” command-line option (verify the configuration changes)
  • Print only one line of text
  • Print the diagnostic and only part of the help message
  • Network plugins use DEFAULT_SOCKET_TIMEOUT to timeout
  • “-v”, or “–verbose“ is related to verbosity level
  • “-t” or “–timeout” (plugin timeout);
  • “-w” or “–warning” (warning threshold);
  • “-c” or “–critical” (critical threshold);
  • “-H” or “–hostname” (name of the host to check)

Multiple Nagios plugin run and perform checks at the same time, for all of them to run smoothly together, Nagios plugin follow a status code. The table given below tells the exit code status and its description −

Exit Code Status Description
0 OK Working fine
1 WARNING Working fine, but needs attention
2 CRITICAL Not working Correctly
3 UNKNOWN When the plugin is unable to determine the status of the host/service

Nagios plugins use options for their configuration. The following are few important parameters accepted by Nagios plugin −

Sr.No Option & Description
1 -h, –help

This provides help

2 -V, –version

This prints the exact version of the plugin

3 -v, –verbose

This makes the plugin give a more detailed information on what it is doing

4 -t, –timeout

This provides the timeout (in seconds); after this time, the plugin will report CRITICAL status

5 -w, –warning

This provides the plugin-specific limits for the WARNING status

6 -c, –critical

This provides the plugin-specific limits for the CRITICAL status

7 -H, –hostname

This provides the hostname, IP address, or Unix socket to communicate with

8 -4, –use-ipv4

This lets you use IPv4 for network connectivity

9 -6, –use-ipv6

This lets you use IPv6 for network connectivity

10 -p, –port

This is used to connect to the TCP or UDP port

11 -s, — send

This provides the string that will be sent to the server

12 -e, –expect

This provides the string that should be sent back from the server

13 -q, –quit

This provides the string to send to the server to close the connection

Nagios plugin package has lot of checks available for hosts and services to monitor the infrastructure. Let us try out Nagios plugins to perform few checks.

SMTP is a protocol that is used for sending emails. Nagios standard plugins have commands for perform checks for SMTP. The command definition for SMTP −

define command {
command_name check_smtp
command_line $USER2$/check_smtp -H $HOSTADDRESS$
}

Let us use Nagios plugin to monitor MySQL. Nagios offers 2 plugins to monitor MySQL. The first plugin checks if mysql connection is working or not, and the second plugin is used to calculate the time taken to run a SQL query.

The commands definitions for both are as follows −

define command {
command_name check_mysql
command_line $USER1$/check_mysql –H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d
$ARG3$ -S –w 10 –c 30
}

define command {
command_name check_mysql_query
command_line $USER1$/check_mysql_query –H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d
$ARG3$ -q $ARG4$ –w $ARG5$ -c $ARG6$
}

Note − Username, password, and database name is required as arguments in both the commands.

Nagios offers plugin to check the disk space mounted on all the partitions. The command definition is as follows

define command {
command_name check_partition
command_line $USER1$/check_disk –p $ARG1$ –w $ARG2$ -c $ARG3$
}

Majority of checks can be done through standard Nagios plugins. But there are applications which require special checks to monitor them, in which case you can use 3rd party Nagios plugins which will provide more sophisticated checks on the application. It is important to know about security and licensing issues when you are using a 3rd party plugin form Nagios exchange or downloading the plugin from another website.

So, this brings us to the end of blog. This Tecklearn ‘Posts and protocols and Add-ons and plugins 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 "Ports and protocols and Add-ons and plugins in Nagios"

Leave a Message

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