Univention Bugzilla – Bug 52258
Migrate univention-nagios to Python 3
Last modified: 2021-12-22 14:39:55 CET
univention-nagios should be migrated to be Python 3 compatible.
We will replace Nagios with UCS Dashboard enhancements.
But we are still shipping the nagios client code, which is Python 2.7: usr/lib/nagios/plugins/check_univention_i2o_raid:#!/usr/bin/python2.7 usr/lib/nagios/plugins/check_univention_nfsstatus:#!/usr/bin/python2.7 usr/lib/nagios/plugins/check_univention_replication:#!/usr/bin/python2.7 usr/lib/nagios/plugins/check_univention_slapd_mdb_maxsize:#!/usr/bin/python2.7 usr/lib/nagios/plugins/check_univention_ssl_certificate:#!/usr/bin/python2.7
I have migrated the files as discussed. 547a102212 538ceb8c8f 77223fb95c univention-nagios: 13.0.2-3A~5.0.0.202112201403
I'm unsure if this is a regression: root@primary20:~# /usr/lib/nagios/plugins/check_univention_replication OK: replication complete (nid=14856 lid=14856) ## Takes long, but runs ok. root@primary20:~# /usr/lib/nagios/plugins/check_univention_replication Traceback (most recent call last): File "/usr/lib/nagios/plugins/check_univention_replication", line 222, in <module> obj.main() File "/usr/lib/nagios/plugins/check_univention_replication", line 155, in main self.load_history() File "/usr/lib/nagios/plugins/check_univention_replication", line 84, in load_history cnt = pickle.load(fd) File "/usr/lib/python3.7/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
I've fixed the issue on check_univention_replication 07ebe2c9f5 8825d7335f eeb4f75693 547a102212 538ceb8c8f 77223fb95c e7a0c0af68 4f0e5b792a 907b0bef94 univention-nagios 13.0.2-4A~5.0.0.202112211251
<https://git.knut.univention.de/univention/ucs/-/commit/eeb4f75693b3e8781aa52553347bd68b76ba283e> > - with open(self.CACHEFN) as fd: > + with open(self.CACHEFN, "wb") as fd: "w" is for *w*riting, which truncates any existing file to size 0 bytes. You want "rb" for *r*eading *b*inary.
I've fixed the issue on check_univention_replication af1595525e dcd3ca939f 07ebe2c9f5 8825d7335f eeb4f75693 547a102212 538ceb8c8f 77223fb95c e7a0c0af68 4f0e5b792a 907b0bef94 univention-nagios 13.0.2-5A~5.0.0.202112211458
Verified: * Code review * Package update * Functional tests * Advisory Minor adjustment from QA: e49a3bdfea | Advisory wording
<https://errata.software-univention.de/#/?erratum=5.0x177>