mirror of
https://github.com/bashclub/checkmk-monitoring-plugins.git
synced 2024-11-07 18:01:58 +01:00
24 lines
672 B
Python
24 lines
672 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# Prints the debian/ubuntu release info and sets state by codename
|
|
# The package 'lsb-release' is required for this check.
|
|
|
|
import subprocess
|
|
|
|
ok_list = ['bullseye', 'bookworm', 'trixie', 'forky', 'jammy', 'focal']
|
|
warn_list = ['buster', 'bionic', 'xenial']
|
|
|
|
cmd = ["/usr/bin/lsb_release", "-ircs"]
|
|
|
|
stdout, stderr = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
|
|
dist, version, codename, null = stdout.decode('utf-8').split('\n')
|
|
|
|
if codename in ok_list:
|
|
state = 0
|
|
elif codename in warn_list:
|
|
state = 1
|
|
else:
|
|
state = 2
|
|
|
|
print ('%s "Distribution Info" - %s %s %s' % (state, dist, version, codename))
|