Bug 52258 - Migrate univention-nagios to Python 3
Migrate univention-nagios to Python 3
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Monitoring (Prometheus or Nagios)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-1-errata
Assigned To: Iván.Delgado
Arvid Requate
: python3-migration
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-26 23:34 CET by Florian Best
Modified: 2021-12-22 14:39 CET (History)
5 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2020-10-26 23:34:05 CET
univention-nagios should be migrated to be Python 3 compatible.
Comment 1 Ingo Steuwer univentionstaff 2021-04-28 10:21:51 CEST
We will replace Nagios with UCS Dashboard enhancements.
Comment 2 Florian Best univentionstaff 2021-04-28 22:55:15 CEST
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
Comment 4 Iván.Delgado univentionstaff 2021-12-20 14:43:28 CET
I have migrated the files as discussed.

547a102212
538ceb8c8f
77223fb95c

univention-nagios: 13.0.2-3A~5.0.0.202112201403
Comment 5 Arvid Requate univentionstaff 2021-12-20 17:39:04 CET
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
Comment 7 Iván.Delgado univentionstaff 2021-12-21 12:58:30 CET
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
Comment 8 Philipp Hahn univentionstaff 2021-12-21 13:37:51 CET
<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.
Comment 9 Iván.Delgado univentionstaff 2021-12-21 15:02:11 CET
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
Comment 10 Arvid Requate univentionstaff 2021-12-21 20:51:25 CET
Verified:
* Code review
* Package update
* Functional tests
* Advisory

Minor adjustment from QA:

e49a3bdfea | Advisory wording