-
Notifications
You must be signed in to change notification settings - Fork 8
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
Create smartctl plugin to get disk status #37
Conversation
Signed-off-by: Cécile MORANGE <contact@ataxya.net>
Signed-off-by: AtaxyaNetwork <contact@ataxya.net>
So I have created 2 scripts for 2 usage:
Each script return a json sting, which can be parsed by XO (for example :D) To call the script:
I'm not a dev, so, my code may be bad, don't hesitate to change/review/rm -rf it ! :) |
Reminder: smartmontools must be in version >7 (can be installed with repo base) |
XCP-ng 8.3 will have smartmontools 7, so json output will be available. Regarding this PR, the first obvious thing I see is this should be a single plugin with two functions, rather than two separate plugins. Update: I'd name the plugin simply |
Signed-off-by: Cécile MORANGE <contact@ataxya.net>
I just pushed the change you suggested!
|
@AtaxyaNetwork can you also update the README.md with examples and provides a unit test? |
@AtaxyaNetwork , for unit test you can have a look to https://github.com/xcp-ng/xcp-ng-xapi-plugins/blob/master/tests/test_hyperthreading.py |
…ss things Signed-off-by: Cécile MORANGE <contact@ataxya.net>
All suggested changes are pushed, I just need to do the unit testing |
Signed-off-by: Cécile MORANGE <contact@ataxya.net>
Suggested changes are pushed, with the unit testing. Thanks @gthvn1, for the help ! |
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.
Just a minor typo. Otherwise, looks good to me, to the condition that someone tested/tests the error handling (and if you have leads to have it unit-tested or "xcp-ng-tests"-tested, even better).
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.
LGTM after addressing @stormi typo comment.
I tested manually and if
If smartctl returns a value that is different than 0 it is reported as well:
I'm looking to add this in unittest... |
Signed-off-by: Cécile MORANGE <contact@ataxya.net>
My last idea is to have a plugin to parse smartctl status to retrieve disk health
I tested a few things weeks ago, and I found smartctl can output a json, which is better for parsing.
Output is like this:
Unfortunalty, --json is only available on version 7
On XCP-ng 8.2.1, I'm in 6.5
So my question is: it's possible to ship smartctl version 7 in XCP-ng ? I tried with epel repos and other, and 6.5 is the last version available.
Can I package this manually to test it maybe ? If yes, how can i do this ?
Maybe @stormi can guide me ?
Thank you !
Signed-off-by: Cécile MORANGE contact@ataxya.net