ceph / ceph-nagios-plugins

Nagios plugins for Ceph
Apache License 2.0
81 stars 80 forks source link

Fixed check_ceph_osd for Ceph Octopus. #83

Open HeroesLament opened 2 years ago

HeroesLament commented 2 years ago

Removed unnecessary parentheses for Python 3, fixed regex variable import, and added a loop to the print statements to properly format the aggregate OSD states.

The findall regex function of python3 outputs a tuple when searching for multiple statements. This is in contrast to prior versions which output an array of strings, requiring us to loop through joining the tuples prior to printing.

valerytschopp commented 2 years ago

Hello @HeroesLament, The parentheses in the print statements are NOT optional. In python3 it is mandatory, print(...) is a function call... Example:

Python 3.9.10 (main, Jan 15 2022, 11:48:00) 
>>> print "hello world!"
  File "<stdin>", line 1
    print "hello world!"
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("hello world!")?
HeroesLament commented 2 years ago

Hello @valerytschopp ,

The work our team was doing on this was apparently not on track. The server this was being worked on was running python 2.7, so much of the syntax was not correct. We are working to re-factor this with python 3.8 now.