CHECK_MSSQL CRITICAL allways as output when use check_sql for MSSQL checking
Jim Avery
jim at jimavery.me.uk
Thu Sep 10 18:21:50 CEST 2009
2009/9/9 Arlen Drina <arlytex at gmail.com>:
> Hi all,
>
> I am using check_sql for checking MSSQL server ( or I would like to
> check MSSQL servers ). I compiled
> freetds with --with-tdsver=8.0 support on my debian system and all
> went ok, in /etc/freetds.conf I have
>
> [global]
> # TDS protocol version
> #; tds version = 4.2
> tds version = 8.0
>
> # A typical Microsoft server
> [MSSQL]
> host = sss.sss.sss.sss
> port = 1433
> tds version = 8.0
>
> and when I run ./check_mssql -H sss.sss.sss.sss -p 1433 -U USER -P PASSWORD
>
> I am constantly getting output
>
> CHECK_MSSQL CRITICAL
>
> Ok, I tried to solve this myself and I found at \
>
> http://exchange.nagios.org/directory/Plugins/Databases/Others/check_sql/details
> that is recommneded to change host-->server in line
>
> my $cs = "DBI:$driver:" . ($database ? "database=$database;" : '') .
> "server=$hostname" . ($port ? ";port=$port" : '');
>
> so I changed that, but still I am getting same output for above command.
>
> I am just trying to get minimal response from MSSQL server, connection
> to port 1433 is open and I can connect via
> telnet sss.sss.sss.sss 1433 and it works.
>
> Any hint is welcome, I exhausted all my ideas, and thank you in advance
I don't use freetds. Instead, I installed php5-sybase (and any
dependencies if there were any, I can't remember) from the debian
repositories (I'm using Ubuntu).
I can run the plugin from the command line like so:
/usr/local/nagios/libexec/check_mssql -H 10.10.10.123 -U loginid -P mypassword
OK: Connect time=0.004189 seconds.
Of course, the user "loginid" must be configured in MSSQL with the
password "mypassword" to authenticate to the database.
Some of our MSSQL servers have a specific instance, in which case you
need to find the port number the instance is listening on, then use
the following syntax to do the check:
/usr/local/nagios/libexec/check_mssql -H 10.10.10.123:1375 -u
loginid -P mypassword
OK: Connect time=0.045179 seconds.
(1375 is the port number for this instance but it varies from one to the next)
I found the check_mssql didn't like the hostname syntax when using IP
addresses like this, so I changed it a bit by removing both the
"Validate the hostname" and "Validate the username" sections.
I also (very sloppily) altered the part where it checks if the
expected result is emtpy like so:
287c205
< if ($querytype == "query" && !empty($expected_result)) {
---
> if ($querytype == "query" && (!empty($expected_result) ||
$expected_result == "0")) {
That was because I wanted to do a check which expected a result "0".
hth,
Jim
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list