Page 1 of 1
NCPA agent status prepends the letter b
Posted: Thu Nov 12, 2020 10:54 am
by paul_kessler
I am running Nagios XI 5.7.4 and monitoring a Windows 2016 server with the NCPA 2.2.2 client. After I add the host using thw Windows Server Wizard and force all checks the status reports with the letter "b" prepended.
Example: b"WARNING: Used disk space was 73.30 % (Used: 72.88 GiB, Free: 26.61 GiB, Total: 99.49 GiB)
If I run the checks manually on the command line I get the same result for the display response. Has anyone else seen this?
Re: NCPA agent status prepends the letter b
Posted: Thu Nov 12, 2020 3:31 pm
by dchurch
I was unable to reproduce it, but there's evidence that it's being shown because somewhere along the line, Python3 is outputting it. Python2 won't output it.
You can see this behavior in action:
Code: Select all
$ python3 -c 'print(b"hello")'
b'hello'
$ python2 -c 'print(b"hello")'
hello
It's likely due to a bug in a Python script. Possibly because it glues a Unicode string and a byte string together into a byte string.
What's the full output of the following two commands?
Code: Select all
python3 /usr/local/nagios/libexec/check_ncpa.py --H YOUR-WINDOWS-IP-HERE -t '1234' -P 5693 -M 'disk/logical/C:|' -w '70' -c '90'
Code: Select all
python2 /usr/local/nagios/libexec/check_ncpa.py --H YOUR-WINDOWS-IP-HERE -t '1234' -P 5693 -M 'disk/logical/C:|' -w '70' -c '90'
I know some of the plugins have problems running under Python 3, so if you're using it as your default interpreter
/usr/bin/python, it'll improve compatibility if you set it back to
python2.