Skip to content

Commit

Permalink
Add fix for when MegaCLI returns N/A instead of a number
Browse files Browse the repository at this point in the history
Thanks @gerdriesselmann for his work in bojleros#2
  • Loading branch information
hacklschorsch committed Oct 18, 2021
1 parent a2a994d commit a044d5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion megacli.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ def main():
print("# HELP " + k + " " + v['help'])
print("# TYPE " + k + " " + v['type'])
for m in v['metrics']:
print ( str(k) + '{' + ', '.join([ "{}=\"{}\"".format(str(l),str(m['labels'][l])) for l in sorted(m['labels']) ]) + '} ' + str(m['val']) )
clean = str(m['val'])
if clean.replace('.','',1).isdigit() == False:
clean = '0'
print ( str(k) + '{' + ', '.join([ "{}=\"{}\"".format(str(l),str(m['labels'][l])) for l in sorted(m['labels']) ]) + '} ' + clean )

if __name__ == "__main__":
main()

0 comments on commit a044d5f

Please sign in to comment.