Icinga / icinga2-diagnostics

Shell script for analyzing Icinga 2 installations.
GNU General Public License v3.0
26 stars 9 forks source link

Rewrite in Python #74

Open widhalmt opened 5 years ago

widhalmt commented 5 years ago

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:

log1-c commented 5 years ago
dnsmichi commented 5 years ago

Hi,

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 commented 5 years ago

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 commented 5 years ago

For FreeBSD:

johanfleury commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

lippserd commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

widhalmt commented 5 years ago

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

dnsmichi commented 5 years ago

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