Check MS SQL Stored Procedure

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check MS SQL Stored Procedure

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post 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)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check MS SQL Stored Procedure

Post by scottwilkerson »

you have the hostname listed as sqldev_digitallog,4000 can that be correct with a comma in there?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post 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. :)
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check MS SQL Stored Procedure

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check MS SQL Stored Procedure

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Check MS SQL Stored Procedure

Post by jkinning »

My Nagios instance is running on CentOS 6.9.

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