Skip to content
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

Add dmidecode exporter #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ntavares
Copy link
Contributor

@ntavares ntavares commented Mar 7, 2020

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..

Nuno Tavares added 3 commits December 26, 2020 14:16
Signed-off-by: Nuno Tavares <n.tavares@portavita.eu>
Signed-off-by: Nuno Tavares <n.tavares@portavita.eu>
Signed-off-by: Nuno Tavares <n.tavares@portavita.eu>
@ntavares
Copy link
Contributor Author

It's been a while, I've rebased against latest master.

Copy link
Contributor

@SuperQ SuperQ left a 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()) ))
Copy link
Contributor

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()) ))
Copy link
Contributor

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.

Comment on lines +89 to +92
# if os.isatty(sys.stdin.fileno()):
# content = _get_output()
# else:
# content = sys.stdin.read()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants