1 #!/usr/bin/perl |
|
2 |
|
3 # Copyright (C) 2015 Matthias Förste |
|
4 # |
|
5 # This program is free software: you can redistribute it and/or modify |
|
6 # it under the terms of the GNU General Public License as published by |
|
7 # the Free Software Foundation, either version 3 of the License, or |
|
8 # (at your option) any later version. |
|
9 # |
|
10 # This program is distributed in the hope that it will be useful, |
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 # GNU General Public License for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 # |
|
18 # Matthias Förste <foerste@schlittermann.de> |
|
19 |
|
20 =encoding utf8 |
|
21 =cut |
|
22 |
|
23 use strict; |
|
24 use warnings; |
|
25 |
|
26 #use Getopt::Long; |
|
27 use Pod::Usage; |
|
28 |
|
29 use Nagios::Plugin; |
|
30 |
|
31 package Nagios::Plugin::IUS::Cert |
|
32 $VERSION = 2.0; |
|
33 |
|
34 my $np = Nagios::Plugin->new( |
|
35 usage => pod2usage ( -verbose => 0, -exitval => 0) |
|
36 ); |
|
37 |
|
38 GetOptions( |
|
39 "h|help" => sub { pod2usage( -verbose => 0, -exitval => 0 ) }, |
|
40 "m|man" => sub { |
|
41 pod2usage( |
|
42 -verbose => 2, |
|
43 -exitval => 0, |
|
44 -noperldoc => ( `perldoc -V 2>/dev/null`, $? != 0 )[-1] |
|
45 ); |
|
46 }, |
|
47 ) or pod2usage(); |
|
48 |
|
49 __END__ |
|
50 |
|
51 =pod |
|
52 |
|
53 =head1 NAME |
|
54 |
|
55 check_cert - check ssl certificate expiry |
|
56 |
|
57 =head1 SYNOPSIS |
|
58 |
|
59 check_cert [options] [directories] |
|
60 |
|
61 check_cert -m|--man |
|
62 -h|--help |
|
63 |
|
64 =head1 DESCRIPTION |
|
65 |
|
66 This script checks the expiry of openssl certificates. |
|
67 |
|
68 =head1 OPTIONS |
|
69 |
|
70 =over |
|
71 |
|
72 =item B<-b|--binary> I<path> |
|
73 |
|
74 Path to the openssl binary (default: /usr/bin/openssl) |
|
75 |
|
76 =item B<-w|--warning> I<time> |
|
77 |
|
78 Return status I<warning> if certificate expires in less than <time>. |
|
79 |
|
80 =item B<-w|--critical> I<time> |
|
81 |
|
82 Return status I<critical> if certificate expires in less than <time>. |
|
83 |
|
84 =back |
|
85 |
|
86 =head1 NOTES |
|
87 |
|
88 Time Ranges may be given as <number><suffix>, where <suffix> can be one of s, m, h or d for seconds, minutes, hours or days (default). |
|
89 |
|
90 =head1 FILES |
|
91 |
|
92 List or describe any files which may be used by 'check_cert' here. |
|
93 |
|
94 =head1 AUTHOR |
|
95 |
|
96 Matthias Förste <foerste@schlittermann.de> |
|
97 |
|
98 =cut |
|