[Nagiosplug-devel] check_sql Perl plugin (was Re: Nagios::Plugin perl module integrated into SVN])

Thomas Guyot-Sionnest dermoth at aei.ca
Sun Sep 23 02:50:46 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I put more work into check_sql (formerly check_mssql). The additions are
numerous:

- - Can work as check_mysql or check_mssql (symlink). check_sql has an
additional parameter to define the Perl driver to use.
- - Query can be specified
- - Expect string can be specified
- - Expect string can be a Perl regexp
- - Support thresholds on numeric results
- - Support custom labels
- - Support performance data on numeric results (using LABEL,UOM label
format)
- - Support printing the result in the status line
- - Support database selection

Technically speaking the feature of contrib/check_mssql.sh can be done
with this new plugin by using a server-side stored procedure. Anyone
calling himself a MSSQL DBA should be able to write one.


Ton, I haven't looked much into what needs to be done to include it in
Nagios-plugin. If you have a good idea of what's required (apart "use
lib [...]" and symlinks) and want to get in in the current state, you
can go ahead :). I'll have to write a test script as well (no sure how
to include the new parameters without breaking the tinderbox either)...

Attatched:
203ca7bce66d0fcfcac79daade579c2a  check_sql.pl

- --
Thomas

- -------- Original Message --------
Ton Voon wrote:
> On 16 Sep 2007, at 06:53, Thomas Guyot-Sionnest wrote:
>
>> On a side note I just written a Perl plugin for checking M$ SQL
>> databases (attached). It fully uses N::P, including thresholds and
>> performance data (and it's awesome how easy it is now!). Strangely
>> right
>> after that I noticed there is a bash check_mssql in /contrib so I
>> thought maybe we could include mine as a replacement. I believe it's
>> also a good example of a N::P plugin.
>
> I'd definitely want an example plugin to include.

check_stuff.pl was a good source of inspiration for me, though
check_mssql is a bit more useful :)

> I've had a quick look through yours (as much as I can without a mssql
> server) and it looks good. I notice that the contrib version has

It would certainly work on any database if you change the DB driver and
specify the right port. That could be useful for testing (I don't have
any M$SQL db at home either).

> number of users in the output - could that be added (don't worry
> about thresholds for that yet)? Then we can remove the contrib version.

I could possibly. I'll have to look around or test since the method used
seems a bit special. This check script query "select loginame from
sysprocesses where spid > $spid order by loginame asc" (where $spid
varies between version 7 and 2000, how about 2005?), filter out a bunch
of lines and count the rest.

However in all honesty I think this kind of check is flaky. I was rather
thinking of a pair of options to override the query and check the result
(optionnal), and another pair to set a label (optionnal) and print the
result. I think that would benefit more people and DBAs can always
create SPROCs to do the dirty work.

> Also, if you want it distributed in the core distribution, could you
> set the copyright as Nagios Plugins Development Team (you can list

I have no problem with that.

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG9bhm6dZ+Kt5BchYRAtTXAJ9MfsI5sZWcq3ll7ukxsYB3TVhfiQCg0N59
xaK/ZPJB7z7agvYpkfmnj1M=
=ObCY
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_sql.pl
Type: application/x-perl
Size: 9371 bytes
Desc: not available
URL: <http://nagios-plugins.org/archive/devel/attachments/20070922/c7aae2ac/attachment.bin>


More information about the Devel mailing list