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

megaclisas-status difficulty processing megacli output #133

Open
suwalski opened this issue May 31, 2022 · 1 comment
Open

megaclisas-status difficulty processing megacli output #133

suwalski opened this issue May 31, 2022 · 1 comment

Comments

@suwalski
Copy link

I've had to move from the dependable megaraid-status to megaclisas-status in my bullseye installations, as it seems the former is deprecated.

In my PERC5 machines, the megaclisas-status, which parses the output of megacli, doesn't work, since the PERC5s have bad binary data in the "Mfg. Data" section that it's all too willing to output:

# megaclisas-status --notemp
-- Controller information --
Traceback (most recent call last):
  File "/usr/sbin/megaclisas-status", line 660, in <module>
    output = getOutput(cmd)
  File "/usr/sbin/megaclisas-status", line 148, in getOutput
    for line in output:
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 420: invalid start byte
                    Mfg. Data
                ================
Mfg. Date       : 00/00/00
Rework Date     : 00/00/00
Revision No     : @��A
Battery FRU     : N/A

I think parsing the output of megacli is a fool's game compared to using the far more robust megactl, but I'm sure there are good reasons for it.

For now, I've created a /usr/local/sbin/MegaCli wrapper (that this script finds first), to preprocess the data:

#!/bin/sh

/usr/sbin/megacli $@ | iconv -c

But apparently the proper solution in the silliness that is Python is apparently to remove os.popen and replace with subprocess.Popen, which has string encoding options. I am useless with Python, so I can't provide a decent patch, though I can test.

@egberts
Copy link

egberts commented Jun 1, 2022

I use this too but am in transition between sites, will also take a look at it in a month.

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