Hi,
I am trying to monitor the current free space of a database to keep a tab on database growth.
But it seems I am unable to run query's for some reason. I have created a service user on the database itself and I am not using any special characters in the password as I have seen this may cause an issue.
When i test without a query it connects
When i add my query it fails
The query I am trying to run is:
SELECT DB_NAME() AS DbName,
name AS FileName,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files;
I have tested the query and it runs just fine. Permissions should not be an issue either. Firewall disabled. Any ideas what I am doing wrong?
Problems with check_xi_mssql_query
Problems with check_xi_mssql_query
You do not have the required permissions to view the files attached to this post.
Re: Problems with check_xi_mssql_query
The test check command isn't the best as it escapes things differently than an organic Nagios check would. If you let it run it's full course, does it work?
If not, please post the full check_command for us to look at. It might just be a matter of quotes, but without seeing exactly how you have it setup we're a bit limited.
If not, please post the full check_command for us to look at. It might just be a matter of quotes, but without seeing exactly how you have it setup we're a bit limited.
Former Nagios Employee
Re: Problems with check_xi_mssql_query
Tried running it but it gives the same result as before.
Here is the full check_command
Here is the full check_command
Code: Select all
check_xi_mssql_query--username 'username' --password 'password' --database database --instance instance --query "SELECT+DB_NAME%28%29+AS+DbName%2C+%0D%0Aname+AS+FileName%2C+%0D%0Asize%2F128.0+AS+CurrentSizeMB%2C+%0D%0Asize%2F128.0+-+CAST%28FILEPROPERTY%28name%2C+%27SpaceUsed%27%29+AS+INT%29%2F128.0+AS+FreeSpaceMB+%0D%0AFROM+sys.database_files%3B"
Re: Problems with check_xi_mssql_query
Please click the Test Check Command button and copy the full command and run it from the command line of the XI server to see if it works that way, make sure to "su - nagios" before running it.
Thank you
Thank you
Re: Problems with check_xi_mssql_query
Hi,
Got the same result when running it from cmd line.
Got the same result when running it from cmd line.
You do not have the required permissions to view the files attached to this post.
Re: Problems with check_xi_mssql_query
Are you using a SQL account to authenticate, or a domain account?
Former Nagios Employee
Re: Problems with check_xi_mssql_query
sql account
Re: Problems with check_xi_mssql_query
Are you seeing any errors on the MSSQL server for that account?
Can you login to the nagios server using the nagios user account on the server, then run the check to see if it still fails?
Can you login to the nagios server using the nagios user account on the server, then run the check to see if it still fails?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Problems with check_xi_mssql_query
Not seeing any errors on that user, and tried manual login and running the query with the same user and it works as it should.
I also tested this with PRTG and it works as intended, but I would rather it worked with Nagios.
Still fails when running from server :/
I also tested this with PRTG and it works as intended, but I would rather it worked with Nagios.
Still fails when running from server :/
Re: Problems with check_xi_mssql_query
What version of the plugin is installed on your server?
Run the following command and post the output.
Thanks
Run the following command and post the output.
Code: Select all
/usr/local/nagios/libexec/check_mssql -VBe sure to check out our Knowledgebase for helpful articles and solutions!