icinga2-diagnostics icon indicating copy to clipboard operation
icinga2-diagnostics copied to clipboard

Rewrite in Python

Open widhalmt opened this issue 5 years ago • 14 comments

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?

widhalmt avatar Apr 05 '19 06:04 widhalmt

  • 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

log1-c avatar Apr 05 '19 06:04 log1-c

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

dnsmichi avatar Apr 05 '19 07:04 dnsmichi

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.

widhalmt avatar Apr 05 '19 10:04 widhalmt

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

bsdlme avatar Apr 05 '19 10:04 bsdlme

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.

johanfleury avatar Apr 06 '19 13:04 johanfleury

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 :)

dnsmichi avatar Apr 08 '19 07:04 dnsmichi

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

johanfleury avatar Apr 08 '19 15:04 johanfleury

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

widhalmt avatar Apr 11 '19 20:04 widhalmt

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.

lippserd avatar Apr 23 '19 13:04 lippserd

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

netzwerkgoettin avatar Apr 30 '19 14:04 netzwerkgoettin

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

widhalmt avatar Apr 30 '19 14:04 widhalmt

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

dnsmichi avatar Apr 30 '19 15:04 dnsmichi

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

widhalmt avatar May 01 '19 20:05 widhalmt

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

dnsmichi avatar May 03 '19 09:05 dnsmichi