summaryrefslogtreecommitdiffstats
path: root/contrib/check_sybase
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/check_sybase')
-rwxr-xr-xcontrib/check_sybase15
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/check_sybase b/contrib/check_sybase
index 20b4a303..1f1cbf88 100755
--- a/contrib/check_sybase
+++ b/contrib/check_sybase
@@ -13,12 +13,14 @@
13# Revision history: 13# Revision history:
14# 0.1 01-OCT-2004 Initial version. 14# 0.1 01-OCT-2004 Initial version.
15# 0.2 08-NOV-2004 Initial release. 15# 0.2 08-NOV-2004 Initial release.
16my $VERSION = "0.2"; 16# 0.3 13-JAN-2004 Fixed lib path, improved timeouts.
17# 0.4 26-JAN-2004 Added loginTimeout.
18my $VERSION = "0.4";
17 19
18use strict; 20use strict;
19use DBI; 21use DBI;
20use Getopt::Long; 22use Getopt::Long;
21use lib "/usr/local/nagios/libexec"; 23use lib qw( /usr/lib/nagios/plugins/ /usr/local/nagios/libexec/ );
22use utils qw(%ERRORS &print_revision &support &usage $TIMEOUT); 24use utils qw(%ERRORS &print_revision &support &usage $TIMEOUT);
23 25
24 26
@@ -26,6 +28,7 @@ my $PROGNAME = "check_sybase";
26my $DEFAULT_CHECKTYPE = "FREESPACE"; 28my $DEFAULT_CHECKTYPE = "FREESPACE";
27my $DEFAULT_WARNING = "25"; 29my $DEFAULT_WARNING = "25";
28my $DEFAULT_CRITICAL = "10"; 30my $DEFAULT_CRITICAL = "10";
31my $DEFAULT_TIMEOUT = "30";
29 32
30my ($user, $pass, $dbsvr, $dbname, $config, $checktype, $warn, $crit, $timeout, 33my ($user, $pass, $dbsvr, $dbname, $config, $checktype, $warn, $crit, $timeout,
31 $help, $version); 34 $help, $version);
@@ -55,7 +58,7 @@ if (! $options_okay) # Bad option passed
55$warn = $warn || $DEFAULT_WARNING; 58$warn = $warn || $DEFAULT_WARNING;
56$crit = $crit || $DEFAULT_CRITICAL; 59$crit = $crit || $DEFAULT_CRITICAL;
57$checktype = $checktype || $DEFAULT_CHECKTYPE; 60$checktype = $checktype || $DEFAULT_CHECKTYPE;
58$timeout = $timeout || $TIMEOUT; 61$timeout = $timeout || $TIMEOUT || $DEFAULT_TIMEOUT;
59 62
60if ($help) 63if ($help)
61{ 64{
@@ -105,8 +108,8 @@ my $dbh;
105my $is_connected; 108my $is_connected;
106sub connect 109sub connect
107{ 110{
108 $dbh = DBI->connect("dbi:Sybase:server=$dbsvr;database=$dbname", 111 $dbh = DBI->connect("dbi:Sybase:server=$dbsvr;database=$dbname;".
109 $user, $pass) 112 "timeout=$timeout,loginTimeout=$timeout", $user, $pass)
110 or &ncrit("Could not connect to '$dbname' on '$dbsvr'"); 113 or &ncrit("Could not connect to '$dbname' on '$dbsvr'");
111 114
112 # Report success for a check of type CONNECT 115 # Report success for a check of type CONNECT
@@ -262,7 +265,7 @@ Mandatory arguments to long options are mandatory for short options too.
262 -c, --critical Critical threshold, in percent (default 10) 265 -c, --critical Critical threshold, in percent (default 10)
263 -t, --timeout Timeout value, in seconds (default 30) 266 -t, --timeout Timeout value, in seconds (default 30)
264 -h, --help This help message 267 -h, --help This help message
265 -V, --version Version information 268 -V, --version Version information ($VERSION)
266 269
267Examples: 270Examples:
268 $PROGNAME -U sa -P secret -S bigbox -D orders 271 $PROGNAME -U sa -P secret -S bigbox -D orders