Skip to content

A set of templates for Nagios check scripts written in Python.

License

Notifications You must be signed in to change notification settings

MonitoringToolbox/nagios-plugin-python-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonitoringToolbox logo
Github Build Status License Created
Release Released Commits since release

Background

Wolf Software has been engaged in providing system, network, and security monitoring solutions from the very outset. Our expertise encompasses a wide range of monitoring solutions, including fundamental ones such as Munin and Nagios, as well as sophisticated enterprise-grade solutions like New Relic, Datadog, and AppDynamics. We also possess experience in creating customized monitoring solutions in-house, tailored to specific client requirements.

Overview

It is a common occurrence for companies to express the need for ready-made enterprise-grade monitoring solutions, asserting that solutions like Nagios are becoming obsolete due to the significant investment of time and resources required to make it operational, resulting in similar costs as those incurred with off-the-shelf solutions.

The goal of this project, as well as other initiatives within The Monitoring Toolbox, is to demonstrate the ease with which plugins can be developed for tools like Nagios and Munin, thereby enhancing their capabilities to a level that is more comparable to the more costly off-the-shelf alternatives.

How It Works

The provided template scripts aim to offer all the necessary core functionality while being as minimalistic and lightweight as possible.

Basic

The basic script provides 5 core functions.

  1. main - This function is where you add all of the check related code.
  2. handle_ok - This function displayed an OK prefixed message (if one is supplied) and then exits the script with the required exit code (0).
  3. handle_warning - This function displayed a WARNING prefixed message (if one is supplied) and then exits the script with the required exit code (1).
  4. handle_critical - This function displayed a CRITICAL prefixed message (if one is supplied) and then exits the script with the required exit code (2).
  5. handle_unknown - This function displayed an UNKNOWN prefixed message (if one is supplied) and then exits the script with the required exit code (3).

Advanced

The advanced script provides the same 5 functions as detailed above, along with an extra function.

  1. process_arguments - This function processes the command line arguments, does basic error checking and then calls the main function.

Template Scripts

Script Purpose
basic A basic example check using hard coded values.
advanced An advanced example check using command line parameters.

Alternate languages

We have replicated the aforementioned templates in various languages, as individuals and organizations often have a particular language preference or choice.

We would be pleased to generate templates in different languages upon request. Furthermore, we welcome individuals to submit pull requests that include additional languages.