[Nagiosplug-devel] MSSQL plugin ?

Jonathan Rozes jrozes at vinton.com
Wed Nov 27 11:14:03 CET 2002


I cobbled a plugin together that uses sqsh (http://www.sqsh.org), which can
be built using freetds. Here's a quick rundown of the setup:

1. Install and test sqsh.

2. Install the plugin included below in the plugin directory of your nagios
installation and name it 'check_mssql'.

3. Create a file called '.sqshrc' in the nagios user's home directory with
contents like so:

\set username="USER"
\set password="PASS"

Where USER and PASS are the username and password needed to access the MS
SQL server, respectively. Make sure the nagios user has permission to read
the file (and probably nobody else unless you want to give away access to
your SQL server). Using a read-only account is recommended.

4. Create a file called 'sqsh-NAME' (where NAME is the host_name used in
your nagios config for this server) in some directory that the nagios user
can access (like /usr/local/nagios/data or somesuch) with some SQL
statements that constitute a simple check, like a SELECT from a small table
in each database, like so:

use mydatabase;
select * from mytable;
use myotherdatabase;
select * from myothertable;

5. Setup a command entry in your config like so:

define command{
	command_name	check_mssql
	command_line	$USER1$/check_mssql -H $HOSTADDRESS$ -f
/usr/local/nagios/data/sqsh-$HOSTNAME$
}

You may want to add '-c' and '-w' arguments to change the warning and
critical runtime thresholds as well. Run 'check_mssql -h' for complete usage
instructions and default values.

6. Setup an appropriate service entry in your config.

7. Check your config, restart nagios and enjoy.

The plugin is attached. I make no claims of portability, warranty, etc., so
know what you're doing before doing it.

Good luck,
jonathan

> -----Original Message-----
> From: Brian Ipsen [mailto:Brian.Ipsen at andebakken.dk]
> Sent: Wednesday, November 27, 2002 10:38 AM
> To: nagiosplug-devel at lists.sourceforge.net
> Subject: [Nagiosplug-devel] MSSQL plugin ?
> 
> 
> Hi!
> 
>  Has anyone done a plugin to check a MS SQL server ? I'm 
> currently trying to
> put something together, which uses freetds 0.60. But since 
> I'm no expert in
> either makefiles, the configure script etc, I'd really 
> appreciate if someone
> could take care of that part once I have something, that seems to be
> working - maybe by including it in the plugins package once 
> the code seems
> stable enough.
> 
> Regards,
> 
> /Brian Ipsen
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Get the new Palm Tungsten T 
> handheld. Power & Color in a compact size! 
> http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_mssql
Type: application/octet-stream
Size: 3562 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20021127/8314ca12/attachment.obj>


More information about the Devel mailing list