Check MS SQL Stored Procedure
Re: Check MS SQL Stored Procedure
Sounds good. Keep us posted.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Check MS SQL Stored Procedure
It sat there longer but then spit out this 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=MySQL;SERVER=sqldev_digitallog;PORT=4000','DigitalLogNagios',...) failed: [unixODBC][MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 104 (SQL-08S01) at ./check_mssql_sproc_parameters.pl line 72
Error: Unable to connect to MS-SQL database!
[unixODBC][MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 104 (SQL-08S01)
Re: Check MS SQL Stored Procedure
In the event that using SQL Server's authentication (instead of domain authentication) is an option, I haven't had much trouble using check_mssql:
Code: Select all
[root@nagios libexec]# ./check_mssql.php --hostname 1.1.1.1 --username username --password password --port 1443 --database database --query "EXEC some_sp @field1=2815, @field2=76;"
OK: Query duration=0.023742 seconds. Query result=2815 Query result=09 Query result=4.2199999999999998 Query result=45.5 Query result=3.9780000000000002 Query result=0 Query result=4.2199999999999998 Query result=3.9780000000000002 Query result=89 Query result=1 Query result=1 Query result=1 Query result=1|query_duration=0.023742s;Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Check MS SQL Stored Procedure
Is SQL auth an option as mcapra suggested?
The new error makes me think there's a problem between machines. Are you able to telnet from XI to the sql server ?
?
The new error makes me think there's a problem between machines. Are you able to telnet from XI to the sql server ?
Code: Select all
yum -y install telnet
telnet digitallog 4000
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Check MS SQL Stored Procedure
telnet sqldev_digitallog 4000
Trying x.x.x.x...
Connected to sqldev_digitallog.
Escape character is '^]'.
Trying x.x.x.x...
Connected to sqldev_digitallog.
Escape character is '^]'.
Re: Check MS SQL Stored Procedure
Is the check that mcapra an option for you? Failing this I think it'd be best if you opened a ticket by sending an email to [email protected] and we can set up a remote.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Check MS SQL Stored Procedure
Looks like it doesn't like the _ in the hostname. I have tried to use quotes but that doesn't matter either. This is our standard naming convention is what the DBA's are telling me.
I use the IP address and got an OK back. I'll validate that is alright and see if they can change something so I can get a Critical output. I'll keep you posted.
Code: Select all
check_mssql -H sqldev_digitallog --username DigitalLogNagios --password fsanw_54d --port 4000 --database digital_log_d --query "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4"
UNKNOWN: Invalid characters in the hostname.Code: Select all
check_mssql -H x.x.x.x --username DigitalLogNagios --password fsanw_54d --port 4000 --database digital_log_d --query "dbo.uspDgtlGetErrorLogs @DgtlLogMinutes = 999999, @DgtlLogSourceId = 16, @DgtlLogLevel = 4"
OK: Query duration=0.035074 seconds.|query_duration=0.035074s;;Re: Check MS SQL Stored Procedure
It's actually hard-wired to look for IP addresses exclusively* EDIT: Nope, see @scottwilkerson post
The regex could either be loosened or removed all together to allow hostnames:
Code: Select all
// Validate the hostname
if (isset($db_host)) {
if (!preg_match("/^([a-zA-Z0-9-]+[\.])+([a-zA-Z0-9]+)$/", $db_host)) {
print "UNKNOWN: Invalid characters in the hostname.\n";
exit(3);
}
} else {
print "UNKNOWN: The required hostname field is missing.\n";
exit(3);
}
Code: Select all
[root@nagios ~]# /usr/local/nagios/libexec/check_mssql.php --hostname 1.1.1.1 --username username --password password --port 1443 --database database --query "EXEC some_sp @field1=2815, @field2=76;"
OK: Query duration=0.18552 seconds. Query result=2815 Query result=09 Query result=4.2199999999999998 Query result=45.5 Query result=3.9780000000000002 Query result=0 Query result=4.2199999999999998 Query result=3.9780000000000002 Query result=89 Query result=1 Query result=1 Query result=1 Query result=1|query_duration=0.18552s;
[root@nagios ~]# /usr/local/nagios/libexec/check_mssql.php --hostname somehost --username username --password password --port 1443 --database database --query "EXEC some_sp @field1=2815, @field2=76;"
OK: Query duration=0.029853 seconds. Query result=2815 Query result=09 Query result=4.2199999999999998 Query result=45.5 Query result=3.9780000000000002 Query result=0 Query result=4.2199999999999998 Query result=3.9780000000000002 Query result=89 Query result=1 Query result=1 Query result=1 Query result=1|query_duration=0.029853s;
Last edited by mcapra on Mon Sep 11, 2017 9:10 am, edited 2 times in total.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check MS SQL Stored Procedure
It's actually designed to be valid hostname charsmcapra wrote:It's actually hard-wired to look for IP addresses exclusively:
Code: Select all
// Validate the hostname if (isset($db_host)) { if (!preg_match("/^([a-zA-Z0-9-]+[\.])+([a-zA-Z0-9]+)$/", $db_host)) { print "UNKNOWN: Invalid characters in the hostname.\n"; exit(3); } } else { print "UNKNOWN: The required hostname field is missing.\n"; exit(3); }
https://en.wikipedia.org/wiki/HostnameHowever, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted. While a hostname may not contain other characters, such as the underscore character (_), other DNS names may contain the underscore.
Re: Check MS SQL Stored Procedure
Coffee helps
It's also worth mentioning that the regex won't match localhost and similar. I had to check the regex after receiving that error message when I was initially testing this.
It's also worth mentioning that the regex won't match localhost and similar. I had to check the regex after receiving that error message when I was initially testing this.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/