Check SQL Server 2000?

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Feb 8 05:07:37 CET 2003


Dear Sir,

I am writing to thank yuo for your letter and say,

On Fri, Feb 07, 2003 at 03:34:14PM -0800, Tong Young wrote:
> Is there a way for me to query a SQL Server for data?
> 

Of course - however, precisely how you do it depends on the server.

Have a look at the plugin writers guidelines in the docs.

Then, write some code to

. have your 'SQL server' client - if you don't have the client code on
the Nag host see below - to make the query

. compare the result of the query to the threshold and

. set the return code and write some output (for the human reading the
alert) accordingly.

Alternatively, if the 'SQL server' client code is _not_ on the Nag host,
then run it on the host it is installed on with something like NRPE or
use NCSA to submit its result to the Nag host.

> I have a database and inside the database is stored data about the
> performance of my database and other values.  I would like to query the
> server for these values and then trigger an alarm when a threshold is
> reached.
> 
> In Sitescope it is like this:
> 
> ODBC connection:  jdbc:odbc:SQLLiveMon
> Query:	exec spMON_FindLastTimeExtTaskRan 'SQLMsgClick'
> 
> I'm not sure if nagios can do something like this.  Thanx!!
> 

If this is procedure is runnable from the shell (at a CLI), you can
wrap it in the trivial extra bits required by Nag and use it as a
a plugin.

Or, use Tom De Blendes canonical answer to this question,

>> Up until SQL Server 7, Microsoft officially supported Sybase client
>> software. So you could download the Sybase client, and connect to MS
>> SQL. With TDS version 8.0 (and legacy support for version 7.0) in SQL
>> 2000, compatibility with Sybase client was broken. However, you can
>> use the Freetds libraries instead.

>> So here's what I've done to have a way to connect to both SQL 7 and
>> SQL 2000:

>> 1) Download and install freetds from http://www.freetds.org.
>> 2) Download and install sqsh from http://www.sqsh.org.
>> 3) export SYBASE=/usr/local/freetds (or where ever your freetds is
>> installed)

>> Now you can use sqsh to connect to your MS SQL:

>> sqsh -S servername -U username

>> You're now reasy to script your own plugins based on the output you
>> get from your queries. Works great.

HTH,

Yours sincerely.
-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com




More information about the Users mailing list