Page 1 of 2

Check File SQL error

Posted: Tue Jul 31, 2018 9:31 am
by wspackaging
recently upgraded to 5.5.2 and I started getting this error doing a file count.

2018-07-26 15:23:19: debug:CACHENSClient++.cpp:557: Attempting to start NSCLient++ - 0.3.9.328 2011-08-16
2018-07-26 15:23:19: message:CACHEmodules\FileLogger\FileLogger.cpp:87: Log path is: C:\Program Files\NSClient++\\nsclient.log
2018-07-26 15:23:19: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 15:26:01: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 15:38:18: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 15:41:00: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 15:53:16: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 15:55:57: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 16:08:15: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 16:10:56: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 16:23:13: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.
2018-07-26 16:25:54: error:modules\NRPEListener\NRPEListener.cpp:317: Exception handling NRPE packet: Invalid packet version.

When I try to do "Run Check Command" from CCM I get:
SQL Error [nagiosxi] : ERROR: syntax error at or near "D"
LINE 1: ...pe -H 10.100.32.120 -t 30 -c CheckFiles -a path=\'D:\\\\Dell...
^

[nagios@dc1ux086 ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.100.32.120 -t 30 -c CheckFiles -a path='D:\\Dell\\ArchiveManager\\Error' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=2000 MaxCrit=5000 'filter=size gt 0b'
Error submitting command.

Any suggestions?
-pete

Re: Check File SQL error

Posted: Tue Jul 31, 2018 2:02 pm
by lmiltchev
Does adding the "-2" flag to your command help?

Example:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -2 -H 10.100.32.120 -t 30 -c CheckFiles -a path='D:\\Dell\\ArchiveManager\\Error' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=2000 MaxCrit=5000 'filter=size gt 0b'
For more info on the issue, see our NRPE - Packet Size Explained KB article here:

https://support.nagios.com/kb/article/n ... d-518.html

Re: Check File SQL error

Posted: Tue Jul 31, 2018 3:42 pm
by wspackaging
running the suggested command from the CLI with the -2 I get this error.

[root@dc1ux086 ~]# /usr/local/nagios/libexec/check_nrpe -2 -H 10.100.32.120 -t 30 -c CheckFiles -a path='D:\\Dell\\ArchiveManager\\Error' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=2000 MaxCrit=5000 'filter=size gt 0b'
Could not construct return packet in NRPE handler check client side (nsclient.log) logs...


-pete

Re: Check File SQL error

Posted: Tue Jul 31, 2018 4:44 pm
by lmiltchev
Can you post the nsclient.log and nsclient.ini files on the forum? Please remove/obfuscate sensitive data.

Re: Check File SQL error

Posted: Wed Aug 01, 2018 2:45 pm
by wspackaging
there is no nsclient.ini file. I'm assuming it is the NSC.ini file.
I attached both files
-pete

Re: Check File SQL error

Posted: Wed Aug 01, 2018 4:08 pm
by lmiltchev
You version of NSClient++ agent is very old. I don't think you can use it with NRPE v.3. I would recommend upgrading your NSClient++ agent to the latest stable version. Make a backup of the NSC.ini file prior to the upgrade in case you have some custom commands.

FYI, I don't even know how this check used to work on the first place. You are not allowing the use of arguments with NRPE...

Code: Select all

;allow_arguments=0
;allow_nasty_meta_chars=0
I can see the following entry in the nsclient.log:
2018-07-31 15:39:52: error:modules\NRPEListener\NRPEListener.cpp:422: Request contained arguments (not currently allowed, check the allow_arguments option).
Also, you have the use+ssl line commented out:

Code: Select all

;use_ssl=1
which may be OK if ssl is enabled by default - I don't remember if it is in ver. 0.3.9.

Once you install the new version of NSClient++, use the following document to enable the NRPE Listener:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Restart the NSClient++ service and test your check again.

On my test machine, I have the following entries under the [/settings/NRPE/server] section:

Code: Select all

insecure = true
use ssl = 1
allow nasty characters = 1
allow arguments = 1
port = 5666
extended response = 0
allowed ciphers = ALL:!MD5:@STRENGTH
verify mode = none
which works fine for me.

Hope this helps.

Re: Check File SQL error

Posted: Wed Aug 01, 2018 4:26 pm
by rexconsulting
Note that there are a lot of syntax differences between NSClient++ 0.3.x and 0.4.x and greater, so do run this through your testing environment first!

Re: Check File SQL error

Posted: Wed Aug 01, 2018 4:55 pm
by lmiltchev
@rexconsulting, good call! Yes, there are many differences. Even the name of the config file is different - NCS.ini vs nsclient.ini. :)

Upgrading the agent is a "must" though. 0.3.9 is really too old and buggy.

Re: Check File SQL error

Posted: Fri Aug 03, 2018 3:14 pm
by wspackaging
upgraded the client. Ran through the supplied documentations.

when I run a check as root from the Nagios server to the windows clients I get:
root@dc1ux086 libexec]# ./check_nrpe -H dc1ms032120
CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with 10.100.32.120: 1


I attached the new nsclient++.ini file and the new log

Thanks for your help on this
-pete

Re: Check File SQL error

Posted: Fri Aug 03, 2018 4:25 pm
by lmiltchev
Try the following:

1. Commend out these two lines in nsclient.ini file:

Code: Select all

; ssl options = no-sslv2,no-sslv3
; verify mode = peer-cert
2. Add the following line under the [/settings/NRPE/server] section:

Code: Select all

allowed ciphers = ALL:!MD5:@STRENGTH
3. Save, exit, and restart the nsclient++ service.

Did this help?