Skip to main content

Nagios Plugins

Plugin: scripts.d.plugin Module: nagios

Overview

This module runs unmodified Nagios plugins inside Netdata without any changes to the plugins themselves.

For each configured job it collects:

  • Check state: OK / WARNING / CRITICAL / UNKNOWN (with soft/hard state tracking).
  • Performance data: Every label=value;warn;crit;min;max metric emitted by the plugin is parsed and charted automatically, with unit normalization where possible.
  • Execution telemetry: Runtime duration, scheduling latency, CPU time, peak RSS memory, and disk I/O per job.
  • Scheduler health: Running / queued / scheduled job counts and throughput rates.

Jobs are executed via nd-run (the Netdata unprivileged helper) at the configured check_interval. Standard Nagios macros ($HOSTADDRESS$, $ARG1$, $USERn$, etc.) are expanded before execution. Plugin output is parsed according to the Nagios Plugin API: the first line provides the status and optional performance data after the | separator.

This collector is supported on all platforms.

This collector supports collecting metrics from multiple instances of this integration, including remote instances.

Plugins run as the netdata user via nd-run. If a plugin requires elevated privileges, configure it through ndsudo or adjust filesystem permissions accordingly.

Default Behavior

Auto-Detection

No auto-detection. Each job must be explicitly configured with a plugin path pointing to the Nagios plugin executable.

Limits

The default configuration for this integration does not impose any limits on data collection.

Performance Impact

Each job spawns a subprocess via nd-run. Resource usage (CPU, memory, disk I/O) is tracked per execution and exposed as telemetry charts.

Metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

Virtual Node Label Conventions

When a job references a vnode, the module reads Nagios macros from the virtual node's labels using prefix conventions:

Label keyNagios macroEnvironment variableDescription
_address$HOSTADDRESS$NAGIOS_HOSTADDRESSIP address or DNS name of the host
_alias$HOSTALIAS$NAGIOS_HOSTALIASHuman-readable host alias
_VARNAME$_HOSTVARNAME$NAGIOS__HOSTVARNAMECustom host variable (any _ prefixed key except _address and _alias)
key$_HOSTLABEL_KEY$NAGIOS__HOSTLABEL_KEYRegular label (no _ prefix)

Example vnode configuration (/etc/netdata/vnodes/hosts.yaml):

- hostname: web-server-1
guid: 12345678-1234-1234-1234-123456789abc
labels:
_address: "192.168.1.10"
_alias: "Web Server 1"
_DATACENTER: "us-east-1"
role: "frontend"
environment: "production"

This produces:

MacroValue
$HOSTADDRESS$192.168.1.10
$HOSTALIAS$Web Server 1
$_HOSTDATACENTER$us-east-1
$_HOSTLABEL_ROLE$frontend
$_HOSTLABEL_ENVIRONMENT$production

Per job

Metrics for each configured Nagios plugin job.

Labels:

LabelDescription
nagios_jobJob name as defined in the configuration.
nagios_pluginBasename of the plugin executable.
nagios_vnodeVirtual node associated with the job (if any).
nagios_schedulerScheduler executing the job.

Metrics:

MetricDimensionsUnit
nagios.jobs.stateok, warning, critical, unknownstate
nagios.jobs.runtimerunning, retrying, skippedboolean
nagios.jobs.latencydurationseconds
nagios.jobs.cpucpuseconds
nagios.jobs.memrssbytes
nagios.jobs.diskread, writebytes

Per perfdata

Metrics extracted from the plugin's performance data output. Each label=value;warn;crit;min;max entry produces a separate chart.

Labels:

LabelDescription
nagios_jobJob name.
nagios_pluginPlugin executable.
perf_labelPerformance data label as emitted by the plugin.

Metrics:

MetricDimensionsUnit
nagios.{script}.{label}valuevaries

Per scheduler

Scheduler-level metrics.

Labels:

LabelDescription
nagios_schedulerScheduler name.

Metrics:

MetricDimensionsUnit
nagios.scheduler.jobsrunning, queued, scheduledjobs
nagios.scheduler.ratestarted, finished, skippedjobs
nagios.scheduler.nextnextseconds

Alerts

There are no alerts configured by default for this integration.

Setup

Prerequisites

Install Nagios plugins

Install the plugins you want to run. Most distributions provide packages:

# Debian/Ubuntu
apt install nagios-plugins

# RHEL/CentOS/Fedora
dnf install nagios-plugins-all

You can also use any script or binary that follows the Nagios Plugin API.

Configuration

Options

Each job defines a single Nagios plugin execution. Jobs are listed under the jobs key.

Config options
GroupOptionDescriptionDefaultRequired
GeneralpluginAbsolute path to the Nagios plugin executable.yes
ArgumentsargsCommand-line arguments passed to the plugin. Nagios macros are expanded before execution.[]no
arg_valuesValues bound to positional $ARGn$ macros (max 32).[]no
GeneralvnodeVirtual node name to associate with this job. The vnode must be defined in the vnodes configuration directory.no
schedulerName of the scheduler that executes this job.defaultno
TimingtimeoutMaximum execution time before the plugin is killed. Duration string (e.g. 30s, 1m).30sno
timeout_stateState reported when a timeout occurs.criticalno
check_intervalBase scheduling interval between executions. Duration string.1mno
retry_intervalInterval between soft retries after a non-OK result. Duration string.30sno
max_check_attemptsNumber of soft-state attempts before transitioning to a hard state.3no
Environmentuser_macrosKey/value pairs exposed as $USERn$ macros. For example, USER1 becomes $USER1$.{}no
custom_varsKey/value pairs exported as $_SERVICEvar$ environment variables (NAGIOS__SERVICEvar).{}no
environmentAdditional environment variables set before executing the plugin.{}no
Generalworking_directoryWorking directory for plugin execution.no

via File

The configuration file name for this integration is scripts.d/nagios.conf.

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config scripts.d/nagios.conf
Examples
SSL certificate check

Check SSL certificate expiry for a host.

Config
jobs:
- name: ssl_github
plugin: /usr/lib/nagios/plugins/check_http
args: ["-H", "github.com", "--ssl", "-C", "30,15"]
timeout: 30s
check_interval: 1h
retry_interval: 5m
max_check_attempts: 3

Check with macros and vnode

Run a plugin against a virtual node using Nagios macros. The $HOSTADDRESS$ and $ARG1$ macros are expanded from the vnode labels and arg_values.

Config
jobs:
- name: check_ssh
plugin: /usr/lib/nagios/plugins/check_ssh
args: ["-H", "$HOSTADDRESS$", "-p", "$ARG1$"]
arg_values: ["22"]
vnode: my-server
check_interval: 5m

Check with custom vars

Pass service-level custom variables to a plugin as $_SERVICEvar$ macros.

Config
jobs:
- name: check_api
plugin: /usr/local/bin/check_api
args: ["-u", "$_SERVICEENDPOINT$"]
custom_vars:
ENDPOINT: "/health"

Troubleshooting

Plugin exits with "permission denied".

Macros like $HOSTADDRESS$ are not expanded.


Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.