Skip to content

Commit

Permalink
Change check for version to Icinga 2 internal version check from usin…
Browse files Browse the repository at this point in the history
…g package manager

helps with #93
  • Loading branch information
widhalmt committed Nov 7, 2019
1 parent 0c006ea commit 45f8927
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions icinga-diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ def __init__(self):
class Icingainstance:
def __init__(self):
try:
self.version = str(subprocess.check_output(["rpm","-q","icinga2"]))
versionoutput = subprocess.check_output(["icinga2","--version"]).splitlines()
for line in versionoutput:
if "Icinga 2 network monitoring daemon" in line:
self.version = str(line.split(':')[1].split('-')[0])
except:
print("Icinga 2 is not installed")
self.version = "Not installed"

# print header

Expand Down Expand Up @@ -86,7 +89,4 @@ def __init__(self):

icingacore = Icingainstance()

try:
print("Icinga 2: " + icingacore.version)
except AttributeError:
print("Icinga2 not installed")
print("Icinga 2: " + icingacore.version)

0 comments on commit 45f8927

Please sign in to comment.