Unable to execute SQL query (with confirmed access)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Unable to execute SQL query (with confirmed access)

Post by dlukinski »

Hello XI support

We've tried configuring this query for monitoring (SQL Query Wizard):

Code: Select all

SELECT DATEDIFF(MINUTE,start_time,GETDATE())
FROM sys.dm_cdc_log_scan_sessions  
WHERE session_id = (SELECT MAX(b.session_id) FROM sys.dm_cdc_log_scan_sessions AS b);  
GO

It is configured against the known instance and DB (many other operational queries), but we get the error message:
- CRITICAL: Could not execute the Query.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unable to execute SQL query (with confirmed access)

Post by cdienger »

Edit the service in the CCM and use the "Run Check Command" to get the full command. Try running the command both here as well as from the command line. Swith to the nagios user before running it from the command line:

Code: Select all

su - nagios
Please provide a screenshot showing the full command and results on the command line.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Unable to execute SQL query (with confirmed access)

Post by dlukinski »

cdienger wrote:Edit the service in the CCM and use the "Run Check Command" to get the full command. Try running the command both here as well as from the command line. Swith to the nagios user before running it from the command line:

Code: Select all

su - nagios
Please provide a screenshot showing the full command and results on the command line.
Same problem (while we could execute same query from SQL managwr with same permissions used)

Code: Select all

[[email protected] ~]$ /usr/local/nagios/libexec/check_mssql -H 10.102.74.196 --username "nagiosxi" --password "checkNAG1" --database Siebeldb --port 1435 --query "SELECT+DATEDIFF%28MINUTE%2Cstart_time%2CGETDATE%28%29%29%0D%0AFROM+sys.dm_cdc_log_scan_sessions++%0D%0AWHERE+session_id+%3D+%28SELECT+MAX%28b.session_id%29+FROM+sys.dm_cdc_log_scan_sessions+AS+b%29%3B++%0D%0AGO++%0D%0A" --decode --warning 50 --critical 200 --querywarning 10 --querycritical 15 --result "Expected result"
CRITICAL: Could not execute the Query.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Unable to execute SQL query (with confirmed access)

Post by cdienger »

A ticket has been opened for this. Locking thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Unable to execute SQL query (with confirmed access)

Post by dlukinski »

This was resolved in the ticket, please close the thread
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Unable to execute SQL query (with confirmed access)

Post by scottwilkerson »

dlukinski wrote:This was resolved in the ticket, please close the thread
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked