Summary: | После перехода на python3 плагин check_monit.py не работает | ||
---|---|---|---|
Product: | Sisyphus | Reporter: | anton |
Component: | nagios-plugins-check_monit | Assignee: | mrdrew <mrdrew> |
Status: | CLOSED FIXED | QA Contact: | qa-sisyphus |
Severity: | normal | ||
Priority: | P3 | CC: | lav, mrdrew |
Version: | unstable | ||
Hardware: | all | ||
OS: | Linux |
Description
anton
2019-10-29 18:23:56 MSK
nagios-plugins-check_monit-1.4-alt2 -> sisyphus: Tue Oct 29 2019 Andrey Bychkov <mrdrew@altlinux> 1.4-alt2 - py2 -> py3 (Closes #37396) Спасибо, проверил новую версию плагина. Python3 проходит холостую проверку: # /usr/lib/nagios/plugins/check_monit.py Usage: check_monit.py -H <host> [<options>] check_monit.py: error: No <host> defined! Но вот рабочий запрос - выдает ошибку: # /usr/lib/nagios/plugins/check_monit.py -H localhost -u monit -P password_here /usr/lib/nagios/plugins/check_monit.py:104: DeprecationWarning: encodestring() is a deprecated alias since 3.1, use encodebytes() headers['Authorization'] = 'Basic ' + (base64.encodestring(opts.username + ':' + opts.password)).strip() Traceback (most recent call last): File "/usr/lib64/python3.7/base64.py", line 510, in _input_type_check m = memoryview(s) TypeError: memoryview: a bytes-like object is required, not 'str' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/nagios/plugins/check_monit.py", line 287, in <module> main() File "/usr/lib/nagios/plugins/check_monit.py", line 268, in main process_monit_response(get_status()) File "/usr/lib/nagios/plugins/check_monit.py", line 104, in get_status headers['Authorization'] = 'Basic ' + (base64.encodestring(opts.username + ':' + opts.password)).strip() File "/usr/lib64/python3.7/base64.py", line 540, in encodestring return encodebytes(s) File "/usr/lib64/python3.7/base64.py", line 527, in encodebytes _input_type_check(s) File "/usr/lib64/python3.7/base64.py", line 513, in _input_type_check raise TypeError(msg) from err TypeError: expected bytes-like object, not str Не имеет значения, правильный пароль указан или нет. Версии программ последние: # apt-cache policy python3 python3: Установлен: 3.7.4-alt2:sisyphus+239418.100.1.1@1571389791 Кандидат: 3.7.4-alt2:sisyphus+239418.100.1.1@1571389791 # apt-cache policy monit monit: Установлен: 5.26.0-alt1:sisyphus+234023.100.1.1@1562442242 Кандидат: 5.26.0-alt1:sisyphus+234023.100.1.1@1562442242 |