Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nrpe cookbook added

  • Loading branch information...
commit 3c8811dcd4d8d1c20a1313c0af5002bf67de30be 1 parent d72e7b6
@mdxp authored
View
8 nrpe/README.rdoc
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
View
18 nrpe/attributes/default.rb
@@ -0,0 +1,18 @@
+default[:nrpe][:allowed_hosts] = "127.0.0.1"
+default[:nrpe][:interface] = "eth0"
+default[:nrpe][:plugin_dir] = "/usr/lib/nagios/plugins"
+
+# load average check: 5, 10 and 15 minute averages
+default[:nrpe][:load][:enable] = true
+default[:nrpe][:load][:warning] = "3,6,8"
+default[:nrpe][:load][:critical] = "6,12,16"
+
+# free memory
+default[:nrpe][:free_memory][:enable] = false
+default[:nrpe][:free_memory][:warning] = 250
+default[:nrpe][:free_memory][:critical] = 150
+
+# free disk space percentage
+default[:nrpe][:free_disk][:enable] = true
+default[:nrpe][:free_disk][:warning] = "15"
+default[:nrpe][:free_disk][:critical] = "10"
View
19 nrpe/files/default/checklogs/apache.cfg
@@ -0,0 +1,19 @@
+$seekfilesdir = '/usr/lib/nagios/tmp';
+# where the state information will be saved.
+
+$protocolsdir = '/usr/lib/nagios/tmp';
+# where protocols with found patterns will be stored.
+
+$scriptpath = '/usr/lib/nagios/tmp';
+# where scripts will be searched for.
+
+
+@logs = (
+ {
+ logfile => '/var/log/apache2/error.log',
+ rotation => 'debian',
+ criticalpatterns => ['Exception','Fatal.*memory.*exhausted','Critical ','All workers are in error state', 'MbMemCache ERROR\[pconnect failed', 'getAllBidsByUser: Fatal - MbDb::sqlExecute() failed', 'server reached MaxClients setting', 'PHP Fatal error:.*Class.*not found', 'FATAL: No strategy config in memcache','Segmentation fault','PHP crashed'],
+ warningpatterns => ['memcache set failed',],
+ options => 'noprotocol,count'
+ },
+);
View
25 nrpe/files/default/checklogs/base.cfg
@@ -0,0 +1,25 @@
+$seekfilesdir = '/usr/lib/nagios/tmp';
+# where the state information will be saved.
+
+$protocolsdir = '/usr/lib/nagios/tmp';
+# where protocols with found patterns will be stored.
+
+$scriptpath = '/usr/lib/nagios/tmp';
+# where scripts will be searched for.
+
+
+@logs = (
+ {
+ logfile => '/var/log/syslog',
+ rotation => 'debian',
+ criticalpatterns => ['Error.*NMI', 'Fatal', 'FATAL', 'unrecoverable', 'Out of Memory:', 'I/O error', 'Medium Error','mptscsih: ioc0: attempting task abort','Out of socket memory'],
+ options => 'noprotocol,count'
+ },
+ {
+ logfile => '/var/log/messages',
+ rotation => 'debian',
+ criticalpatterns => ['Error.*NMI', 'FATAL', 'unrecoverable', 'kernel:.*oom-killer:', 'kernel:.*Out of Memory.*Kill'],
+ options => 'noprotocol,count'
+ },
+);
+
View
20 nrpe/files/default/checklogs/lighttpd.cfg
@@ -0,0 +1,20 @@
+$seekfilesdir = '/usr/lib/nagios/tmp';
+# where the state information will be saved.
+
+$protocolsdir = '/usr/lib/nagios/tmp';
+# where protocols with found patterns will be stored.
+
+$scriptpath = '/usr/lib/nagios/tmp';
+# where scripts will be searched for.
+
+
+@logs = (
+ {
+ logfile => '/var/log/lighttpd/error.log',
+ rotation => 'debian',
+ criticalpatterns => ['FATAL', 'stopped', 'failed', 'unable to'],
+ criticalexceptions => ['get_password failed', 'http-header-glue'],
+ options => 'noprotocol,count,nocase'
+ },
+);
+
View
20 nrpe/files/default/checklogs/mail.cfg
@@ -0,0 +1,20 @@
+$seekfilesdir = '/usr/lib/nagios/tmp';
+# where the state information will be saved.
+
+$protocolsdir = '/usr/lib/nagios/tmp';
+# where protocols with found patterns will be stored.
+
+$scriptpath = '/usr/lib/nagios/tmp';
+# where scripts will be searched for.
+
+
+@logs = (
+ {
+ logfile => '/var/log/mail.log',
+ rotation => 'debian',
+ criticalpatterns => ['_is_blocked.__', 'refused to talk to me', 'postmaster.info.aol.com/errors'],
+ criticalexceptions => ['temporarily','try again later','service not available','453','try later','License has expired'],
+ options => 'noprotocol,count,nocase'
+ },
+);
+
View
18 nrpe/files/default/checklogs/memcached.cfg
@@ -0,0 +1,18 @@
+$seekfilesdir = '/usr/lib/nagios/tmp';
+# where the state information will be saved.
+
+$protocolsdir = '/usr/lib/nagios/tmp';
+# where protocols with found patterns will be stored.
+
+$scriptpath = '/usr/lib/nagios/tmp';
+# where scripts will be searched for.
+
+
+@logs = (
+ {
+ logfile => '/var/log/memcached',
+ criticalpatterns => ['accept(): Too many open files',],
+ options => 'noprotocol,count'
+ },
+);
+
View
450 nrpe/files/default/plugins/Nagios/Plugin.pm
@@ -0,0 +1,450 @@
+#
+# Common stuff for Nagios plugins
+#
+
+package Nagios::Plugin;
+
+use strict;
+require Exporter;
+use File::Basename;
+use Config::Tiny;
+use Carp;
+use Getopt::Long;
+Getopt::Long::Configure('bundling');
+
+use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $PLUGIN $TIMEOUT $VERBOSE $VERSION);
+
+@ISA = qw(Exporter);
+@EXPORT = qw($PLUGIN $TIMEOUT $VERBOSE parse_args nagios_exit exit_results);
+@EXPORT_OK = qw(load_config);
+%EXPORT_TAGS = (
+ std => [ @EXPORT ],
+ all => [ @EXPORT, @EXPORT_OK ],
+);
+
+$TIMEOUT = 15;
+
+BEGIN {
+ my ($pkg, $filename) = caller(2);
+ # basename $0 works fine for deriving plugin name except under ePN
+ if ($filename && $filename !~ m/EVAL/i) {
+ $PLUGIN = basename $filename;
+ } else {
+ # Nasty hack - under ePN, try and derive the plugin name from the pkg name
+ $PLUGIN = lc $pkg;
+ $PLUGIN =~ s/^.*:://;
+ $PLUGIN =~ s/_5F/_/gi;
+ }
+}
+
+my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
+
+# Nagios::Plugin version (not _plugin_ version)
+$VERSION = 0.04;
+
+# ------------------------------------------------------------------------
+# Private subroutines
+
+sub print_revision
+{
+ my ($version) = @_;
+ print "$PLUGIN $version";
+}
+
+sub print_help {
+ my ($version, $usage, $help, $licence, $blurb, $help_extra) = @_;
+ print_revision($version);
+ print "$licence\n";
+ print "$blurb\n" if $blurb;
+ print "$usage\n";
+ print $help;
+ print $help_extra if $help_extra;
+}
+
+# ------------------------------------------------------------------------
+# Public subroutines
+
+# load_config('section')
+sub load_config {
+ my ($section) = @_;
+ $section ||= $PLUGIN;
+ my $config_file = '/etc/nagios/plugins.cfg';
+ return {} unless -f $config_file;
+ my $ct = Config::Tiny->read($config_file);
+ return { %{$ct->{$section} || {}} } if ref $ct;
+ return {};
+}
+
+# nagios_exit("CODE", "error string")
+sub nagios_exit
+{
+ my $code = shift;
+ my $errstr = join ', ', @_;
+ $code ||= "UNKNOWN";
+ die "invalid code '$code'" unless exists $ERRORS{$code};
+ if ($errstr && $errstr ne '1') {
+ $errstr .= "\n" unless substr($errstr,-1) eq "\n";
+ my $short_name = uc $PLUGIN;
+ $short_name =~ s/^check_//i;
+ print "$short_name $code - $errstr";
+ }
+ exit $ERRORS{$code};
+}
+
+# parse_args(version => $v, usage => $u, spec => \@s)
+sub parse_args
+{
+ my %arg = @_;
+
+ foreach (qw(usage version spec)) {
+ croak "missing required argument '$_'" unless exists $arg{$_};
+ }
+
+ my $usage = sprintf $arg{usage}, $PLUGIN;
+ $usage .= "\n" if substr($usage,-1) ne "\n";
+ my $version = $arg{version};
+ $version .= "\n" if substr($version,-1) ne "\n";
+ my $spec = $arg{spec};
+ my $blurb = $arg{blurb} || '';
+ $blurb .= "\n" if $blurb && substr($blurb,-1) ne "\n";
+ my $licence = $arg{licence} || $arg{license} || qq(
+This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
+It may be used, redistributed and/or modified under the terms of the GNU
+General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).
+);
+ $licence .= "\n" if $licence && substr($licence,-1) ne "\n";
+ my $help_extra = $arg{help_extra};
+ $help_extra .= "\n" if $help_extra && substr($help_extra,-1) ne "\n";
+ croak "invalid spec argument - not array ref" unless ref $spec eq 'ARRAY';
+ croak "odd number of spec elements" unless int(scalar @$spec % 2) == 0;
+
+ # Build up options and help text from spec array
+ my ($show_usage, $show_help, $show_version, @verbose);
+ my @opt = (
+ "usage|?" => \$show_usage,
+ "help|h" => \$show_help,
+ "version|V" => \$show_version,
+ "timeout|t=i" => \$TIMEOUT,
+ "verbose|v" => \@verbose,
+ );
+ my $help_tmpl = qq(Options:
+ -h, --help
+ Print detailed help screen
+ -V, --version
+ Print version information
+%s
+ -t, --timeout=INTEGER
+ Seconds before plugin times out (default: $TIMEOUT)
+ -v, --verbose
+ Show details for command-line debugging
+);
+ my $help = '';
+ my @req = ();
+ while (@$spec) {
+ my $opt = shift @$spec;
+ my $elt = shift @$spec;
+ croak "spec element for option '$opt' is not array ref"
+ unless ref $elt eq 'ARRAY';
+ my ($var, $help_text, $req) = @$elt;
+ push @opt, $opt, $var;
+ $help_text = " $help_text" unless substr($help_text,0,1) eq ' ';
+ $help_text .= "\n" unless substr($help_text,-1) eq "\n";
+ $help .= $help_text;
+ push @req, $var if $req;
+ }
+ chomp $help;
+ $help = sprintf $help_tmpl, $help;
+
+ my $result = GetOptions(@opt) || print($usage) && exit;
+
+ # Handle standard options
+ nagios_exit("UNKNOWN", print_revision($version)) if $show_version;
+ nagios_exit("UNKNOWN", print($usage)) if $show_usage;
+ nagios_exit("UNKNOWN", print_help($version,$usage,$help,$licence,$blurb,$help_extra))
+ if $show_help;
+
+ # Check required arguments
+ for (@req) {
+ if (ref $_ eq 'SCALAR') {
+ &nagios_exit("UNKNOWN", print($usage)) unless defined $$_;
+ } elsif (ref $_ eq 'ARRAY') {
+ &nagios_exit("UNKNOWN", print($usage)) unless @$_;
+ } else {
+ die "invalid required reference '$_' - expected scalar ref or array ref only";
+ }
+ }
+
+ # Setup alarm handler (will handle any alarm($TIMEOUT) for plugin)
+ $SIG{ALRM} = sub {
+ &nagios_exit("UNKNOWN", "no response from $PLUGIN (timeout, ${TIMEOUT}s)");
+ };
+
+ $VERBOSE = scalar(@verbose);
+}
+
+# exit_results(%arg)
+# returns CRITICAL if @{$arg{CRITICAL}}, WARNING if @{$arg{WARNING}}, else OK
+# uses $arg{results} for message if defined, else @{$arg{<STATUS>}},
+# where <STATUS> is the return code above
+sub exit_results
+{
+ my (%arg) = @_;
+
+ my %keys = map { $_ => 1 } qw(CRITICAL WARNING OK results);
+ for (sort keys %arg) {
+ croak "[Nagios::Plugin::exit_results] invalid argument $_" unless $keys{$_};
+ }
+
+ my $results = '';
+ my $delim = ' : ';
+ if ($arg{results}) {
+ $results = ref $arg{results} eq 'ARRAY' ?
+ join($delim, @{$arg{results}}) :
+ $arg{results};
+ }
+
+ if ($arg{CRITICAL} && (ref $arg{CRITICAL} ne 'ARRAY' || @{$arg{CRITICAL}})) {
+ &nagios_exit("CRITICAL", $results) if $results;
+ &nagios_exit("CRITICAL", join($delim, @{$arg{CRITICAL}}))
+ if $arg{CRITICAL} && ref $arg{CRITICAL} eq 'ARRAY' && @{$arg{CRITICAL}};
+ &nagios_exit("CRITICAL", $arg{CRITICAL}) if $arg{CRITICAL};
+ }
+
+ elsif ($arg{WARNING} && (ref $arg{WARNING} ne 'ARRAY' || @{$arg{WARNING}})) {
+ &nagios_exit("WARNING", $results) if $results;
+ &nagios_exit("WARNING", join($delim, @{$arg{WARNING}}))
+ if $arg{WARNING} && ref $arg{WARNING} eq 'ARRAY' && @{$arg{WARNING}};
+ &nagios_exit("WARNING", $arg{WARNING}) if $arg{WARNING};
+ }
+
+ &nagios_exit("OK", $results) if $results;
+ &nagios_exit("OK", join($delim, @{$arg{OK}}))
+ if $arg{OK} && ref $arg{OK} eq 'ARRAY' && @{$arg{OK}};
+ &nagios_exit("OK", $arg{OK}) if $arg{OK};
+ &nagios_exit("OK", "All okay");
+}
+
+# ------------------------------------------------------------------------
+
+1;
+
+__END__
+
+=head1 NAME
+
+Nagios::Plugin - Perl module for creating nagios plugins
+
+=head1 SYNOPSIS
+
+ # Nagios::Plugin exports $PLUGIN, $TIMEOUT, and $VERBOSE variables,
+ # and three subroutines by default: parse_args(), nagios_exit(),
+ # and exit_results(). load_config() can also be imported explicitly.
+ use Nagios::Plugin;
+ use Nagios::Plugin qw(:std load_config);
+
+ # parse_args - parse @ARGV for std args and args in @spec
+ parse_args(
+ version => 0.01,
+ usage => 'usage: %s -w <warn> -c <crit>',
+ spec => \@spec,
+ );
+
+ # nagios_exit($code, $msg)
+ # where $code is qw(OK WARNING CRITICAL UNKNOWN DEPENDENT)
+ nagios_exit("CRITICAL", "You're ugly and your mother dresses you funny");
+
+ # exit_results - exit based on the given arrays
+ exit_results(
+ CRITICAL => \@crit,
+ WARNING => \@warn,
+ OK => $ok_message,
+ );
+
+ # load_config - load $section section of plugins.cfg config file
+ # If not set, $section default to plugin name.
+ $config = load_config();
+ $config = load_config($section);
+
+
+=head1 DESCRIPTION
+
+Nagios::Plugin is a perl module for simplifying the creation of
+nagios plugins, mainly by standardising some of the argument parsing
+and handling stuff most plugins require.
+
+Nagios::Plugin exports the following variables:
+
+=over 4
+
+=item $PLUGIN
+
+The name of the plugin i.e. basename($0).
+
+=item $TIMEOUT
+
+The number of seconds before the plugin times out, set via the -t argument.
+
+=item $VERBOSE
+
+The number of -v arguments to the plugin.
+
+=back
+
+Nagios::Plugin also exports three subroutines by default: parse_args(),
+for parsing @ARGV for std and supplied args; nagios_exit(), for returning
+a standard Nagios return status plus a message; and exit_results(), for
+checking a set of message arrays and exiting appropriately. The following
+subroutines can also be imported explicitly: load_config(), for loading
+a set of config settings from the plugins.cfg config file.
+
+=head2 parse_args
+
+The parse_args subroutine provides the core Nagios::Plugin functionality,
+and should be called early in your plugin. It uses a named argument
+syntax, and currently takes three arguments: the version number ('version');
+a short usage message ('usage', newlines okay, %s will be substituted with
+$PLUGIN); and an argument spec for any additional arguments your plugin
+will accept.
+
+Nagios::Plugin provides standard argument handling for the following
+arguments:
+
+=over 4
+
+=item --usage | -?
+
+Print a short usage message for the plugin.
+
+=item --help | -h
+
+Print a longer help message, include the version number, the usage
+message, and help text for the individual arguments.
+
+=item --version | -V
+
+Print the plugin version number and licence information (currently
+hardcoded).
+
+=item --timeout | -t
+
+Number of seconds for plugin timeout (if the plugin implements one);
+default: 15.
+
+=item --verbose | -v
+
+Turn on verbose debug output (may be repeated - the exported $VERBOSE
+variable is set to the number of -v arguments parsed).
+
+=back
+
+To define additional arguments for your plugin, you fill out an
+argument specifier, which is just an arrayref of argument definitions.
+Each definition is basically an extended Getopt::Long definition -
+instead of the two-item tuple $option_defn => $variable used in
+Getopt::Long, Nagios::Plugin uses a three- or four-item tuple which
+also includes help text for argument, and optionally an additional
+mandatoriness flag - the syntax used is:
+
+ $option_defn => [ $variable, $help_text, $required_flag ]
+
+e.g.
+
+ parse_args(
+ version => 0.01,
+ usage => 'usage: %s -w <warn> -c <crit>',
+ spec => [
+ "warning|w=s" => [
+ \$warning,
+ q(-w, --warning=INTEGER\n Exit with WARNING status if less than INTEGER foobars are free),
+ 'REQUIRED',
+ ],
+ "critical|c=s" => [
+ \$critical,
+ q(-c, --critical=INTEGER\n Exit with CRITICAL status if less than INTEGER foobars are free),
+ 'REQUIRED',
+ ],
+ ],
+ );
+
+
+=head2 nagios_exit
+
+Convenience function, to exit with the given nagios status code
+and message:
+
+ nagios_exit(OK => 'query successful');
+ nagios_exit("CRITICAL", "You're ugly and your mother dresses you funny");
+
+Valid status codes are "OK", "WARNING", "CRITICAL", "UNKNOWN".
+
+
+=head2 exit_results
+
+exit_results exits from the plugin after examining a supplied set of
+arrays. Syntax is:
+
+ exit_results(
+ CRITICAL => \@crit,
+ WARNING => \@warn,
+ OK => $ok_message, # or \@ok_messages
+ );
+
+exit_results returns 'CRITICAL' if the @crit array is non-empty;
+'WARNING' if the @warn array is non-empty; and otherwise 'OK'. The
+text returned is typically the joined contents of @crit or @warn or
+@ok_messages (or $ok_message).
+
+Sometimes on error or warning you want to return more than just the
+error cases in the returned text. You can do this by passing a
+'results' parameter containing the string or strings you want to use
+for all status codes e.g.
+
+ # Use the given $results string on CRITICAL, WARNING, and OK
+ exit_results(
+ CRITICAL => \@crit,
+ WARNING => \@warn,
+ results => $results # or \@results
+ );
+
+
+=head2 load_config
+
+Load a hashref of config variables from the given section of the
+plugins.cfg config file. Section defaults to plugin name.
+e.g.
+
+ $config = load_config();
+ $config = load_config('prod_db');
+
+
+
+=head1 CHANGES
+
+Versions prior to 0.03 overrode the standard exit() function instead
+of using a separate nagios_exit. This breaks under ePN with Nagios 2.0,
+so the change to nagios_exit was made. Thanks to Håkon Løvdal for the
+problem report.
+
+The auto-exported $CONFIG variable was removed in 0.04, replaced with
+the load_config function, again due to problems running under ePN.
+
+
+=head1 AUTHOR
+
+Gavin Carr <gavin@openfusion.com.au>
+
+
+=head1 LICENCE
+
+Copyright 2005-2006 Gavin Carr. All Rights Reserved.
+
+This module is free software. It may be used, redistributed
+and/or modified under either the terms of the Perl Artistic
+License (see http://www.perl.com/perl/misc/Artistic.html)
+or the GNU General Public Licence (see
+http://www.fsf.org/licensing/licenses/gpl.txt).
+
+=cut
+
+# arch-tag: 1495e893-2a66-4e61-a8eb-8bfa401b2a4f
+# vim:ft=perl:ai:sw=2
View
263 nrpe/files/default/plugins/check_aacraid.pl
@@ -0,0 +1,263 @@
+#!/usr/bin/perl
+#
+#
+# nrpe-script for monitoring icp or adaptec raid controller
+#
+# -- depends on adaptecs arcconf --
+#
+# initial version: 22 september 2008 by martin probst <maddin(at)megamaddin(dot)de>
+# current status: $Revision: 6 $
+#
+# Copyright Notice: GPL
+#
+# add these lines to /etc/sudoers:
+#
+# nagios ALL = NOPASSWD: /usr/StorMan/arcconf
+#
+#
+
+use strict;
+use warnings;
+use Data::Dumper;
+
+## nagios exit codes
+use constant STATE_OK => 0;
+use constant STATE_WARNING => 1;
+use constant STATE_CRITICAL => 2;
+use constant STATE_UNKNOWN => 3;
+use constant STATE_DEPENDENT => 4;
+
+## if we're dying unexpectely, we'll send status unknown
+$SIG{KILL} = $SIG{TERM} = sub{ exit( STATE_UNKNOWN ); };
+
+## path to executables
+my $arcconf = "/usr/StorMan/arcconf";
+my $sudo = "/usr/bin/sudo";
+
+## change to dir $wd before executing, because arcconf
+## throws logfiles in this directory where it's executed
+my $wd = "/tmp";
+
+## some vars for the devices
+my $ctrl = 0;
+my $logDrives = 0;
+my $phyDrives = 0;
+my %devices;
+
+## the states which are allowed
+my $allowedStates = "Optimal Online Hot Present Normal Charging";
+
+## prints the multi-dimensional-hash for debuging via Data::Dumper if $debug is true
+my $debug = 0;
+
+
+unless( -e $arcconf && -x $sudo)
+{
+ Exit( "arcconf binary or sudo binary not found or not executable!<br>", STATE_UNKNOWN );
+}
+
+chdir( $wd );
+
+$ctrl = getCtrl();
+
+if( $ctrl == 0 )
+{
+ Exit( "no controller found!<br>", STATE_UNKNOWN );
+}
+
+getDev();
+
+print Dumper(%devices) if $debug;
+
+getInfo();
+
+print Dumper(%devices) if $debug;
+
+my ( $text, $state ) = checkStates();
+
+( $text eq '' ) ? Exit( "cant get some informations about the controller/s<br>", STATE_UNKNOWN ) : Exit( $text, $state );
+
+sub checkStates
+{
+ my $text = "";
+ my $status = STATE_UNKNOWN;
+ foreach my $controller( keys( %devices ) )
+ {
+ unless( $allowedStates =~ m/$devices{$controller}{"STATUS"}/ )
+ {
+ $text .= "status of controller $controller is not optimal!<br>";
+ $status = STATE_CRITICAL;
+ }
+ unless( $allowedStates =~ m/$devices{$controller}{"BATTERY"}/ )
+ {
+ $text .= "battery status of controller $controller not optimal!<br>";
+ $status = STATE_WARNING;
+ }
+ unless( $devices{$controller}{"TEMP"} =~ m/Normal/ )
+ {
+ $text .= "temperature of controller $controller not normal: $devices{$controller}{'TEMP'}!<br>";
+ $status = STATE_WARNING;
+ }
+ foreach my $logicDrive( keys( %{$devices{$controller}{"LD"}} ) )
+ {
+ unless( $allowedStates =~ m/$devices{$controller}{"LD"}{$logicDrive}{"STATUS"}/ )
+ {
+ $text .= "status of logical device $logicDrive on controller $controller is not optimal!<br>";
+ $status = STATE_CRITICAL;
+ }
+ unless( $devices{$controller}{"LD"}{$logicDrive}{"FAILED_STRIPES"} eq "No" )
+ {
+ $text .= "there are some failed stripes on logical device $logicDrive on controller $controller!<br>";
+ $status = STATE_WARNING;
+ }
+ foreach my $group( keys( %{$devices{$controller}{"LD"}{$logicDrive}{"GROUP"}} ) )
+ {
+ foreach my $segment( keys( %{$devices{$controller}{"LD"}{$logicDrive}{"GROUP"}{$group}{"SEGMENT"}} ) )
+ {
+ unless( $allowedStates =~ m/$devices{$controller}{"LD"}{$logicDrive}{"GROUP"}{$group}{"SEGMENT"}{$segment}{"PRESENT"}/ )
+ {
+ $text .= "segment $segment on group $group in logical device $logicDrive on controller $controller is not present!<br>";
+ $status = STATE_CRITICAL;
+ }
+ }
+ }
+ }
+ foreach my $physDrive( keys( %{$devices{$controller}{"PD"}} ) )
+ {
+ unless( $allowedStates =~ m/$devices{$controller}{"PD"}{$physDrive}{"STATUS"}/ )
+ {
+ $text .= "physical device $physDrive on controller $controller is not online!<br>";
+ $status = STATE_CRITICAL;
+ }
+ }
+ }
+ if( $text eq '' && $status == STATE_UNKNOWN )
+ {
+ return( "controller status seems fine", STATE_OK )
+ }
+ return( $text, $status );
+
+}
+
+sub getInfo
+{
+ my @dev = ();
+ foreach my $controller( 1..$ctrl )
+ {
+ foreach my $logicDrive( 0..$devices{$controller}{"LDS"} )
+ {
+ @dev = `$sudo $arcconf GETCONFIG $controller LD $logicDrive`;
+ foreach my $singleLogicDrive( @dev )
+ {
+ if( $singleLogicDrive =~ m/RAID\slevel\s+:\s(\d+)\s+/ )
+ {
+ $devices{$controller}{"LD"}{$logicDrive}{"RAID_LEVEL"} = $1;
+ }
+ if( $singleLogicDrive =~ m/Status\sof\slogical\sdevice\s+:\s(\w+)\s+/ )
+ {
+ $devices{$controller}{"LD"}{$logicDrive}{"STATUS"} = $1;
+ }
+ if( $singleLogicDrive =~ m/Failed\sstripes\s+:\s(\w+)\s+/ )
+ {
+ $devices{$controller}{"LD"}{$logicDrive}{"FAILED_STRIPES"} = $1;
+ }
+ if( $singleLogicDrive =~ m/Segment\s(\d+)\s+:\s(\w+).*/ )
+ {
+ if( $singleLogicDrive =~ m/Group\s(\d+),\sSegment\s(\d+)\s+:\s(\w+).*/i )
+ {
+ $devices{$controller}{"LD"}{$logicDrive}{"GROUP"}{$1}{"SEGMENT"}{$2}{"PRESENT"} = $3;
+ }
+ else
+ {
+ $devices{$controller}{"LD"}{$logicDrive}{"GROUP"}{0}{"SEGMENT"}{$1}{"PRESENT"} = $2;
+ }
+ }
+ }
+ }
+
+ @dev = `$sudo $arcconf GETCONFIG $controller PD`;
+ my $num = 0;
+ foreach my $physDrive( @dev )
+ {
+ if( $physDrive =~ m/Device\s#(\d+)\s+/ )
+ {
+ $num = $1;
+ }
+ if( $physDrive =~ m/State\s+:\s(\w+)\s+/ )
+ {
+ $devices{$controller}{"PD"}{$num}{"STATUS"} = $1;
+ }
+
+ }
+
+ @dev = `$sudo $arcconf GETCONFIG $controller AD`;
+ foreach my $ctrlDrive( @dev )
+ {
+ if( $ctrlDrive =~ m/Controller\sStatus\s+:\s(\w+)\s+/ )
+ {
+ $devices{$controller}{'STATUS'} = $1;
+ }
+ if( $ctrlDrive =~ m/Temperature\s+:\s(\d+).*\((\w+)\)/ )
+ {
+ $devices{$controller}{'TEMP'} = "$1C/$2";
+ }
+ if( $ctrlDrive =~ m/Status\s+:\s(\w+)\s+/ )
+ {
+ $devices{$controller}{'BATTERY'} = $1;
+ }
+ }
+ }
+}
+
+sub getDev
+{
+ my @dev = ();
+ foreach my $controller( 1..$ctrl )
+ {
+ $devices{$controller}{"LDS"} = -1;
+ $devices{$controller}{"STATUS"} = "NULL";
+ $devices{$controller}{"TEMP"} = "NULL";
+ $devices{$controller}{"BATTERY"} = "NULL";
+
+ @dev = `$sudo $arcconf GETCONFIG $controller LD`;
+ foreach my $logicDrive( @dev )
+ {
+ if( $logicDrive =~ m/Logical\sdevice\snumber\s(\d+)\s+/ )
+ {
+ $devices{$controller}{"LDS"}++;
+ $devices{$controller}{"LD"}{$1}{"STATUS"} = "NULL";
+ $devices{$controller}{"LD"}{$1}{"FAILED_STRIPES"} = "NULL";
+ $devices{$controller}{"LD"}{$1}{"RAID_LEVEL"} = -1;
+ }
+ }
+
+ @dev = `$sudo $arcconf GETCONFIG $controller PD`;
+ foreach my $physDrive( @dev )
+ {
+ if( $physDrive =~ m/Device\s#(\d+)\s+/ )
+ {
+ $devices{$controller}{"PD"}{$1}{"STATUS"} = "Online";
+ }
+ }
+ }
+}
+
+sub getCtrl
+{
+ my $num = 0;
+ foreach( `$sudo $arcconf GETVERSION` )
+ {
+ $_ =~ m/^Controllers\sfound:\s+(\d)$/;
+ $num = $1;
+ }
+ return( $num );
+}
+
+
+sub Exit
+{
+ my $string = shift;
+ my $state = shift;
+ print $string;
+ exit( $state );
+}
View
128 nrpe/files/default/plugins/check_linux_raid
@@ -0,0 +1,128 @@
+#!/usr/bin/perl -w
+#
+# Plugin to check status of linux mdstat raid partitions
+# Some code taken from check_linux_raid.pl by Steve Milton,
+# Copyright (c) 2002 ISOMEDIA, Inc.
+#
+
+use strict;
+use File::Basename;
+BEGIN {
+ use lib dirname($0);
+ use Nagios::Plugin 0.03;
+}
+
+my $VERSION = '0.2 [http://www.openfusion.com.au/labs/nagios/]';
+
+my $BLURB = qq(This plugin checks the status of linux mdstat raid partitions.);
+my $USAGE = qq(Usage: %s [-e] [-v]\n);
+my $errors_only;
+my @SPEC = (
+ "errors-only|e" => [ \$errors_only,
+ q(-e, --errors-only
+ Display only devices with errors) ],
+);
+
+parse_args(
+ version => $VERSION,
+ usage => $USAGE,
+ spec => \@SPEC,
+ blurb => $BLURB,
+);
+
+# Exit with an error if we're not on Linux
+nagios_exit("UNKNOWN", "$PLUGIN only works on Linux") unless $^O eq 'linux';
+
+open (MDSTAT, "</proc/mdstat") ||
+ nagios_exit("CRITICAL", "Failed to open /proc/mdstat: $!");
+my %md = ();
+my $current = '';
+while (<MDSTAT>) {
+ chomp;
+ if (/^(md\d+)\s*:/) {
+ my $dev = $1;
+ $md{$dev} ||= {};
+ $md{$dev}->{line1} = $_;
+ $md{$dev}->{line1} =~ s/\s+$//;
+ $md{$dev}->{active} = 1 if m/active/;
+ $current = $dev;
+ }
+ elsif (m/^\s*$/) {
+ undef $current;
+ }
+ elsif ($current) {
+ if (/(\[[_U]+\])/) {
+ $md{$current}->{status} = $1;
+ $md{$current}->{line2} = $_;
+ $md{$current}->{line2} =~ s/^\s+//;
+ $md{$current}->{line2} =~ s/\s+$//;
+ }
+ elsif (/recovery\s*=\s*(\S+)/) {
+ $md{$current}->{recovery} = $1;
+ $md{$current}->{line3} = $_;
+ $md{$current}->{line3} =~ s/^\s+//;
+ $md{$current}->{line3} =~ s/\s+$//;
+ $md{$current}->{finish} = $1 if /finish\s*=\s*(\S+)/;
+ }
+ elsif (/resync\s*=\s*(\S+)/) {
+ $md{$current}->{resync} = $1;
+ $md{$current}->{line3} = $_;
+ $md{$current}->{line3} =~ s/^\s+//;
+ $md{$current}->{line3} =~ s/\s+$//;
+ $md{$current}->{finish} = $1 if /finish\s*=\s*(\S+)/;
+ }
+ }
+}
+if ($VERBOSE) {
+ eval { require YAML; print "md data:\n" . YAML::Dump(\%md); }
+}
+
+my @check;
+if (@ARGV) {
+ my @bogus = grep { ! exists $md{$_} } @ARGV;
+ if (@bogus) {
+ nagios_exit("CRITICAL", sprintf("Unknown md device%s: %s",
+ (@bogus > 1 ? 's' : ''),
+ join(' ', @bogus)
+ ));
+ }
+ @check = @ARGV;
+}
+else {
+ @check = sort keys %md;
+}
+nagios_exit("UNKNOWN", "No raid devices found") unless @check;
+
+my (@crit, @warn, @ok);
+for my $dev (@check) {
+ my $status = sprintf("%s%s%s",
+ $md{$dev}->{line1} || '',
+ $md{$dev}->{line2} ? ' ' . $md{$dev}->{line2} : '',
+ $md{$dev}->{line3} ? ' ' . $md{$dev}->{line3} : '',
+ );
+ if ($md{$dev}->{status} && $md{$dev}->{status} =~ m/_/) {
+ if ($md{$dev}->{recovery}) {
+ push @warn, $status;
+ }
+ else {
+ push @crit, $status;
+ }
+ }
+ elsif ($md{$dev}->{status} && $md{$dev}->{status} =~ m/\[U+\]/) {
+ push @ok, $status unless $errors_only;
+ }
+ elsif ($md{$dev}->{active}) {
+ push @ok, $status unless $errors_only;
+ }
+ else {
+ push @crit, $status;
+ }
+}
+
+my $results = join ' :: ', @crit, @warn, @ok;
+$results ||= sprintf "%s raid device%s found, all OK",
+ scalar(keys %md), (scalar(keys %md) == 1 ? '' : 's');
+exit_results(CRITICAL => \@crit, WARNING => \@warn, results => $results);
+
+# arch-tag: 1956e645-1026-4fda-a953-dfea5dbf1ae1
+# vim:ft=perl:ai:sw=4
View
3,025 nrpe/files/default/plugins/check_logfiles
3,025 additions, 0 deletions not shown
View
191 nrpe/files/default/plugins/check_megaraid_sas
@@ -0,0 +1,191 @@
+#!/usr/bin/perl -w
+
+# check_megaraid_sas Nagios plugin
+# Copyright (C) 2007 Jonathan Delgado, delgado@molbio.mgh.harvard.edu
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#
+# Nagios plugin to monitor the status of volumes attached to a LSI Megaraid SAS
+# controller, such as the Dell PERC5/i and PERC5/e. If you have any hotspares
+# attached to the controller, you can specify the number you should expect to
+# find with the '-s' flag.
+#
+# The paths for the Nagios plugins lib and MegaCli may need to me changed.
+#
+# $Author: delgado $
+# $Revision: #3 $ $Date: 2007/06/07 $
+
+use strict;
+use Getopt::Std;
+use lib "/usr/lib/nagios/plugins";
+use utils qw(%ERRORS);
+
+our($opt_h, $opt_s);
+
+
+getopts('hs:');
+
+if ( $opt_h ) {
+ print "usage w/o hotspare: $0\n";
+ print " w/ hotspare: $0 -s <number of hotspares>\n";
+ exit;
+}
+
+my $megacli = 'sudo /usr/sbin/MegaCli64';
+
+
+my ($adapters);
+my $hotspares = 0;
+my $hotsparecount = 0;
+my $pdbad = 0;
+my $pdcount = 0;
+my $pderrors = 0;
+my $result = '';
+my $status = 'OK';
+
+sub max_state ($$) {
+ my ($current, $compare) = @_;
+
+ if (($compare eq 'CRITICAL') || ($compare eq 'CRITICAL')) {
+ return 'CRITICAL';
+ } elsif ($compare eq 'OK') {
+ return $current;
+ } elsif ($compare eq 'WARNING') {
+ return 'WARNING';
+ } elsif (($compare eq 'UNKNOWN') && ($current eq 'OK')) {
+ return 'UNKNOWN';
+ } else {
+ return $current;
+ }
+}
+
+
+if ( $opt_s ) {
+ $hotspares = $opt_s;
+}
+
+# Get the number of RAID controllers we have
+open (ADPCOUNT, "$megacli -adpCount |")
+ || die "error: Could not execute MegaCli -adpCount";
+
+while (<ADPCOUNT>) {
+ if ( m/Controller Count:\s*(\d+)/ ) {
+ $adapters = $1;
+ last;
+ }
+}
+close ADPCOUNT;
+
+ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) {
+ # Get the number of logical drives on this adapter
+ open (LDGETNUM, "$megacli -LdGetNum -a$adp |")
+ || die "error: Could not execute $megacli -LdGetNum -a$adp";
+
+ my ($ldnum);
+ while (<LDGETNUM>) {
+ if ( m/Number of Virtual drives configured on adapter \d:\s*(\d+)/ ) {
+ $ldnum = $1;
+ last;
+ }
+ }
+ close LDGETNUM;
+
+ LDISK: for ( my $ld = 0; $ld < $ldnum; $ld++ ) {
+ # Get info on this particular logical drive
+ open (LDINFO, "$megacli -LdInfo -L$ld -a$adp |")
+ || die "error: Could not execute $megacli -LdInfo -L$ld -a$adp";
+
+ my ($size, $unit, $raidlevel, $ldpdcount, $state);
+ while (<LDINFO>) {
+ if ( m/Size:\s*((\d+)(MB|GB|TB))/ ) {
+ $size = $2;
+ $unit = $3;
+ # Adjust MB to GB if that's what we got
+ if ( $unit eq 'MB' ) {
+ $size = sprintf( "%.0f", ($size / 1024) );
+ $unit= 'GB';
+ }
+ } elsif ( m/State:\s*(\w+)/ ) {
+ $state = $1;
+ if ( $state ne 'Optimal' ) {
+ $status = 'CRITICAL';
+ }
+ } elsif ( m/Number Of Drives:\s*(\d+)/ ) {
+ $ldpdcount = $1;
+ } elsif ( m/RAID Level: Primary-(\d)/ ) {
+ $raidlevel = $1;
+ }
+ }
+ close LDINFO;
+
+ $result .= "$adp:$ld:RAID-$raidlevel:$ldpdcount drives:$size$unit:$state ";
+
+ } #LDISK
+ close LDINFO;
+
+ # Get info on physical disks for this adapter
+ open (PDLIST, "$megacli -PdList -a$adp |")
+ || die "error: Could not execute $megacli -PdList -a$adp";
+
+ my ($slotnumber,$fwstate);
+ PDISKS: while (<PDLIST>) {
+ if ( m/Slot Number:\s*(\d+)/ ) {
+ $slotnumber = $1;
+ $pdcount++ unless ( $slotnumber == 255 );
+ } elsif ( m/Error Count:\s*(\d+)/ ) {
+ $pderrors += $1;
+ } elsif ( m/Predictive Failure Count:\s*(\d+)/ ) {
+ $pderrors += $1;
+ } elsif ( m/Firmware state:\s*(\w+)/ ) {
+ $fwstate = $1;
+ if ( $fwstate eq 'Hotspare' ) {
+ $hotsparecount++;
+ } elsif ( $fwstate eq 'Online' ) {
+ # Do nothing
+ } elsif ( $slotnumber != 255 ) {
+ $pdbad++;
+ $status = 'CRITICAL';
+ }
+ }
+ } #PDISKS
+ close PDLIST;
+}
+
+$result .= "Drives:$pdcount ";
+
+# Any bad disks?
+if ( $pdbad ) {
+ $result .= "$pdbad Bad Drives ";
+}
+
+# Were there any errors?
+if ( $pderrors ) {
+ $result .= "($pderrors Errors) ";
+ $status = max_state($status, 'WARNING');
+}
+
+# Do we have as many hotspares as expected (if any)
+if ( $hotspares ) {
+ if ( $hotsparecount < $hotspares ) {
+ $status = max_state($status, 'WARNING');
+ $result .= "Hotspare(s):$hotsparecount (of $hotspares)";
+ } else {
+ $result .= "Hotspare(s):$hotsparecount";
+ }
+}
+
+print STDOUT "$status: $result\n";
+exit $ERRORS{$status};
View
98 nrpe/files/default/plugins/check_mem.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# evaluate free system memory from Linux based systems
+#
+# Date: 2007-11-12
+# Author: Thomas Borger - ESG
+#
+# the memory check is done with following command line:
+# free -m | grep buffers/cache | awk '{ print $4 }'
+
+# get arguments
+
+while getopts 'w:c:hp' OPT; do
+ case $OPT in
+ w) int_warn=$OPTARG;;
+ c) int_crit=$OPTARG;;
+ h) hlp="yes";;
+ p) perform="yes";;
+ *) unknown="yes";;
+ esac
+done
+
+# usage
+HELP="
+ usage: $0 [ -w value -c value -p -h ]
+
+ syntax:
+
+ -w --> Warning integer value
+ -c --> Critical integer value
+ -p --> print out performance data
+ -h --> print this help screen
+"
+
+if [ "$hlp" = "yes" -o $# -lt 1 ]; then
+ echo "$HELP"
+ exit 0
+fi
+
+# get free memory
+FMEM=`free -m | grep buffers/cache | awk '{ print $4 }'`
+
+# output with or without performance data
+if [ "$perform" = "yes" ]; then
+ OUTPUTP="free system memory: $FMEM MB | free memory="$FMEM"MB;$int_warn;$int_crit;0"
+else
+ OUTPUT="free system memory: $FMEM MB"
+fi
+
+if [ -n "$int_warn" -a -n "$int_crit" ]; then
+
+ err=0
+
+ if (( $FMEM <= $int_warn )); then
+ err=1
+ elif (( $FMEM <= $int_crit )); then
+ err=2
+ fi
+
+ if (( $err == 0 )); then
+
+ if [ "$perform" = "yes" ]; then
+ echo "MEM OK - $OUTPUTP"
+ exit "$err"
+ else
+ echo "MEM OK - $OUTPUT"
+ exit "$err"
+ fi
+
+ elif (( $err == 1 )); then
+ if [ "$perform" = "yes" ]; then
+ echo "MEM WARNING - $OUTPUTP"
+ exit "$err"
+ else
+ echo "MEM WARNING - $OUTOUT"
+ exit "$err"
+ fi
+
+ elif (( $err == 2 )); then
+
+ if [ "$perform" = "yes" ]; then
+ echo "MEM CRITICAL - $OUTPUTP"
+ exit "$err"
+ else
+ echo "MEM CRITICAL - $OUTPUT"
+ exit "$err"
+ fi
+
+ fi
+
+else
+
+ echo "no output from plugin"
+ exit 3
+
+fi
+exit
+
View
100 nrpe/files/default/plugins/check_mpt
@@ -0,0 +1,100 @@
+#! /usr/bin/perl
+# $Id: check_mpt.pl,v 0.1 2006/05/16 15:17:49 Exp $
+
+# check_mpt.pl Copyright (C) 2006 Claudio Messineo <claudio@zero.it>
+#
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# you should have received a copy of the GNU General Public License
+# along with this program (or with Nagios); if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA
+
+use strict;
+use English;
+use Getopt::Long;
+use vars qw($PROGNAME);
+use lib "/usr/lib64/nagios/plugins" ;
+use utils qw (%ERRORS &print_revision &support);
+
+sub print_help ();
+sub print_usage ();
+
+my ($opt_h, $opt_V, $opt_c);
+my ($result, $message, $mpt_path, $num_raid, $enabled );
+
+$PROGNAME="check_mpt";
+$mpt_path="sudo /usr/local/sbin/mpt-status";
+$num_raid=2;
+$enabled=1;
+
+Getopt::Long::Configure('bundling');
+GetOptions(
+ "V" => \$opt_V, "version" => \$opt_V,
+ "h" => \$opt_h, "help" => \$opt_h,
+ "c=n" => \$opt_c, "num_raid=n" => \$opt_c
+ );
+
+if ($opt_V) {
+ print_revision($PROGNAME, '$Id: check_mpt.pl,v 0.1 2006/05/16 15:17:49 Exp $');
+ exit $ERRORS{'OK'};
+}
+
+if ($opt_h) {
+ print_help();
+ exit $ERRORS{'OK'};
+}
+
+sub print_usage () {
+ print "Usage:\n";
+ print " $PROGNAME <-c numraid>\n";
+ print " $PROGNAME [-h | --help]\n";
+ print " $PROGNAME [-V | --version]\n";
+}
+
+sub print_help () {
+ print_revision($PROGNAME, '$Id: check_mpt.pl,v 0.1 2006/05/16 15:17:49 Exp $');
+ print "Copyright (c) 2006 Claudio Messineo claudio\@__no__spam__zero.it (s/__no__spam__//)\n\n";
+ print_usage();
+ print "\n";
+ support();
+}
+
+if($opt_c =~ /^([0-9]+)$/){
+ $num_raid = $1;
+}
+
+
+if ( ! open( MPT_STAT, " $mpt_path | " ) ) {
+ print "ERROR: could not open $mpt_path \n";
+ exit $ERRORS{'UNKNOWN'};
+ }
+else {
+ while (<MPT_STAT>) {
+ if ( $_ =~ m/ENABLED/ ) {
+ $enabled--;
+ }
+ if ( $_ =~ m/ONLINE/ ) {
+ $num_raid--;
+ }
+ next;
+ }
+ if (($num_raid==0) and ($enabled==0)) {
+ print "Mpt-status OK\n";
+ exit $ERRORS{'OK'};
+ }
+ else {
+ print "Mpt-status Alert\n";
+ exit $ERRORS{'WARNING'};
+ }
+}
View
6 nrpe/metadata.rb
@@ -0,0 +1,6 @@
+maintainer "Promet Solutions"
+maintainer_email "marius@promethost.com"
+license "Apache 2.0"
+description "Installs/Configures nrpe"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.1"
View
49 nrpe/recipes/default.rb
@@ -0,0 +1,49 @@
+package "nagios-nrpe-server"
+
+service "nagios-nrpe-server" do
+ action :enable
+ supports :restart => true, :reload => true
+end
+
+template "/etc/nagios/nrpe.cfg" do
+ source "nrpe.cfg.erb"
+ variables(
+ :ip => node["network"]["interfaces"]["#{node[:nrpe][:interface]}"]["addresses"].find {|addr, addr_info| addr_info[:family] == "inet"}.first
+ )
+ notifies :restart, resources(:service => "nagios-nrpe-server")
+end
+
+# This is needed for the check_logfiles plugin
+package "libconfig-tiny-perl"
+
+remote_directory "/etc/nagios/checklogs" do
+ source "checklogs"
+ purge false
+ files_backup 5
+ files_owner "nagios"
+ files_group "nagios"
+ files_mode 00644
+ owner "nagios"
+ group "nagios"
+ mode 00755
+end
+
+directory "/usr/lib/nagios/tmp" do
+ owner "nagios"
+ group "nagios"
+ mode 00755
+ recursive true
+end
+
+# Various custom plugins
+remote_directory node[:nrpe][:plugin_dir] do
+ source "plugins"
+ purge false
+ files_backup 5
+ files_owner "nagios"
+ files_group "nagios"
+ files_mode 00755
+ #owner "nagios"
+ #group "nagios"
+ mode 00755
+end
View
39 nrpe/templates/default/nrpe.cfg.erb
@@ -0,0 +1,39 @@
+pid_file=/var/run/nrpe.pid
+server_port=5666
+server_address=<%= @ip %>
+nrpe_user=nagios
+nrpe_group=adm
+allowed_hosts=<%= node[:nrpe][:allowed_hosts] %>
+dont_blame_nrpe=0
+# command_prefix=/usr/bin/sudo
+debug=0
+command_timeout=60
+connection_timeout=300
+
+# Scan for errors in various logs
+command[apache_error_log]=<%= node['nrpe']['plugin_dir'] %>/check_logfiles -t 90 -f /etc/nagios/checklogs/apache.cfg
+command[system_log]=<%= node['nrpe']['plugin_dir'] %>/check_logfiles -f /etc/nagios/checklogs/base.cfg
+command[lighttpd_log]=<%= node['nrpe']['plugin_dir'] %>/check_logfiles -f /etc/nagios/checklogs/lighttpd.cfg
+command[mail_log]=<%= node['nrpe']['plugin_dir'] %>/check_logfiles -f /etc/nagios/checklogs/mail.cfg
+
+# loadavg, disk space
+command[check_load]=<%= node['nrpe']['plugin_dir'] %>/check_load -w <%= node[:nrpe][:load][:warning] %> -c <%= node[:nrpe][:load][:critical] %>
+command[check_all_disks]=<%= node['nrpe']['plugin_dir'] %>/check_disk -w <%= node[:nrpe][:free_disk][:warning] %>% -c <%= node[:nrpe][:free_disk][:critical] %>% -A -x /dev/shm -X nfs -i /boot
+command[check_zombie_procs]=<%= node['nrpe']['plugin_dir'] %>/check_procs -w 5 -c 10 -s Z
+command[check_total_procs]=<%= node['nrpe']['plugin_dir'] %>/check_procs -w 500 -c 800
+command[check_swap]=<%= node['nrpe']['plugin_dir'] %>/check_swap -w '50%' -c '25%'
+command[check_mem]=<%= node['nrpe']['plugin_dir'] %>/check_mem.sh -w <%= node['nrpe']['free_memory']['warning'] %> -c <%= node['nrpe']['free_memory']['critical'] %> -p
+command[check_chef_client]=<%= node['nrpe']['plugin_dir'] %>/check_procs -w 1:2 -c 1:2 -C chef-client
+command[check_ntp_time]=<%= node['nrpe']['plugin_dir'] %>/check_ntp_time -H 0.pool.ntp.org
+
+<% if node[:roles].include?("db-master") %>
+command[check_mysql]=<%= node['nrpe']['plugin_dir'] %>/check_mysql -u root
+<% end -%>
+<% if node[:roles].include?("db-slave") %>
+command[check_mysql_slave]=<%= node['nrpe']['plugin_dir'] %>/check_mysql -u root -S -w 60 -c 600
+<% end -%>
+
+#RAID
+command[check_raid]=<%= node['nrpe']['plugin_dir'] %>/check_linux_raid
+#HW_RAID
+command[check_hw_raid]=<%= node['nrpe']['plugin_dir'] %>/check_aacraid.pl
Please sign in to comment.
Something went wrong with that request. Please try again.