Page 1 of 1
SQL Plugin Does not like space in Database Name
Posted: Sun Nov 11, 2018 9:08 pm
by kwhogster
Nagios Core 4.3.4
Nsclient 4.3
Windows 2012 R2
SQL 2014
Using a SQL plugin to check the SQL database sizes. I posted this question earlier and we got most of the databases working. I have a new issue I would like help on.
Nagios show this
SQLDBSIZE-Managed Metadata Service OK 11-11-2018 00:19:17 0d 21h 36m 37s 1/10 C:Program FilesNSClient++scriptscheck_sqldbsize.vbs(24, 15) Microsoft VBScript runtime error: Type mismatch: 'cint'
I run the same on the server
root@tgcs017:/usr/local/nagios/etc/objects/windowsservers# /usr/lib/nagios/plugins/check_nrpe -t 50 -H 'TGCS014-N1' -c check_sqldbsize -a 'TGCS014-N1-SQLS\Sharepoint!Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0!8000!9500'
Code: Select all
define service {
host_name hostname
service_description SQLDBSIZE-Managed Metadata Service
check_command check_sqldbsize!'TGCS014-N1-SQLS\Sharepoint!Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0!8000!9500'
check_interval 1440
notification_interval 1440
servicegroups SQL DB Size
check_period backup_period
notification_period backup_period
use generic-service
}
Code: Select all
define command {
command_name check_sqldbsize
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c check_sqldbsize -a $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
The ONLY difference I found is that the Databases names have a space between them all the databases that are working do not have a space in the name.
I tried place "" around extra '' no luck.
Any ideas
Thank you
Tom
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 11:24 am
by bolson
Hello Tom,
Two things to try are:
1) Escape the database name with the Linux escape character "\" like this: my\ database (space after the \)
2) Single quote " ' " the database name.
If this doesn't resolve your issue, let me know and I'll attempt to recreate your issue.
Thank you for visiting the Nagios Support Forum!
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 1:47 pm
by kwhogster
Single Quotes
:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -t 50 -H 'TGCS014-N1' -c check_sqldbsize -a 'TGCS014-N1-SQLS\'Sharepoint!Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0!8000'!9500'
-su: !Managed: event not found
With the "\"
root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -t 50 -H 'TGCS014-N1' -c check_sqldbsize -a 'TGCS014-N1-SQLS\Sharepoint!Managed\ Metadata\ Service_addd35ce8f5049a69f66716abf5879a0!8000!9500'
C:\Program Files\NSClient++\scripts\check_sqldbsize.vbs(24, 15) Microsoft VBScript runtime error: Type mismatch: 'cint'
Thanks
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 2:06 pm
by bolson
Hello again Tom,
This error is not being generated by Nagios but rather by the VBScript itself. The next step in troubleshooting would be to run the script from the command line of the Windows host and post the output like this:
cscript check_sqldbsize.vbs SERVERINSTANCE DATABASE WARNING CRITICAL
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 2:20 pm
by kwhogster
Same results
C:\Program Files\NSClient++\scripts>cscript check_sqldbsize.vbs TGCS014-N1-SQLS\SHAREPOINT Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0 8000 9600
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\NSClient++\scripts\check_sqldbsize.vbs(24, 15) Microsoft VBScript runtime error: Type mismatch: 'cint'
C:\Program Files\NSClient++\scripts>cscript check_sqldbsize.vbs TGCS014-N1-SQLS\SHAREPOINT 'Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0' 8000 96
00
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\NSClient++\scripts\check_sqldbsize.vbs(24, 15) Microsoft VBScript runtime error: Type mismatch: 'cint'
But when I place double quotes " it works
C:\Program Files\NSClient++\scripts>cscript check_sqldbsize.vbs TGCS014-N1-SQLS\SHAREPOINT "Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0" 8000 96
00
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
OK: MANAGED METADATA SERVICE_ADDD35CE8F5049A69F66716ABF5879A0 database size is 4 MB.
Now from Nagios
/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -t 50 -H 'TGCS014-N1' -c check_sqldbsize -a 'TGCS014-N1-SQLS\Sharepoint!"Managed Metadata Service_addd35ce8f5049a69f66716abf5879a0"!8000!9500'
OK: MANAGED METADATA SERVICE_ADDD35CE8F5049A69F66716ABF5879A0 database size is 4 MB.
Looks like I need double quotes around the database name
Will post final results later
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 3:28 pm
by bolson
Thank you Tom,
Let us know once you've confirmed the solution so we can lock the thread.
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 12, 2018 7:38 pm
by kwhogster
They all worked but this one Sorry I missed this one before.
C:Program FilesNSClient++scriptscheck_sqldbsize.vbs(33, 1) Microsoft OLE DB Provider for SQL Server: Cannot open database "Search_Service_Application_PropertyStoreDB_2a6fb4d3dca4255b6a7dbd9d6abab60" requested by the login. The login failed.
Code: Select all
define service {
host_name hostname
service_description SQLDBSIZE-Search_Service_Application_PropertyStoreDB
check_command check_sqldbsize!'TGCS014-N1-SQLS\Sharepoint!Search_Service_Application_PropertyStoreDB_2a6fb4d3dca4255b6a7dbd9d6abab60!8000!9500'
check_interval 1440
notification_interval 1440
servicegroups SQL DB Size
check_period backup_period
notification_period backup_period
use generic-service
}
from the server command line
C:\Program Files\NSClient++\scripts>cscript check_sqldbsize.vbs TGCS014-N1-SQLS\
SHAREPOINT "Search_Service_Application_PropertyStoreDB_2a6fb4d3dca4255b6a7dbd9d
6abab60" 8000 9500
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\NSClient++\scripts\check_sqldbsize.vbs(33, 1) Microsoft OLE DB
Provider for SQL Server: Cannot open database "Search_Service_Application_Proper
tyStoreDB_2a6fb4d3dca4255b6a7dbd9d6abab60" requested by the login. The login failed.
Any ideas?
Re: SQL Plugin Does not like space in Database Name
Posted: Tue Nov 13, 2018 10:24 am
by bolson
Hello kwhogster,
Not being familiar with your environment, I can only guess that the error message should be taken literally. The sa password is hard coded in the script so that's probably where you want to look first. Let me know if this resolves your issue.
Thanks!
Re: SQL Plugin Does not like space in Database Name
Posted: Sun Nov 18, 2018 11:21 am
by kwhogster
Added another account to the SQL logins
also the database was missing a single character copy and paste sometimes does not work lol
This can be locked as resolved now
Thank you
Re: SQL Plugin Does not like space in Database Name
Posted: Mon Nov 19, 2018 12:51 pm
by scottwilkerson
kwhogster wrote:Added another account to the SQL logins
also the database was missing a single character copy and paste sometimes does not work lol
This can be locked as resolved now
Thank you
great!
Locking