diff options
author | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2005-01-28 22:42:15 (GMT) |
---|---|---|
committer | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2005-01-28 22:42:15 (GMT) |
commit | 0e1ff207546bf7205cc1532287fc2e0499b273cb (patch) | |
tree | 79ce5c6d774a2fc4bbcf523a37214ac105cb2abb | |
parent | 30d5c198fce3388b5b8a241feae346eee9d876a2 (diff) | |
download | monitoring-plugins-0e1ff207546bf7205cc1532287fc2e0499b273cb.tar.gz |
New version of Simon Bellwoods check_sybase (0.4). Thank you.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1116 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-x | contrib/check_sybase | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/check_sybase b/contrib/check_sybase index 20b4a30..1f1cbf8 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. |
16 | my $VERSION = "0.2"; | 16 | # 0.3 13-JAN-2004 Fixed lib path, improved timeouts. |
17 | # 0.4 26-JAN-2004 Added loginTimeout. | ||
18 | my $VERSION = "0.4"; | ||
17 | 19 | ||
18 | use strict; | 20 | use strict; |
19 | use DBI; | 21 | use DBI; |
20 | use Getopt::Long; | 22 | use Getopt::Long; |
21 | use lib "/usr/local/nagios/libexec"; | 23 | use lib qw( /usr/lib/nagios/plugins/ /usr/local/nagios/libexec/ ); |
22 | use utils qw(%ERRORS &print_revision &support &usage $TIMEOUT); | 24 | use utils qw(%ERRORS &print_revision &support &usage $TIMEOUT); |
23 | 25 | ||
24 | 26 | ||
@@ -26,6 +28,7 @@ my $PROGNAME = "check_sybase"; | |||
26 | my $DEFAULT_CHECKTYPE = "FREESPACE"; | 28 | my $DEFAULT_CHECKTYPE = "FREESPACE"; |
27 | my $DEFAULT_WARNING = "25"; | 29 | my $DEFAULT_WARNING = "25"; |
28 | my $DEFAULT_CRITICAL = "10"; | 30 | my $DEFAULT_CRITICAL = "10"; |
31 | my $DEFAULT_TIMEOUT = "30"; | ||
29 | 32 | ||
30 | my ($user, $pass, $dbsvr, $dbname, $config, $checktype, $warn, $crit, $timeout, | 33 | my ($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 | ||
60 | if ($help) | 63 | if ($help) |
61 | { | 64 | { |
@@ -105,8 +108,8 @@ my $dbh; | |||
105 | my $is_connected; | 108 | my $is_connected; |
106 | sub connect | 109 | sub 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 | ||
267 | Examples: | 270 | Examples: |
268 | $PROGNAME -U sa -P secret -S bigbox -D orders | 271 | $PROGNAME -U sa -P secret -S bigbox -D orders |