Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite in Python #74

Open
widhalmt opened this issue Apr 5, 2019 · 14 comments
Open

Rewrite in Python #74

widhalmt opened this issue Apr 5, 2019 · 14 comments
Labels

Comments

@widhalmt
Copy link
Member

widhalmt commented Apr 5, 2019

Should we do a complete rewrite in Python?

Some users suggested that a python Version of this script might be more powerful and easier to maintain. Our main goal is to allow to run icinga diagnostics with as less hassle as possible on all platforms that run Icinga. Even those not officially supported.

So what we need from you as part of the community:

  • Would you be ok with a python script?
  • Can it run on the OS you are using for Icinga?
  • Which version of Python do you have on your Icinga hosts?
@log1-c
Copy link

log1-c commented Apr 5, 2019

  • Would you be ok with a python script?
    -- yes
  • Can it run on the OS you are using for Icinga?
    -- yes, ubuntu & centOS for me
  • Which version of Python do you have on your Icinga hosts?
    -- 2.7.15 (Ubuntu18), 2.7.12 (Ubuntu16), 2.7.? CentOS 7

@dnsmichi
Copy link

dnsmichi commented Apr 5, 2019

Hi,

  • DEV knows a lot of Python, so yes.
  • Since el5 und sles11 are EOL, you can expect Python 2.7 at least. Windows is a different story, but you may get things done there too.
  • Python 2.7 is EOL but available in el7, sles12, Ubuntu/Debian.

I would write it in a way that it runs on Python 2 and 3. There are some language differences with dictionary iterators, but nothing which cannot be solved. If you need a good book, I have one on my desk - Head first Python.

I'd also suggest to move certain parts into libraries and packages, and use setup.py to create a package / pip package. I've done that with Pretix plugins already. That way you can point your users to 1) a release tarball on GitHub 2) Pypi pip install.

If you want, let's discuss this on Monday. I also want to deprecate icinga2 troubleshoot as CLI command.

Cheers,
Michael

@widhalmt
Copy link
Member Author

widhalmt commented Apr 5, 2019

Ok, thanks for the input. I asked the community to join the conversation so we can keep Diagnostics available on all OSes people run Icinga on.

One side note from an ops point of view: I would only release it via pip if that can make package building easier. I would never suggest that someone has to install it via pip. So either an easy to use tarball (especially for non-standard-os) or, much better, packages in the Icinga repository.

@bsdlme
Copy link
Contributor

bsdlme commented Apr 5, 2019

For FreeBSD:

  • Would you be ok with a python script?
    Sure
  • Can it run on the OS you are using for Icinga?
    Yes
  • Which version of Python do you have on your Icinga hosts?
    2.7 and 3.6 are the default versions in FreeBSD ports

@johanfleury
Copy link

I'm not a user of icinga2-diagnostics, but I think you shouldn't focus on supporting both Python 2 and 3 as Python 2.7 is 10 years, is EOL and won't be maintained after the end of this year and Python 3 is available pretty much everywhere.

@dnsmichi
Copy link

dnsmichi commented Apr 8, 2019

The problem I can see: RHEL7 and other ELs are here for the next years, and they cannot simply switch from 2 to 3.

If a user must install python3 in order to run a diagnostics script, feels wrong. Especially since none of the other products enforces this already.

PHP via icingacli would be a slightly better option, poke @lippserd and @Thomas-Gelf about it :)

@johanfleury
Copy link

I don't know RHEL very well, but it seems to only be a matter of activating some repositories and install python3 with yum.

@widhalmt
Copy link
Member Author

@johanfleury yes, but that's a lot for just enabling a simple diagnostics tool which main focus is to be easily usable.

@lippserd
Copy link
Member

If we rewrite this in Python, we must be version 2-3 compatible. It is not much of an effort to do so. We could also consider the Web and CLI (PHP) option. Though I'm unsure what to do with satellites and agents which may not have PHP installed. We already have icingacli as a separate package but it is not fully independent from Web at the moment if I remember correctly. Python is just there.

@netzwerkgoettin
Copy link

Hi,

Python shipped via OpenIndiana (openindiana.org).

$ uname -a
SunOS zfs-2011 5.11 illumos-9c7c0c4b59 i86pc i386 i86pc
$ python --version
Python 2.7.15

HTH,
Marianne

@widhalmt
Copy link
Member Author

Oracle Solaris 11.1 X86

# python --version
Python 2.6.8

Raspbian GNU/Linux 9 (stretch)

# python --version
Python 2.7.13

Debian GNU/Linux 9 (stretch)

# python --version
Python 2.7.13

CentOS release 6.10 (Final)

# python --version
Python 2.6.6

CentOS Linux release 7.6.1810 (Core)

# python --version
Python 2.7.5

Fedora release 30 (Thirty)

# python --version 
2.7.16

@dnsmichi
Copy link

Python 2.6 shouldn't be too hard, if you have CI jobs for PRs.

@widhalmt
Copy link
Member Author

widhalmt commented May 1, 2019

@dnsmichi I'm counting on you to give me some hints for that. ;-)

@dnsmichi
Copy link

dnsmichi commented May 3, 2019

Just something like this, which runs the script after a short icinga2 installation for instance.
https://docs.travis-ci.com/user/languages/python/

widhalmt added a commit that referenced this issue Nov 7, 2019
@widhalmt widhalmt added the Python Rewrite in Python label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants