MS SQL Express database size

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

MS SQL Express database size

Post by DennisPR »

Hi,

I'm having trouble using Nagios XI to read the SQL Express database size through nsclient perfmon counters.
I have already thried the following without succes

Code: Select all

[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\$SQLEXPRESS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
Total DB Size is 0 KB | 'Total DB Size is %.0f KB'=0.000000%;10000000.000000;15000000.000000;
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\$SQLEXPRESS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\\$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
Total DB Size is 0 KB | 'Total DB Size is %.0f KB'=0.000000%;10000000.000000;15000000.000000;
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\\$$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\\\$$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL\\\$$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
Total DB Size is 0 KB | 'Total DB Size is %.0f KB'=0.000000%;10000000.000000;15000000.000000;
[root@MYNAGIOS tmp]# /usr/local/nagios/libexec/check_nt -H MYSQLSRVIP -s "MYPWD" -p 12489 -v COUNTER -l "\\\\MSSQL$SQLEXPRSS:Databases\(_Total\)\\\\Data File\(s\) Size \(KB\)","Total DB Size is %.0f KB"  -w 10000000 -c 15000000
could not fetch information from server
Can someone help me out pls ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: MS SQL Express database size

Post by lmiltchev »

Most probably this is an escaping issue. Can you right-click on the perf counter in the "Performance Monitor" window, and post a screenshot, showing the exact name of the counter (under the "Data" tab)? Example:
example01.PNG
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: MS SQL Express database size

Post by tgriep »

Here is a example I found for checking SQL Database Data Files Size (Total)

command_line $USER1$/check_nt -H $HOSTADDRESS$ -s password -p 12489 -v COUNTER -l "\\SQLServer:Databases(_Total)\\Data File(s) Size (KB)","SQL Server Databases Datafile size total is %.f" -w 5 -c 30

Try it out and let us know if you are still having problems.
Be sure to check out our Knowledgebase for helpful articles and solutions!
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: MS SQL Express database size

Post by DennisPR »

Hi lmiltchev,

Here is the screenshot :
perfmon.PNG
Hi tgriep

The example you found is what I use to monitor the size of SQL Standard databases
The SQL Express seems to use another syntax, probably because of the named instance.
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: MS SQL Express database size

Post by tgriep »

Here is the check_nt command I just tested and it works, but I had to restart the NSClient++ service on the PC that the SQL database is running on.

This is the command that I used in NagiosXI
-l "\MSSQL$"$"SQLEXPRESS:Databases(_Total)\Data File(s) Size (KB)","Total DB Size is %.f KB" -w 10000000 - c 15000000

If you want to run it from the command line, you will have to change it to add more escaping. See the next line. Note the double back slashes.
/usr/local/nagios/libexec/check_nt -H 192.168.5.223 -s "password" -p 12489 -v COUNTER -l "\\MSSQL$"$"SQLEXPRESS:Databases(_Total)\\Data File(s) Size (KB)","Total DB Size is %.f KB" -w 10000000 -c 15000000

Try it out and post back if it works or not.
Be sure to check out our Knowledgebase for helpful articles and solutions!
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: MS SQL Express database size

Post by DennisPR »

Works like a charm, thx !!
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: MS SQL Express database size

Post by cmerchant »

Glad that worked for you. We'll go ahead and close. Thanks.
Locked