Page 2 of 4

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 8:25 am
by jkinning
Getting a little further.

Code: Select all

check_mssql_sproc.pl -H sqldev_digitallog,4000 -p "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4" -u DigitalLogNagios -P fsanw_54d -w 1 -c 2
install_driver(ODBC) failed: Can't locate DBD/ODBC.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3.
Perhaps the DBD::ODBC perl module hasn't been fully installed,
or perhaps the capitalisation of 'ODBC' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge, mysql.
 at ./check_mssql_sproc.pl line 68

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 9:03 am
by scottwilkerson
You can install the missing plugin here

Code: Select all

yum install 'perl(DBD::ODBC)' -y
However, I am almost certain that you will need to use a SQL user and not an AD user

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 10:58 am
by jkinning
Thanks.

Now getting this:

Code: Select all

check_mssql_sproc_parameters.pl -H sqldev_digitallog,4000 -u DigitalLogNagios -P fsanw_54d -d digital_log_d -p "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4" -w 1 -c 2
DBI connect('Driver={ODBC Driver 11 for SQL Server};SERVER=sqldev_digitallog,4000','DigitalLogNagios',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at ./check_mssql_sproc_parameters.pl line 71
Error: Unable to connect to MS-SQL database!
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 11:17 am
by scottwilkerson
you have the hostname listed as sqldev_digitallog,4000 can that be correct with a comma in there?

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 11:56 am
by jkinning
That is the port. I removed that and still get the same message.

Code: Select all

check_mssql_sproc_parameters.pl -H sqldev_digitallog -u DigitalLogNagios -P fsanw_54d -d digital_log_d -p "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4" -w 1 -c 2
DBI connect('Driver={ODBC Driver 11 for SQL Server};SERVER=sqldev_digitallog','DigitalLogNagios',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at ./check_mssql_sproc_parameters.pl line 71
Error: Unable to connect to MS-SQL database!
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)

check_mssql_sproc_parameters.pl -H sqldev_digitallog,4000 -u DigitalLogNagios -P fsanw_54d -d digital_log_d -p "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4" -w 1 -c 2
DBI connect('Driver={ODBC Driver 11 for SQL Server};SERVER=sqldev_digitallog,4000','DigitalLogNagios',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at ./check_mssql_sproc_parameters.pl line 71
Error: Unable to connect to MS-SQL database!
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
I am going to reach out to our DBA team as well to see if this means anything to them as I am far from a MSSQL interpreter. :)

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 1:12 pm
by jkinning
Does the ODBC Driver 11 for SQL Server need to be installed on the Nagios server? If so, where and how can I get that installed.

Re: Check MS SQL Stored Procedure

Posted: Fri Sep 01, 2017 4:12 pm
by scottwilkerson
jkinning wrote:Does the ODBC Driver 11 for SQL Server need to be installed on the Nagios server? If so, where and how can I get that installed.
I do not believe so, but if you use a custom port it should be seperated with a colon

Code: Select all

sqldev_digitallog:4000
Also, this all assumes that your Nagios XI server knows what IP sqldev_digitallog maps to.

Code: Select all

ping sqldev_digitallog

Re: Check MS SQL Stored Procedure

Posted: Tue Sep 05, 2017 1:35 pm
by jkinning
check_mssql_sproc.pl -H SQLDEV_DIGITALLOG:4000 -u DigitalLogNagios -P fsanw_54d -d digital_log_d -p "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4" -w 1 -c 2
DBI connect('DRIVER={SQL Server};SERVER=SQLDEV_DIGITALLOG:4000','DigitalLogNagios',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at ./check_mssql_sproc.pl line 68
Error: Unable to connect to MS-SQL database!
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)

ping sqldev_digitallog
PING sqldev_digitallog.host.com (x.x.x.x) 56(84) bytes of data.
64 bytes from x.x.x.x: icmp_seq=1 ttl=127 time=0.278 ms
64 bytes from x.x.x.x: icmp_seq=2 ttl=127 time=0.258 ms
^C
--- sqldev_digitallog.ws.wsfgrp.net ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1796ms
rtt min/avg/max/mdev = 0.258/0.268/0.278/0.010 ms

Re: Check MS SQL Stored Procedure

Posted: Tue Sep 05, 2017 5:18 pm
by cdienger
Using the github version, I had to go through the following:

Run:

Code: Select all

yum -y install mysql-connector-odbc
And then edit /etc/odbcinst.ini:

Code: Select all

# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
#Driver         = /usr/lib/libmyodbc5.so
#Setup          = /usr/lib/libodbcmyS.so
Driver  = /usr/lib64/libmyodbc5.so
Setup           = /usr/lib64/libodbcmyS.so
FileUsage       = 1
and modified the plugin on line 70 to look like:

Code: Select all

$conn{"dsn"} = "dbi:ODBC:Driver=MySQL;SERVER=" . $conn{"server"} .";PORT=4000";
A lot of this may be OS dependent. Hopefully this helps though. What OS is Nagios installed on?

Re: Check MS SQL Stored Procedure

Posted: Wed Sep 06, 2017 8:31 am
by jkinning
My Nagios instance is running on CentOS 6.9.

I'll give this a try and post the results.