Welcome to docs.opsview.com

Developing Plugins

Introduction

Nagios uses 'plugins' for the purpose of monitoring. A monitoring plugin is simply an executable or script that conforms to a standard. Nagios executes monitoring plugins on remote hosts via a monitoring agent (NRPE).

Guidelines

All plugins should conform to the Nagios Plugin Project guidelines.

In general:

  1. Script should be capable of running as 'nagios' user (not root)
  2. Script should be runnable using the full path and not from the current directory
    • i.e. cd /tmp ; /path/to/plugin <args>
  3. Script should generate a single, concise, line of output (on stdout, not stderr).
  4. Scripts should return the following exit codes
    • 0 - OK
    • 1 - Warning (warning threshold exceeded or script identified a minor problem)
    • 2 - Critical (critical threshold exceeded or script identified a 'critical' problem)
    • 3 - Unknown (invalid arguments, unable to gather data, etc)
  5. Specifying an argument of '-h' should return usage information (what the script does, what arguments it accepts, etc)
  6. Script should confirm to using standard switches (see the full guidelines for more information), i.e.
    • -H <hostaddress>
    • -c <critical limit>
    • -w <warning limit>