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

smartmon.sh and parsing of LUN IDs #107

Open
iustin opened this issue Dec 12, 2021 · 2 comments
Open

smartmon.sh and parsing of LUN IDs #107

iustin opened this issue Dec 12, 2021 · 2 comments

Comments

@iustin
Copy link

iustin commented Dec 12, 2021

Looking at the code in smartmon.sh, here:

  while read -r line; do
    info_type="$(echo "${line}" | cut -f1 -d: | tr ' ' '_')"
    case "${info_type}" in
    …
    Logical_Unit_id) lun_id="${info_value}" ;;

However, on all systems I have access to, the actual info contains LU WWN Device ID, and I suppose smartctl made an output change since this code was written.

The fix is rather trivial, but since I don't know if there are still old - or many just different - smartctl versions are there, needs to handle both.

@dswarbrick
Copy link
Member

dswarbrick commented Dec 12, 2021

This is a pretty strong argument for ditching both the smartmon.sh bash script and the smartmon.py Python script, both of which invoke smartctl in the usual way, and parse the human-readable output.

smartmontools has supported JSON output since 2017, and it would IMHO make a lot more sense to parse that. The smartmontools developers are aware that the JSON output is assumed to be machine-readable, and they avoid making backwards-incompatible changes to the format.

@iustin
Copy link
Author

iustin commented Dec 12, 2021

Right, let's not even bring up the duplication 😞 I was not aware of the JSON output, a quick look shows that it's much better indeed.

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

No branches or pull requests

2 participants