speed47 / spectre-meltdown-checker

Reptar, Downfall, Zenbleed, ZombieLoad, RIDL, Fallout, Foreshadow, Spectre, Meltdown vulnerability/mitigation checker for Linux & BSD
3.87k stars 476 forks source link

--batch nrpe output shouldn't use colors #233

Closed knweiss closed 6 years ago

knweiss commented 6 years ago
$ spectre-meltdown-checker --batch nrpe
IBPB is considered as a good addition to retpoline for Variant 2 mitigation, but your CPU microcode doesn't support it
Vulnerable: CVE-2018-3640 CVE-2018-3639 CVE-2018-3615/3620/3646

The "IBPB" line is colored red. IMHO color output should be disabled in batch-nrpe-mode (at least our Nagios instance can't show them and displays the escape sequences instead).

speed47 commented 6 years ago

In fact, this line shouldn't appear at all in batch mode: it would also break other batch types (json, etc.). This is meant for human/normal output only. At least it's an easy fix :)

speed47 commented 6 years ago

Actually it's a warn(), so it's sent to stderr. stdout is reserved, in batch mode, for the batch output only. If your monitoring setup merges stdout and stderr, adding 2>/dev/null might do the trick. If you want to keep stderr just in case, and it doesn't confuses your monitoring, I've also added no-color as an implied option to batch mode.

speed47 commented 6 years ago

Assuming the issue is fixed. Please reopen if this is not the case!