Page 1 of 1

SQL check thesholds are not working correclty

Posted: Fri May 15, 2020 9:42 am
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

Re: SQL check thesholds are not working correclty

Posted: Fri May 15, 2020 2:28 pm
by scottwilkerson
Which SQL plugins are you using for these?

Re: SQL check thesholds are not working correclty

Posted: Fri May 15, 2020 4:14 pm
by dlukinski
scottwilkerson wrote:Which SQL plugins are you using for these?
Nagios XI out of the box (for SQL server/instance)

Re: SQL check thesholds are not working correclty

Posted: Mon May 18, 2020 4:33 pm
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?

Re: SQL check thesholds are not working correclty

Posted: Tue May 19, 2020 10:14 am
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

Re: SQL check thesholds are not working correclty

Posted: Tue May 19, 2020 4:50 pm
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.

Re: SQL check thesholds are not working correclty

Posted: Wed May 20, 2020 10:35 am
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

Re: SQL check thesholds are not working correclty

Posted: Wed May 20, 2020 4:21 pm
by ssax
I'm not sure if that's the fix but just try this one and see if it works (see attached).