Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
chris
puppet-backupninja
Commits
a52fa9dc
Commit
a52fa9dc
authored
Nov 12, 2010
by
Antoine Beaupre
Committed by
Antoine Beaupré
Apr 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an option to directly pipe results to nagios to avoid timeouts
parent
2105d828
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
files/checkbackups.pl
files/checkbackups.pl
+13
-3
No files found.
files/checkbackups.pl
View file @
a52fa9dc
...
@@ -44,10 +44,11 @@ our $opt_c = 48 * 60 * 60;
...
@@ -44,10 +44,11 @@ our $opt_c = 48 * 60 * 60;
our
$opt_w
=
24
*
60
*
60
;
our
$opt_w
=
24
*
60
*
60
;
our
$opt_v
=
0
;
our
$opt_v
=
0
;
our
$opt_o
;
our
$opt_o
;
our
$opt_s
;
if
(
!
getopts
('
d:c:w:vo
'))
{
if
(
!
getopts
('
d:c:w:
s:
vo
'))
{
print
<<EOF
print
<<EOF
Usage: $0 [ -d <backupdir> ] [ -c <threshold> ] [ -w <threshold> ] [ -o ] [ -v ]
Usage: $0 [ -d <backupdir> ] [ -c <threshold> ] [ -w <threshold> ] [ -o ] [
-s <host> ] [
-v ]
EOF
EOF
;
;
exit
();
exit
();
...
@@ -122,7 +123,16 @@ sub print_status {
...
@@ -122,7 +123,16 @@ sub print_status {
if
(
!
$service
)
{
if
(
!
$service
)
{
$service
=
'
backups
';
$service
=
'
backups
';
}
}
printf
"
$host
\t
$service
\t
$state
\t
$state_msg
$message
\n
";
$line
=
"
$host
\t
$service
\t
$state
\t
$state_msg
$message
\n
";
if
(
$opt_s
)
{
$opt_v
&&
print
STDERR
"
sending results to nagios...
\n
";
open
(
NSCA
,
"
|/usr/sbin/send_nsca -H
$opt_s
")
or
die
("
cannot start send_nsca: $!
\n
");
print
NSCA
$line
;
close
(
NSCA
)
or
warn
("
could not close send_nsca pipe correctly: $!
\n
");
}
if
(
!
$opt_s
||
$opt_v
)
{
printf
$line
;
}
}
}
sub
check_flag
{
sub
check_flag
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment