CHECK_MSSQL CRITICAL allways as output when use check_sql for MSSQL checking

Mathew Walker lmw94002 at hotmail.com
Fri Sep 11 15:18:08 CEST 2009


In my environment... 

 

WORKS:

./tsql -S mssqlsvr -p 1433 -U nagios -P password

 

DOES NOT WORK:

./tsql -S mssqlsvr.domain.com -p 1433 -U nagios -P password

locale is "en_US.UTF-8"
locale charset is "UTF-8"
Msg 20002, Level 9, State -1, Server OpenClient, Line -1
Adaptive Server connection failed
There was a problem connecting to the server


in my freetds.conf file... 

 

[mssqlsvr]
        host = mssqlsvr.domain.com
        port = 1433
        tds version = 8.0


I vaguely recall also having some environment path / lib issues... but that may have been a different issue.


-- 
Mat W. - http://www.techadre.com


 
> Date: Fri, 11 Sep 2009 10:51:20 +0200
> Subject: Re: [Nagios-users] CHECK_MSSQL CRITICAL allways as output when use check_sql for MSSQL checking
> From: arlytex at gmail.com
> To: lmw94002 at hotmail.com
> CC: nagios-users at lists.sourceforge.net
> 
> Good it works for someone :) hopefully it will work for me too :)
> 
> anyway when I run
> 
> ./check_mssql -H MSSQL ss -p 1433 -U nagios -P PASSWORD
> CHECK_MSSQL CRITICAL
> 
> again same error.
> 
> where in my /etc/freetds.conf I have
> 
> # A typical Microsoft server MSSQL server defined.
> [MSSQL]
> host = sss.sss.sss.sss
> port = 1433
> tds version = 8.0
> 
> I installed Freetds from source code and when I run
> 
> ./tsql -S sss.sss.sss.sss -U nagios -p 1433
> locale is "en_US.UTF-8"
> locale charset is "UTF-8"
> Password:
> Msg 20008, Level 9, State -1, Server OpenClient, Line -1
> Unable to open socket
> There was a problem connecting to the server
> 
> I get password prompt and after I enter password it ends with above
> error without connecting.
> I am not really sure what could be reason for behaviour like this, I
> can connect to MSSQL 2005 server
> on port 1433 but when used freetds for some reason it hangs. I
> compiled freetds with support for tdsver=8.0
> 
> Thank you for comments
> 
> Nice regards,
> 
> Arlen
> 
> 
> 
> 
> 
> 
> 
> On Thu, Sep 10, 2009 at 11:13 PM, Mathew Walker <lmw94002 at hotmail.com> wrote:
> > I use FreeDTS... works like a champ.
> >
> > but note how the "host" is defined in the freedts.conf file between the
> > square brakcets, not the FQDN or IP address when running the check from the
> > command line.
> >
> > eg. try...
> >
> > ./check_mssql -H MSSQL ss -p 1433 -U USER -P PASSWORD
> >
> > --
> > Mat W. - http://www.techadre.com
> >
> >
> >
> >> Date: Thu, 10 Sep 2009 22:46:55 +0200
> >> From: arlytex at gmail.com
> >> To: jim at jimavery.me.uk
> >> CC: nagios-users at lists.sourceforge.net
> >> Subject: Re: [Nagios-users] CHECK_MSSQL CRITICAL allways as output when
> >> use check_sql for MSSQL checking
> >>
> >> On Thu, Sep 10, 2009 at 6:21 PM, Jim Avery <jim at jimavery.me.uk> wrote:
> >> > 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
> >> >
> >>
> >> After your post I installed php5-sybase and still getting same error :
> >> CHECK_MSSQL CRITICAL
> >>
> >> I am using command: ./check_mssql -H sss.sss.sss.sss -U user -P pass
> >>
> >> user and password are valid and I can connect with them to database.
> >> MSSQL server listen on port 1433
> >> and I can connect on port 1433 when run
> >>
> >> telnet sss.sss.sss.sss 1433
> >>
> >> Is there something special necessary to enable on MSSQL side, some
> >> deamon, whatever, ...I expected
> >> it to work with php5-sybase but it does not.
> >>
> >> Thank you for reply and regards,
> >>
> >> Arlen
> >>
> >>
> >> >
> >> > ------------------------------------------------------------------------------
> >> > 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
> >> >
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> 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
> >
> > ________________________________
> > With Windows Live, you can organize, edit, and share your photos. Click
> > here.

_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_online:082009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090911/353d1128/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
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