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

Added a -i option for changing the style #51

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

Conversation

6d6178
Copy link

@6d6178 6d6178 commented Sep 20, 2018

I have added a -i option, refering to the monitoring software Icinga, which only displays WARNINGS and ERRORS. If everything is fine, only "OK" will be displayed.
The script works in this state. I would like to discuss:

  1. If there is a better way for line 216 where I use an else. I used it because otherwise I get a KeyError since I use the option outside of the PARSER
  2. If I should use the line 848 if-clause before or after the for-loop. I decided to use it before since otherwise it checks the if-clause for every line.
  3. If this is a new rc or I should leave it at rc4

I am very open for suggestions to improve this.

@asdorsey
Copy link

I cloned your repo and tested using the -i parameter for issue #44. I'm getting an error with your repo that I don't get with the original script, both with and without -i.

# ./idrac_2.2rc5 -H 10.181.4.21 -v 2c -c public -i
Traceback (most recent call last):
  File "./idrac_2.2rc5", line 852, in <module>
    result, tmp_code = PARSER().main()
  File "./idrac_2.2rc5", line 647, in main
    hw_dict = self.classifier(snmp_data, hw_dict)  # classify data
  File "./idrac_2.2rc5", line 416, in classifier
    item_order = int(_.split()[0].split('.')[-1])
ValueError: invalid literal for int() with base 10: 'MIB-Dell-10892::systemStateGlobalSystemStatus'
# ./idrac_2.2rc5 -H 10.181.4.21 -v 2c -c public
PS
--
DISK
--PDisk 1 (0:1:0) 278.88 GB: ONLINE, PowerStat: SPUNUP, HotSpare: no [SEAGATE, HDD, S/N: XXXXXXXX] isFailing: 0
--PDisk 2 (0:1:1) 278.88 GB: ONLINE, PowerStat: SPUNUP, HotSpare: no [SEAGATE, HDD, S/N: XXXXXXXX] isFailing: 0
FAN
--
BATTERY
--System Board CMOS Battery: ENABLED/OK [PRESENCEDETECTED]
--PERC1 ROMB Battery: ENABLED/OK [PRESENCEDETECTED]
--PERC2 ROMB Battery: ENABLED/OK [0]
PU
--
MEM
--
VDISK
--VDisk 1 (): OK/ONLINE, RAID-1 (278.88 GB), BadBlock: 0 [Virtual Disk 0 on Integrated RAID Controller 1]
Traceback (most recent call last):
  File "./idrac_2.2rc5", line 870, in <module>
    result, tmp_code = PARSER().main()
  File "./idrac_2.2rc5", line 647, in main
    hw_dict = self.classifier(snmp_data, hw_dict)  # classify data
  File "./idrac_2.2rc5", line 416, in classifier
    item_order = int(_.split()[0].split('.')[-1])
ValueError: invalid literal for int() with base 10: 'MIB-Dell-10892::systemStateGlobalSystemStatus'

@eeshlomi
Copy link

Hi everyone
The bug was fixed after this pull request.
Since it turns out to be a useful feature, I now merged this "-i" parameter into the latest version in my fork: https://github.com/eeshlomi/check_idrac
Shlomi

eeshlomi referenced this pull request in eeshlomi/check_idrac Sep 26, 2019
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.

3 participants