SQL check thesholds are not working correclty

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

SQL check thesholds are not working correclty

Post by dlukinski »

Hello XI support

We've got Out of the box SQL checks configured, but thresholds we've set do not seem to work.

Example 1

CONFIGURED: -U 'qqqq' -P 'qqqq' -I 'FIKCALFCLDB01S1' --averagewait --warning 9000 --critical 10000
OUTPUT: CRITICAL: Average Wait Time (ms) is 8885.50470195ms


Example 2

CONFIGURED: -U 'qqqq -P 'qqqq' -I 'FIKCALFCLDB01S1' --batchreq --warning 3000 --critical 5000
OUTPUT: CRITICAL: Batch Requests / Sec is 1402.27076641/sec


Example 3

CONFIGURED: -U 'qqqq' -P 'qqqqq' -I 'FIKCALFCLDB01S1' --databasepages --warning 20000000 --critical 25000000
OUTPUT: CRITICAL: Database pages are 24924714.0
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SQL check thesholds are not working correclty

Post by scottwilkerson »

Which SQL plugins are you using for these?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: SQL check thesholds are not working correclty

Post by dlukinski »

scottwilkerson wrote:Which SQL plugins are you using for these?
Nagios XI out of the box (for SQL server/instance)
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: SQL check thesholds are not working correclty

Post by cdienger »

Looks like you may have a bad 'box'. I've tested on a 5.6.14 version and it seems to work as expected. What 'box' did you get? Is this an OVA, rpm, or source intall? What version of XI and what version of the plugin? You're using check_mssql_server.py, correct?
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: SQL check thesholds are not working correclty

Post by dlukinski »

cdienger wrote:Looks like you may have a bad 'box'. I've tested on a 5.6.14 version and it seems to work as expected. What 'box' did you get? Is this an OVA, rpm, or source intall? What version of XI and what version of the plugin? You're using check_mssql_server.py, correct?
Nagios OVA. Version 5.6.14; Wizard version 1.9.2 , check_mssql_server.py
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: SQL check thesholds are not working correclty

Post by ssax »

This is a bug.

Please change this code (around line 428):

Code: Select all

    actions = [ (r'^%s$' % first_float,lambda y: (value > float(y.group('first'))) or (value < 0)),
                (r'^%s:$' % first_float,lambda y: value < float(y.group('first'))),
                (r'^~:%s$' % first_float,lambda y: value > float(y.group('first'))),
                (r'^%s:%s$' % (first_float,second_float), lambda y: (value < float(y.group('first'))) or (value > float(y.group('second')))),
                (r'^@%s:%s$' % (first_float,second_float), lambda y: not((value < float(y.group('first'))) or (value > float(y.group('second')))))]
To this:

Code: Select all

    actions = [ (r'^%s$' % first_float,lambda y: (float(value) > float(y.group('first'))) or (value < 0)),
                (r'^%s:$' % first_float,lambda y: float(value) < float(y.group('first'))),
                (r'^~:%s$' % first_float,lambda y: float(value) > float(y.group('first'))),
                (r'^%s:%s$' % (first_float,second_float), lambda y: (float(value) < float(y.group('first'))) or (float(value) > float(y.group('second')))),
                (r'^@%s:%s$' % (first_float,second_float), lambda y: not((float(value) < float(y.group('first'))) or (float(value) > float(y.group('second')))))]
Then try again.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: SQL check thesholds are not working correclty

Post by dlukinski »

ssax wrote:This is a bug.

Please change this code (around line 428):

Code: Select all

    actions = [ (r'^%s$' % first_float,lambda y: (value > float(y.group('first'))) or (value < 0)),
                (r'^%s:$' % first_float,lambda y: value < float(y.group('first'))),
                (r'^~:%s$' % first_float,lambda y: value > float(y.group('first'))),
                (r'^%s:%s$' % (first_float,second_float), lambda y: (value < float(y.group('first'))) or (value > float(y.group('second')))),
                (r'^@%s:%s$' % (first_float,second_float), lambda y: not((value < float(y.group('first'))) or (value > float(y.group('second')))))]
To this:

Code: Select all

    actions = [ (r'^%s$' % first_float,lambda y: (float(value) > float(y.group('first'))) or (value < 0)),
                (r'^%s:$' % first_float,lambda y: float(value) < float(y.group('first'))),
                (r'^~:%s$' % first_float,lambda y: float(value) > float(y.group('first'))),
                (r'^%s:%s$' % (first_float,second_float), lambda y: (float(value) < float(y.group('first'))) or (float(value) > float(y.group('second')))),
                (r'^@%s:%s$' % (first_float,second_float), lambda y: not((float(value) < float(y.group('first'))) or (float(value) > float(y.group('second')))))]
Then try again.
Did not work (could you attach/email full plugin file?):

(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mssql_server.py", line 432
for regstr,func in actions:
^
IndentationError: unexpected indent
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: SQL check thesholds are not working correclty

Post by ssax »

I'm not sure if that's the fix but just try this one and see if it works (see attached).
You do not have the required permissions to view the files attached to this post.
Locked