diff --git a/bin/xymon-vulnerabilities.py b/bin/xymon-vulnerabilities.py index 518eb115e037c1ea988001997ee11d33e6e0a89c..63c422ce66c3e7c8fdf905afea2222176e671101 100755 --- a/bin/xymon-vulnerabilities.py +++ b/bin/xymon-vulnerabilities.py @@ -28,22 +28,28 @@ def red(xymon): def run_check(xymon): + title = 'CPU' + content = [] + for vuln in cpu_vulnerabilities: - title = ''.join([vuln, ': ']) + icon = '&green' vuln_file = Path(''.join([cpu_vulnerabilities_base, vuln])) + if vuln_file.is_file(): with open(str(vuln_file)) as f: - content = '<br/>'.join(f.readlines()) - if content.startswith('Vulnerable'): - title += 'Vulnerable' + lines = '<br>'.join(f.readlines()).rstrip() + + if lines.startswith('Vulnerable'): + icon = '&red' red(xymon) - else: - title += content.split(':')[0] else: - title += 'Potentially Vulnerable' - content = 'Kernel needs update and host reboot' + lines = 'Kernel needs update and host reboot' + icon = '&yellow' yellow(xymon) - xymon.section(title, content) + + content.append(''.join([icon, ' ', vuln, ': ', lines])) + + xymon.section(title, '<br>'.join(content)) def main():