-
Notifications
You must be signed in to change notification settings - Fork 198
Add dmidecode exporter #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Nuno Tavares <[email protected]>
Signed-off-by: Nuno Tavares <[email protected]>
Signed-off-by: Nuno Tavares <[email protected]>
It's been a while, I've rebased against latest master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be worth it to use an existing dmidecode library like https://pypi.org/project/py-dmidecode/
for cpu in _get('processor'): | ||
l = _get_labels(cpu, ['Manufacturer','Family', 'Max Speed', 'Core Count'], ['Not Specified']) | ||
l['index'] = idx | ||
print ('node_dmi_processor{{{}}} 1'.format( ','.join('{}="{}"'.format(k,v) for k,v in l.items()) )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are all info metrics, they should have consistent _info
in the names.
|
||
system = _get('system')[0] | ||
l = _get_labels(system, ['Manufacturer','Product Name', 'Serial Number'], ['Not Specified']) | ||
print ('node_dmi_hardware_info{{{}}} 1'.format( ','.join('{}="{}"'.format(k,v) for k,v in l.items()) )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call this node_dmi_system_info
to match the DMI naming.
# if os.isatty(sys.stdin.fileno()): | ||
# content = _get_output() | ||
# else: | ||
# content = sys.stdin.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code.
This is a script which will generate prometheus metrics from dmidecode output.
Based on https://github.com/huanghao/dmidecode (thanks, was a nice start!)
It was created with "hardware inventory on prometheus" in mind, but can be used to track hardware changes, like failed DIMMs disappearing..