Nagios Check for SQL Databases Stopped Working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Nagios Check for SQL Databases Stopped Working

Post by kwhogster »

Nagios Core 4.3.4

I have a SQL Server with Databases and I us a csscript to check the database size was working before but now for some reason I get this

C:Program FilesNSClient++scriptscheck_sqldbsize.vbs(33, 1) Microsoft OLE DB Provider for SQL Server: Cannot open database "Music" requested by the login. The login failed.

Now I have 3 SQL Instances running and the exact same check works on some databases and not on others,

So I went back to the beginning and on My SQL Server Windows 2012 R2 SQL 2014 Cluster 2 Node on VM Ware 6.7 ESXI Host 6.7
I ran the command from a DOS command prompt on the Database listed above and it worked fine.

C:\Program Files\NSClient++\scripts>cscript check_sqldbsize.vbs SERV014-N1-sqlc Music 500 9000
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

OK: MUSIC database size is 20 MB.
That's what I would expect to happen on Nagios

So I went to my Nagios Server and tried to run the command and it fails with this

root@serv017:/usr/lib/nagios/plugins# ./check_nrpe -t 50 -H 'SERV014-N1' -c check_sqldbsize -a 'SERV014-N1-SQLC\Music' 5000 9000
C:\Program Files\NSClient++\scripts\check_sqldbsize.vbs(25, 15) Microsoft VBScript runtime error: Type mismatch: 'cint'
root@serv017:/usr/lib/nagios/plugins#


My Nsclient entry
[/settings/external scripts/scripts]

; Check SQL Database Size
check_sqldbsize=c:\\windows\\system32\\cscript.exe //NoLogo scripts\\check_sqldbsize.vbs $ARG1$ $ARG2$ $ARG3$ $ARG4$


My Command

define command {
command_name check_sqldbsize
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c check_sqldbsize -a $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

My Service

define service {
host_name hostname
service_description SQLDBSize-Music
check_command check_sqldbsize!SERV014-N1-SQLC!Music!8000!9500
check_interval 1440
notification_interval 1440
servicegroups SQL DB Size
check_period backup_period
notification_period backup_period
use generic-service
}

Any ideas?

Thank you

Tom :D
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Nagios Check for SQL Databases Stopped Working

Post by kwhogster »

Please Lock this one as resolved.

Issue was on the SQL Server A while back I had to reinstall SQL and never checked the checks they where all Green.

Had to change SA accounts password to match

Had to give NT AUTHORITY/SYSTEM sysadmin rights in SQL

Checks now working.
Locked