Erinn Looney-Triggs wrote a nice plug-in for NAGIOS to check the warranty status of your Dell boxes with Dell. However, some of the systems I support are running a seriously old version of Dell OMSA. I sent him a quick patch back in May to handle old OMSA versions:
[root@x plugins]# diff -p check_dell_warranty check_dell_warranty_test *** check_dell_warranty Thu Apr 15 14:27:43 2010 --- check_dell_warranty_test Thu May 6 11:45:16 2010 *************** def extract_serial_number_snmp( hostname *** 314,319 **** --- 314,320 ---- hostname, community_string).split('\n') > for encl_id in snmp_out: + if not encl_id: continue #Get enclosure type. # 1: Internal # 2: DellTM PowerVaultTM 200S (PowerVault 201S)
This morning it looks like Dell has a few back-end servers that are serving up an older version of the warranty status table. I put together a quick patch to handle either warranty status table returned by Dell:
[root@x plugins]# diff -p check_dell_warranty- check_dell_warranty*** check_dell_warranty- Thu May 6 11:47:42 2010 --- check_dell_warranty Sat Jul 17 13:24:29 2010 *************** def get_warranty(serial_numbers): *** 438,444 **** return result_list ! def parse_exit(result_list, short_output=False): '''This parses the results from the get_warranty() function and outputs the appropriate information. ''' --- 437,443 ---- return result_list ! def parse_exit(result_list, debug, short_output=False): '''This parses the results from the get_warranty() function and outputs the appropriate information. ''' *************** def parse_exit(result_list, short_output *** 505,515 **** warranties = parse_table(match) #Remove the header lines. ! warranties.pop(0) ! for entry in warranties: ! (description, provider, start_date, end_date, ! days_left) = entry[0:5] #Convert the dates to international standard start_date = str(i8n_date(start_date)) --- 504,524 ---- warranties = parse_table(match) #Remove the header lines. ! header = warranties.pop(0) ! notice_present = (header[2].find("Warranty") >= 0) ! if debug: ! print "header is %s", header ! print "notice_present is ", notice_present ! for entry in warranties: ! if debug: ! print "entry is %s", entry ! if notice_present: ! (description, provider, notice, start_date, end_date, ! days_left) = entry[0:6] ! else: ! (description, provider, start_date, end_date, ! days_left) = entry[0:5] #Convert the dates to international standard start_date = str(i8n_date(start_date)) *************** remaining. These values can be adjusted *** 633,638 **** --- 642,652 ---- help=('Number of days under which to return a warning ' '(Default: %default)'), type='int', metavar='<ARG>' ) + parser.add_option('-d', '--debug', dest='debug', action="store_true", + default=False, + help=('Print debugging information ' + '(Default: %default)'), metavar='<ARG>' ) + (options, args) = parser.parse_args() signal.signal(signal.SIGALRM, sigalarm_handler) *************** remaining. These values can be adjusted *** 651,654 **** signal.alarm(0) ! parse_exit(RESULT, options.short_output) --- 665,668 ---- signal.alarm(0) ! parse_exit(RESULT, options.debug, options.short_output)I should really use a name mapping hash and should probably use a better debug logging method, but this was a quick fix for a Saturday morning.