Add VulnerabilityStats() to for kernel vulnerabilities#106
Add VulnerabilityStats() to for kernel vulnerabilities#106bobrik wants to merge 3 commits intoprometheus:masterfrom
Conversation
9395f5b to
f1d9ebe
Compare
|
@bobrik @discordianfish shouldn‘t it be 0 or 1 depending if this is mitigated (mitigation) or not (vulnerable). |
|
@mjtrangoni, it's not that simple: I think raw value is a good tradeoff: you want to know what kind of setups you have and possibly alert if mitigation is not what you expect it to be (think slow kernel fix vs fast microcode). |
|
@bobrik I know that, my point was to add value to the metric value itself, leaving your labels as they are, so that you still get the complete string description. For example, the values could be something like, Not affected 0, Mitigation: 1, and Vulnerable: 2. |
|
Thanks a lot for your contribution! The library aims to provide a simple interface towards the procfs/sysfs filesystems. The provided interface should mirror the naming of these filesystems, and take away the burden from go developers to parse the content on their own. The function name should mirror the naming of file system names wherever possible. The full path is quite long, I propose Furthermore, the intent of this library is to take away the burden of parsing the specific file formats and providing idiomatic golang datatypes instead. Therefore, I suggest to return a struct for each vulnerability instead of a map of strings which is not a clear interface. type CPUVulnerability struct {
CodeName string
State string
Mitigation string
}Following the sysfs documentation at https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu, |
See prometheus/node_exporter#1046 Signed-off-by: Ivan Babrou <ibobrik@gmail.com>
f1d9ebe to
4b81faa
Compare
|
I've updated the code. Let me know if that's what you had in mind and I'll work on docs and tests. |
|
Looks like the tests failed due to missing copyright headers. |
|
@bobrik Any chance you can rebase this one on latest master and add the copyright header? |
|
I've created a new PR with these changes rebased on master. |
Store cputime in ticks, not fractional seconds
See prometheus/node_exporter#1046