MSSQL DB free space monitor?!

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

MSSQL DB free space monitor?!

Post by xpertech »

Using command check_mssql_database.py to monitor remote MSSQL Server, but the reported value didn't match with DB space?!
You do not have the required permissions to view the files attached to this post.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL DB free space monitor?!

Post by slansing »

It is 511MB off, is it possible 5011MB were added in the time it took you to take both screenshots?
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: MSSQL DB free space monitor?!

Post by xpertech »

The second screenshot was immediately taken after the first one, the DB will not increase 500MB in that little time.
Just wondering how check_mssql_database.py calculate the value?
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: MSSQL DB free space monitor?!

Post by yancy »

xpertech,

Allocated Space - Free Space = Total used
6659MB - 6039MB = 620MB

Plugin calculated space looks like 6294528KB / 1024 = 5527MB

This is a huge difference if i'm doing my math right...

I'll test this on one of our databases to see if I get similar results.

-Yancy
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: MSSQL DB free space monitor?!

Post by yancy »

Code: Select all

with fs
as
(
    select database_id, type, size * 8.0 size
    from sys.master_files
)
select 
    name,
    (select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeKB,
    (select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeKB
from sys.databases db

Can you run the following and verify size is accurate.

-Yancy
xpertech
Posts: 399
Joined: Thu Sep 01, 2011 9:47 pm

Re: MSSQL DB free space monitor?!

Post by xpertech »

yancy wrote:

Code: Select all

with fs
as
(
    select database_id, type, size * 8.0 size
    from sys.master_files
)
select 
    name,
    (select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeKB,
    (select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeKB
from sys.databases db

Can you run the following and verify size is accurate.

-Yancy

We execute that MSSQL command, the displayed value was matched with the DB's GUI properties. So, how the check_mssql_database.py calculate the space?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL DB free space monitor?!

Post by slansing »

You may want to look into the resolution listed in the comments section of the plugin here:

http://exchange.nagios.org/directory/Pl ... ts/details

It looks like Willem ran into the same issue with the plugin and made a manual change.
Locked