Dennis Hopp escreveu:
You could either use a plugin that connects to the MSSQL server port
(1433 by default) and check the response.
Or
There are a few plugins that check to see if a result can be obtained
from an actual query against mysql, you could adapt that for MSSQL
Or
You could use a plugin that will check your website (a page that uses
a database lookup) and check to see if the page returns ok or not.
--Dennis
------------------------------------------------------------------------
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] *On Behalf Of *Jason
*Sent:* Monday, December 19, 2005 1:10 PM
*To:* Nagios List
*Subject:* [Nagios-users] SQL Server monitoring
Northern Valley CommuRecently, we had a server issue with one of
MSSQL servers. It never went
down, but it did reject any type of connection that would be sent
to it.
All websites that tried to conenct to a database on that server
failed.
They all showed RunTime errors. We have nagios set up to monitor
if the SQl
servers are physically down, but is there a way to have nagios
check the
connectivity of a server that is up to see if it is still accepting
connections?
Thanks for your help.
Thanks
Jason B.
Hosting Technician
Portal Web Hosting
Northern Valley Communications nications
I´m use this plugin for MSSQL server...
--
_________________________
Cláudio Elautério
Analista de T.I
ICQ: 77872215
MSN: [EMAIL PROTECTED]
Fone: 550656172339
Celular: 06599570277
O homem é feito para a luta, não para o repouso.
(Ralph Emerson)
#!/usr/bin/perl
# $Id: check_mssql.pl,v 1.1 2003/08/29 05:36:49 knitterb Exp $
use DBI;
use Data::Dumper;
use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);
use Getopt::Long;
use strict;
my $server="";
my $uid="";
my $pwd="";
GetOptions ('server|s=s'=>\$server, 'user|u=s'=>\$uid, 'password|p=s'=>\$pwd);
if (check_vars()) {
exit(-1);
}
my $start_time=[gettimeofday];
my $rc=0;
eval {
$rc=test();
};
my $duration=tv_interval($start_time);
$duration=($duration*1000);
if (!$rc || $@) {
print "CRITICAL - [EMAIL PROTECTED] $duration ms [EMAIL PROTECTED]";
exit(2);
} elsif ($rc) {
print "OK - [EMAIL PROTECTED] $duration ms\n";
exit(0);
}
print "UNKNOWN - rc is $rc\n";
exit(-1);
sub test {
my $dbh;
$dbh=DBI->connect("dbi:Sybase:server=$server;".
"loginTimeout=15;scriptName=nagios",
$uid, $pwd, {PrintError=>0}) || die "Can't connect
$DBI::errstr";
my @row_ary = $dbh->selectrow_array("select 1")
|| die "Can't select";
#print Dumper([EMAIL PROTECTED]);
if ($row_ary[0] == 1) {
return(1);
} else {
die "Select test did not return 1";
}
}
sub check_vars {
if (length($server)<=0) {
print_usage("Server variable missing");
return(1);
}
if (length($uid)<=0) {
print_usage("User variable missing");
return(1);
}
if (length($pwd)<=0) {
print_usage("Password variable missing");
return(1);
}
}
sub print_usage {
my ($msg)[EMAIL PROTECTED];
if ($msg) {
print "Error: $msg\n";
}
print "\n";
print "--server -s\t\tServer to connect to\n";
print "--user -u\t\tUser to connect as\n";
print "--password -p\t\tPassword for user\n";
print "\n";
print "\n";
}