diff options
author | root <root@kremium> | 2011-11-18 10:10:13 +0100 |
---|---|---|
committer | root <root@kremium> | 2011-11-18 10:10:13 +0100 |
commit | bfa204a580a503a216cedbedd36586fb00458181 (patch) | |
tree | 4d277410a2ed9d497669d597b05826fc4e6a3814 /Monitoring/plugins | |
parent | cda7ac879c8791d7b59f9b726136efa274a12e4b (diff) |
//Monitoring: add shinken configs
Diffstat (limited to 'Monitoring/plugins')
87 files changed, 5817 insertions, 0 deletions
diff --git a/Monitoring/plugins/check.bat b/Monitoring/plugins/check.bat new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/Monitoring/plugins/check.bat diff --git a/Monitoring/plugins/check.sh b/Monitoring/plugins/check.sh new file mode 100755 index 00000000..9e62fbee --- /dev/null +++ b/Monitoring/plugins/check.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "When in doubt... blow it up. | cpu=100%" +#sleep 1.5 +exit 0 diff --git a/Monitoring/plugins/check_apt b/Monitoring/plugins/check_apt Binary files differnew file mode 100755 index 00000000..2371c32d --- /dev/null +++ b/Monitoring/plugins/check_apt diff --git a/Monitoring/plugins/check_bgpstate b/Monitoring/plugins/check_bgpstate new file mode 100755 index 00000000..645d7505 --- /dev/null +++ b/Monitoring/plugins/check_bgpstate @@ -0,0 +1,215 @@ +#!/usr/bin/perl -w +# +# check_bgpstate.pl - nagios plugin +# +# Copyright (C) 2000 Christoph Kron +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# +# Report bugs to: ck@zet.net +# +# 11.01.2000 Version 1.0 + + + +use strict; + +use Net::SNMP; +use Getopt::Long; +&Getopt::Long::config('auto_abbrev'); + + +# whois programm for RIPE database queries +my $whois = '/usr/bin/whois'; +my $status; +my $TIMEOUT = 30; + +# critical bgp sessions +my %uplinks = ( 1273, 'Uplink ECRC', + 1755, 'Uplink EBONE', + 3300, 'Uplink AUCS' + ); + +my %ERRORS = ('UNKNOWN' , '-1', + 'OK' , '0', + 'WARNING', '1', + 'CRITICAL', '2'); + + +my %bgpPeerState = ( + '1',"idle", + '2',"connect", + '3',"active", + '4',"opensent", + '5',"openconfirm", + '6',"established" + ); +my $state = "UNKNOWN"; +my $answer = ""; +my $snmpkey; +my $snmpoid; +my $key; +my $community = "public"; +my $port = 161; +my @snmpoids; +my $snmpbgpPeerState = '1.3.6.1.2.1.15.3.1.2'; +my $snmpbgpPeerLocalAddr = '1.3.6.1.2.1.15.3.1.5'; +my $snmpbgpPeerRemoteAddr = '1.3.6.1.2.1.15.3.1.7'; +my $snmpbgpPeerRemoteAs = '1.3.6.1.2.1.15.3.1.9'; +my $hostname; +my $session; +my $error; +my $response; +my %bgpStatus; +my $bgpestablished =0 ; +my $bgpcritical =0; +my $bgpdown =0; +my $bgpidle =0; +my $bgpmessage; +my $asname; +my $remoteas; +my @output; + +sub usage { + printf "\nMissing arguments!\n"; + printf "\n"; + printf "Perl bgpstate plugin for Nagios\n"; + printf "monitors all BGP sessions\n"; + printf "usage: \n"; + printf "check_bgpstate.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>\n"; + printf "Copyright (C) 2000 Christoph Kron\n"; + printf "check_bgpstate.pl comes with ABSOLUTELY NO WARRANTY\n"; + printf "This programm is licensed under the terms of the "; + printf "GNU General Public License\n(check source code for details)\n"; + printf "\n\n"; + exit $ERRORS{"UNKNOWN"}; +} + +# Just in case of problems, let's not hang Nagios +$SIG{'ALRM'} = sub { + print ("ERROR: No snmp response from $hostname (alarm)\n"); + exit $ERRORS{"UNKNOWN"}; +}; +alarm($TIMEOUT); + + +$status = GetOptions("community=s",\$community, + "port=i",\$port); +if ($status == 0) +{ + &usage; +} + + #shift; + $hostname = shift || &usage; + + +push(@snmpoids, $snmpbgpPeerState); +push(@snmpoids, $snmpbgpPeerLocalAddr); +push(@snmpoids, $snmpbgpPeerRemoteAddr); +push(@snmpoids, $snmpbgpPeerRemoteAs); + +foreach $snmpoid (@snmpoids) { + + ($session, $error) = Net::SNMP->session( + -hostname => $hostname, + -community => $community, + -port => $port + ); + + if (!defined($session)) { + $state='UNKNOWN'; + $answer=$error; + print ("$state: $answer"); + exit $ERRORS{$state}; + } + + if (!defined($response = $session->get_table($snmpoid))) { + $answer=$session->error; + $session->close; + $state = 'CRITICAL'; + print ("$state: $answer,$snmpkey"); + exit $ERRORS{$state}; + } + + foreach $snmpkey (keys %{$response}) { + $snmpkey =~ m/.*\.(\d+\.\d+\.\d+\.\d+$)/; + $key = $1; +# printf "debug: $snmpkey: $key -> $response->{$snmpkey}\n"; + $bgpStatus{$key}{$snmpoid} = $response->{$snmpkey}; + } + $session->close; +} + +foreach $key (keys %bgpStatus) { + if ($bgpStatus{$key}{$snmpbgpPeerState} == 6 ) { + $bgpestablished++; + } + elsif ($bgpStatus{$key}{$snmpbgpPeerState} == 1 ) { + $bgpidle++; + } + else { + $bgpdown++ ; + if (exists($uplinks{$bgpStatus{$key}{$snmpbgpPeerRemoteAs}}) ) { + $bgpcritical++; + } + @output = `$whois -T aut-num AS$bgpStatus{$key}{$snmpbgpPeerRemoteAs}`; + + $asname = ""; + foreach (@output) { + if (m/as-name/) { + $asname = $_; + $asname =~ s/as-name://; + last; + } + if ( $asname =~ "" && m/descr/ ) { + $asname = $_; + $asname =~ s/descr://; + } + } + $asname =~ s/^\s*//; + $asname =~ s/\s*$//; + $bgpmessage .= sprintf("Peering with AS%s not established -> %s<BR>", + $bgpStatus{$key}{$snmpbgpPeerRemoteAs}, + $asname); + } +} + + + if ($bgpdown > 0) { + if ($bgpcritical > 0) { + $state = 'CRITICAL'; + } + else { + $state = 'WARNING'; + } + $answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d<BR>", + $hostname, + $bgpestablished, + $bgpdown, $bgpidle); + $answer = $answer . $bgpmessage . "\n"; + } + else { + $state = 'OK'; + $answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d\n", + $hostname, + $bgpestablished, + $bgpdown,$bgpidle); + } + +print ("$state: $answer"); +exit $ERRORS{$state}; + diff --git a/Monitoring/plugins/check_breeze b/Monitoring/plugins/check_breeze new file mode 100755 index 00000000..d0382e69 --- /dev/null +++ b/Monitoring/plugins/check_breeze @@ -0,0 +1,87 @@ +#! /usr/bin/perl -wT + + +use strict; +use Getopt::Long; +use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME); +use lib "/usr/lib/nagios/plugins" ; +use utils qw(%ERRORS &print_revision &support &usage); + +$PROGNAME = "check_breeze"; + +sub print_help (); +sub print_usage (); + +$ENV{'PATH'}=''; +$ENV{'BASH_ENV'}=''; +$ENV{'ENV'}=''; + +Getopt::Long::Configure('bundling'); +GetOptions + ("V" => \$opt_V, "version" => \$opt_V, + "h" => \$opt_h, "help" => \$opt_h, + "w=s" => \$opt_w, "warning=s" => \$opt_w, + "c=s" => \$opt_c, "critical=s" => \$opt_c, + "H=s" => \$opt_H, "hostname=s" => \$opt_H, + "C=s" => \$opt_C, "community=s" => \$opt_C); + +if ($opt_V) { + print_revision($PROGNAME,'1.4.15'); + exit $ERRORS{'OK'}; +} + +if ($opt_h) {print_help(); exit $ERRORS{'OK'};} + +($opt_H) || usage("Host name/address not specified\n"); +my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); +($host) || usage("Invalid host: $opt_H\n"); + +($opt_w) || usage("Warning threshold not specified\n"); +my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/); +($warning) || usage("Invalid warning threshold: $opt_w\n"); + +($opt_c) || usage("Critical threshold not specified\n"); +my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); +($critical) || usage("Invalid critical threshold: $opt_c\n"); + +($opt_C) || ($opt_C = "public") ; + +my $sig=0; +$sig = `snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`; +my @test=split(/ /,$sig); +$sig=$test[2]; +$sig=int($sig); +if ($sig>100){$sig=100} + +print "Signal Strength at: $sig%\n"; + +exit $ERRORS{'CRITICAL'} if ($sig<$critical); +exit $ERRORS{'WARNING'} if ($sig<$warning); +exit $ERRORS{'OK'}; + + +sub print_usage () { + print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n"; +} + +sub print_help () { + print_revision($PROGNAME,'1.4.15'); + print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop + +This plugin reports the signal strength of a Breezecom wireless equipment + +"; + print_usage(); + print " +-H, --hostname=HOST + Name or IP address of host to check +-C, --community=community + SNMPv1 community (default public) +-w, --warning=INTEGER + Percentage strength below which a WARNING status will result +-c, --critical=INTEGER + Percentage strength below which a CRITICAL status will result + +"; + support(); +} diff --git a/Monitoring/plugins/check_by_ssh b/Monitoring/plugins/check_by_ssh Binary files differnew file mode 100755 index 00000000..5f969058 --- /dev/null +++ b/Monitoring/plugins/check_by_ssh diff --git a/Monitoring/plugins/check_clamd b/Monitoring/plugins/check_clamd new file mode 120000 index 00000000..e838da97 --- /dev/null +++ b/Monitoring/plugins/check_clamd @@ -0,0 +1 @@ +check_tcp
\ No newline at end of file diff --git a/Monitoring/plugins/check_cluster b/Monitoring/plugins/check_cluster Binary files differnew file mode 100755 index 00000000..8d6dbb90 --- /dev/null +++ b/Monitoring/plugins/check_cluster diff --git a/Monitoring/plugins/check_cpu b/Monitoring/plugins/check_cpu new file mode 100755 index 00000000..26a93da5 --- /dev/null +++ b/Monitoring/plugins/check_cpu @@ -0,0 +1,165 @@ +#!/usr/bin/python + +import string, os, sys, re +#from optik import OptionParser +from optparse import OptionParser + + + +####################################### +### Define a set of strings to handle +### any info output requirements. + + +check_cpu_version = "check_cpu (nagios-plugins 1.5.1!?) 0.4.0a\n" + +intro = "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\nCopyright (c) 2004 Ethan Galstad/Karl DeBisschop\n\n" + +preamble = "This plugin will check the percent of idle CPU usage on the system it is\nexecuted on and generate an alert if the percentage is below\none of the threshold values.\n\n" + +use = "Usage:\tcheck_cpu -w limit -c limit [-t timeout]\n\tcheck_cpu (-h|--help)\n\tcheck_cpu (-V|--version)\n" + +options = "\n -w, --warning=PERCENT\n\tExit with WARNING status if idle CPU percentage is less than PERCENT\n -c, --critical=PERCENT\n\tExit with CRITICAL status if idle CPU percentage is less than PERCENT\n -t, --timeout=INTEGER\n\tSeconds before check attempt times out (default: 10)\n -s, --sample=INTEGER\n\tSeconds to use as sample time. (default: 5)\n -h, --help\n\tPrint detailed help screen\n -V, --version\n\tPrint version information\n\n" + +bugs = "Bugs:\tTimeout does not do what has been documented here. Rather, it does \nnothing. The plugin seems to ignore characters that are not attached to \nparameter syntax. This has been tested on RedHat 8.0+, Fedora Core 1 & 2, \nOpenBSD 3.x and Debian. I would appreciate feedback and/or patches if it doesn't\nfunction under your chosen operating system.\n\n" + +query = "Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding the use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\n\nFor questions and suggestions pertaining to the check_cpu plugin,\nplease send email to nemir@hotmail.com.\n" + +fullHelp = check_cpu_version + intro + preamble + use + options + bugs + query + + + + + +def helpFunc(option, opt, value, parser): + print fullHelp + sys.exit(3) + +def verFunc(option, opt, value, parser): + print check_cpu_version + sys.exit(3) + + + + +####################################### +### Parse all the parameters. Define +### variables for later use. + + + +parser = OptionParser(add_help_option=0) + +parser.add_option("-h", "--help", action="callback", callback=helpFunc) +parser.add_option("-V", "--version", action="callback", callback=verFunc) +parser.add_option("-w", "--warning", action="store", type="int", dest="warn", default=-1) +parser.add_option("-c", "--critical", action="store", type="int", dest="crit", default=-2) +parser.add_option("-s", "--sample", action="store", type="int", dest="sample", default=5) +parser.add_option("-t", "--timeout", action="store", type="int", dest="timeout", default=10) + +(options, args) = parser.parse_args() + +critical = options.crit +warning = options.warn +sample = options.sample +timeout = options.timeout + + +if -3 > critical or 101 < critical: + print "Critical value is a percentage and must be between 0 and 100.\n" + use + sys.exit(3) + +if -2 > warning or 101 < warning: + print "Warning value is a percentage and must be between 0 and 100.\n" + use + sys.exit(3) + +if critical >= warning: + print "Critical value must be less than the warning value.\n" + use + sys.exit(3) + +if sample >= timeout -1: + print "Sample time must be 2 seconds less than timeout.\n" + use + sys.exit(3) + +strSample = str(sample) + + +####################################### +### Determine what OS we are being run +### on, to figure syntax required. + + +v = os.popen("uname", "r") +l = v.read() + +if l == "Linux\n": + vmcmd = "/usr/bin/vmstat " + strSample + " 2" +elif l == "OpenBSD\n": + vmcmd = "/usr/bin/vmstat -c 2 -w " + strSample +elif l == "FreeBSD\n": + vmcmd = "/usr/bin/vmstat -c 2 -w " + strSample +elif l == "NetBSD\n": + vmcmd = "/usr/bin/vmstat -c 2 -w " + strSample +elif l == "SunOS\n": + vmcmd = "/usr/bin/vmstat " + strSample + " 2" +else: + print "Unknown operating system, unable to continue.\n" + sys.exit(3) + + +####################################### +### Grab the CPU sample and convert the +### the relevent info to an int. + + +vmstat = os.popen( vmcmd, "r" ) +statOut = vmstat.read() + + +statLines = string.split( statOut, '\n') +lastLine = statLines[-2].strip() + +n = len(statLines) +for i in range(0, n): + idcheck = re.search("id", statLines[i]) + if idcheck: + idLine = statLines[i].strip() + + + +idStr = re.sub( "[ \t\n\r\v]+", " ", idLine ) +idList = string.split(idStr, " ") +idColumn = idList.index("id") + +valueStr = re.sub( "[ \t\n\r\v]+", " ", lastLine ) +values = string.split( valueStr, ' ') + +idleCPU = values[idColumn] +sysCPU = values[-2] +userCPU = values[-3] + +idleValue = string.atoi(idleCPU) + + +####################################### +### Finally, determine and report CPU +### state, and exit the plugin. + + +if idleValue <= critical: + status = "CPU CRITICAL" + print status + ": CPU is only " + idleCPU + "% idle" + sys.exit(2) +elif idleValue <= warning: + status = "WARNING" + print status + ": CPU is only " + idleCPU + "% idle" + sys.exit(1) +elif warning < idleValue: + status = "OK" + print status + ": CPU is " + idleCPU + "% idle" + sys.exit(0) +else: + status = "CPU STATUS UNKNOWN" + print status + ": Could not complete check." + sys.exit(3) + diff --git a/Monitoring/plugins/check_dhcp b/Monitoring/plugins/check_dhcp Binary files differnew file mode 100755 index 00000000..6b51224f --- /dev/null +++ b/Monitoring/plugins/check_dhcp diff --git a/Monitoring/plugins/check_dig b/Monitoring/plugins/check_dig Binary files differnew file mode 100755 index 00000000..650608dc --- /dev/null +++ b/Monitoring/plugins/check_dig diff --git a/Moni |