# HG changeset patch # User Matthias Förste # Date 1540388603 -7200 # Node ID f0871534a7920d52d7c0e649b893a97f2987ddd9 # Parent 818e48975f3cc79b02d0db474281fb3ab10e5d6e moved to git diff -r 818e48975f3c -r f0871534a792 .hgignore --- a/.hgignore Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -syntax: glob -*.swp -*.orig -debian/files -check_drbd - -syntax: regexp -(build|configure)-stamp$ -debian/nagios-plugin-drbd[./] diff -r 818e48975f3c -r f0871534a792 .perltitdy --- a/.perltitdy Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ ---paren-tightness=2 ---square-bracket-tightness=2 diff -r 818e48975f3c -r f0871534a792 Makefile --- a/Makefile Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -SCRIPTS = check_drbd -CLEANFILES = ${SCRIPTS} -DESTDIR = -prefix = /usr - -plugindir = ${prefix}/lib/nagios/plugins/ius - -.PHONY: all clean install - -all: ${SCRIPTS} - -clean: - -rm -f ${CLEANFILES} - -install: all - install -d -m 0755 ${DESTDIR}/${plugindir} - install -m 0755 $(SCRIPTS) ${DESTDIR}/${plugindir}/ - -%: %.pl - @perl -c $< - @cp -f $< $@ - @chmod +x $@ diff -r 818e48975f3c -r f0871534a792 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Wed Oct 24 15:43:23 2018 +0200 @@ -0,0 +1,1 @@ +moved to git diff -r 818e48975f3c -r f0871534a792 check_drbd.pl --- a/check_drbd.pl Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -#! /usr/bin/perl -w - -# Copyright (C) 2011-2014 Christian Arnold -# Copyright (C) 2014-2017 Matthias Förste -# -# 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 3 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, see . -# -# Christian Arnold -# Matthias Förste - -use strict; -use File::Basename; -use Getopt::Long; -use Pod::Usage; - -my %ERRORS = ( - OK => 0, - WARNING => 1, - CRITICAL => 2, - UNKNOWN => 3, - DEPENDENT => 4 -); - -sub check_status($); -sub version($$); - -my $ME = basename $0; -my $NAME = 'DRBD'; -my $VERSION = "2.0"; - -my %opt = ( file => "/proc/drbd" ); - -MAIN: { - Getopt::Long::Configure('bundling'); - GetOptions( - "f|file=s" => \$opt{file}, - "h|help" => sub { pod2usage( -verbose => 1, -exitval => $ERRORS{OK} ) }, - "m|man" => sub { pod2usage( -verbose => 2, -exitval => $ERRORS{OK} ) }, - "V|version" => sub { version( $ME, $VERSION ); exit $ERRORS{OK}; } - ) or pod2usage( -verbose => 1, -exitval => $ERRORS{CRITICAL} ); - - check_status( $opt{file} ); -} - -sub check_status($) { - my $file = shift; - my ( %drbd, @warning, @critical, @ok ) = (); - - unless ( -r $file ) { - print "$NAME CRITICAL: $file $!\n"; - exit $ERRORS{CRITICAL}; - } - - open( FH, $file ) - or print "$NAME CRITICAL: $file $!\n" and exit $ERRORS{CRITICAL}; - my $r; - while () { - chomp; - if (/^\s*(?(?\d+):\s+cs:(?\S+)\s+(?:st|ro):(?\S+)\s+(?:ds|ld):(?\S+))/) { - $r = $+{resource}; - $drbd{$r} = { - line => $+{line}, - connection_state => $+{connection_state}, - roles => $+{roles}, - disk_states => $+{disk_states} - }; - } elsif (defined $r and /oos:(?\d+)/) { - $drbd{$r}->{out_of_sync} = $+{out_of_sync}; - $drbd{$r}->{line} .= " oos: $+{out_of_sync}"; - } - } - close(FH); - - unless (%drbd) { - print "$NAME CRITICAL: $file found, but no entries\n"; - exit $ERRORS{CRITICAL}; - } - - foreach my $dev ( map { $drbd{$_} } sort keys %drbd ) { - $dev->{state} = "CRITICAL", next - if ( $dev->{roles} ne "Primary/Secondary" ) - and ( $dev->{roles} ne "Secondary/Primary" ); - - $dev->{state} = "CRITICAL", next - if ( $dev->{disk_states} ne "UpToDate/UpToDate" ) - and ( $dev->{disk_states} ne "Consistent" ); - - $dev->{state} = "CRITICAL", next - if ( $dev->{out_of_sync} != 0 ); - - $dev->{state} = "WARNING", next - if $dev->{connection_state} ne "Connected"; - - $dev->{state} = "OK"; - } - - foreach my $dev ( map { $drbd{$_} } sort keys %drbd ) { - $dev->{state} eq "WARNING" and push( @warning, $dev->{line} ), next; - $dev->{state} eq "CRITICAL" and push( @critical, $dev->{line} ), next; - $dev->{state} eq "OK" and push( @ok, $dev->{line} ), next; - } - - print("$NAME CRITICAL: @critical\n"), exit $ERRORS{CRITICAL} if @critical; - print("$NAME WARNING: @warning\n"), exit $ERRORS{WARNING} if @warning; - print("$NAME OK: @ok\n"), exit $ERRORS{OK}; -} - -sub version($$) { - my $progname = shift; - my $version = shift; - - print <<_VERSION; -$progname version $version -Copyright (C) 2011-2014 by Christian Arnold and Schlittermann internet & unix support. -Copyright (C) 2014-2017 by Matthias Förste and Schlittermann internet & unix support. - -$ME comes with ABSOLUTELY NO WARRANTY. This is free software, -and you are welcome to redistribute it under certain conditions. -See the GNU General Public Licence for details. -_VERSION -} - -__END__ - -=head1 NAME - -check_drbd - nagios plugin to check drbd status - -=head1 SYNOPSIS - -check_drbd [-f|--file path] - [-h|--help] - [-m|--man] - [-V|--version] - -=head1 OPTIONS - -=over - -=item B<-f>|B<--file> I - -Absolute path of drbd status file. (default: /proc/drbd) - -=item B<-h>|B<--help> - -Print detailed help screen. - -=item B<-m>|B<--man> - -Print manual page. - -=item B<-V>|B<--version> - -Print version information. - -=back - -=head1 DESCRIPTION - -This plugin check drbd status. - -=head1 VERSION - -This man page is current for version 2.0 of check_drbd. - -=head1 AUTHOR - -Written by Christian Arnold L. Currently maintained by Matthias Förste L - -=head1 COPYRIGHT - -Copyright (C) 2011-2014 by Christian Arnold and Schlittermann internet & unix support. -Copyright (C) 2014-2017 by Matthias Förste and Schlittermann internet & unix support. -This is free software, and you are welcome to redistribute it under certain conditions. -See the GNU General Public Licence for details. - -=cut diff -r 818e48975f3c -r f0871534a792 debian/changelog --- a/debian/changelog Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -nagios-plugin-drbd (2.1) oldstable stable; urgency=medium - - * fixed match for resource numbers with more than one digit - * maintainer/copyright updates - * fixed debian package policy violations - - -- Matthias Förste Mon, 09 Jan 2017 12:23:57 +0100 - -nagios-plugin-drbd (2.0+nmu1) oldstable stable; urgency=low - - * Non-maintainer upload. - * Consider out of sync blocks critical - - -- Matthias Förste Fri, 08 Aug 2014 13:35:18 +0200 - -nagios-plugin-drbd (2.0) etch lenny squeeze; urgency=low - - * Initial Release. - - -- Christian Arnold Thu, 25 Aug 2011 16:30:59 +0200 diff -r 818e48975f3c -r f0871534a792 debian/compat --- a/debian/compat Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -7 diff -r 818e48975f3c -r f0871534a792 debian/control --- a/debian/control Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -Source: nagios-plugin-drbd -Section: net -Priority: extra -Maintainer: Matthias Förste -Build-Depends: debhelper (>= 7.0.50~) -Standards-Version: 3.9.6 -Homepage: https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-drbd/ - -Package: nagios-plugin-drbd -Architecture: all -Depends: ${misc:Depends}, perl-base (>= 5.8.8), perl-doc -Description: nagios plugin to check drbd status - This plugin check drbd status. diff -r 818e48975f3c -r f0871534a792 debian/copyright --- a/debian/copyright Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -This work was packaged for Debian by: - - Christian Arnold on Thu, 25 Aug 2011 16:30:59 +0200 - -It was downloaded from: - - https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-drbd/ - -Upstream Author: - - Christian Arnold - -Copyright: - - Copyright (C) 2011-2014 Christian Arnold and Schlittermann internet & unix support - Copyright (C) 2014-2017 Matthias Förste and Schlittermann internet & unix support - -License: - - 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 3 of the License, or - (at your option) any later version. - - This package 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, see . - -On Debian systems, the complete text of the GNU General -Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". - -The Debian packaging is: - - Copyright (C) 2011-2014 Christian Arnold - Copyright (C) 2014-2017 Matthias Förste - -and is licensed under the GPL version 3, see above. diff -r 818e48975f3c -r f0871534a792 debian/docs diff -r 818e48975f3c -r f0871534a792 debian/rules --- a/debian/rules Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ diff -r 818e48975f3c -r f0871534a792 debian/source/format --- a/debian/source/format Mon Jan 09 15:33:15 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -3.0 (native)