def check_server_power(): """ Check if the server is powered on Skip this check, if the --noPowerState is set """ if power_state_flag: power_state = get_data(sess, oid_power_state, helper) power_state_summary_output, power_state_long_output = state_summary(power_state, 'Server power', server_power_state, helper, server_power_state[3]) add_output(power_state_summary_output, power_state_long_output, helper)
def check_storage_controllers(): """ Check the status of the storage controllers Skip this check, if --noController is set """ if ctrl_flag: ctrl = walk_data(sess, oid_ctrl, helper)[0] for x, data in enumerate(ctrl, 1): ctrl_summary_output, ctrl_long_output = state_summary(data, 'Controller %d' % x, normal_state, helper) add_output(ctrl_summary_output, ctrl_long_output, helper)
def check_global_status(flag, name, oid): """ check a global status check_global_status(True, "Global Storage", '.1.3.6.1.4.1.232.3.1.3.0') """ # only check the status, if the "no" flag is not set if flag: # get the data via snmp myData = get_data(sess, oid, helper) data_summary_output, data_long_output = state_summary(myData, name, normal_state, helper) add_output(data_summary_output, data_long_output, helper)
global_system_data = get_data(sess, oid_global_system, helper) system_lcd_data = get_data(sess, oid_system_lcd, helper) global_storage_data = get_data(sess, oid_global_storage, helper) system_power_data = get_data(sess, oid_system_power, helper) global_system_summary, global_system_long = state_summary( global_system_data, 'Global System', normal_state, helper) system_lcd_summary, system_lcd_long = state_summary( system_lcd_data, 'System LCD', normal_state, helper) global_storage_summary, global_storage_long = state_summary( global_storage_data, 'Global Storage', normal_state, helper) system_power_summary, system_power_long = state_summary( system_power_data, 'System Power', system_power_state, helper, 'on') add_output(global_system_summary, global_system_long, helper) add_output(system_lcd_summary, system_lcd_long, helper) add_output(global_storage_summary, global_storage_long, helper) add_output(system_power_summary, system_power_long, helper) # power unit power_unit_redundancy_data = walk_data(sess, oid_power_unit_redundancy, helper)[0] power_unit_name_data = walk_data(sess, oid_power_unit_name, helper)[0] power_unit_status_data = walk_data(sess, oid_power_unit_status, helper)[0] power_unit_summary_output, power_unit_long_output = power_unit_check( power_unit_redundancy_data, power_unit_name_data, power_unit_status_data) add_output(power_unit_summary_output, power_unit_long_output, helper)
check_global_status(temp_sens_flag, 'Temperature sensors', oid_glob_temp_sens) check_global_status(fan_flag, 'Fan(s)', oid_glob_fan) check_global_status(mem_flag, 'Memory', oid_mem) # check if the server is powered on check_server_power() # check the status of the storage controllers check_storage_controllers() # Physical drive check if int(input_phy_drv) != 0: phy_drv_summary_output, phy_drv_long_output = check_phy_drv( temp_drive_flag, input_phy_drv) add_output(phy_drv_summary_output, phy_drv_long_output, helper) # Power supply check check_ps() # Check Power Supply Reduandancy check_power_redundancy() # Fan check if int(input_fan) != 0: fan_summary_output, fan_long_output = check_fan(input_fan) add_output(fan_summary_output, fan_long_output, helper) check_temperature_sensors() # Print out plugin information and exit nagios-style
check_global_status(power_supply_flag,'Global power supply',oid_glob_power_supply) check_global_status(temp_flag,'Overall thermal environment',oid_glob_temp) check_global_status(temp_sens_flag,'Temperature sensors',oid_glob_temp_sens) check_global_status(fan_flag,'Fan(s)',oid_glob_fan) check_global_status(mem_flag,'Memory',oid_mem) # check if the server is powered on check_server_power() # check the status of the storage controllers check_storage_controllers() # Physical drive check if int(input_phy_drv) != 0: phy_drv_summary_output, phy_drv_long_output = check_phy_drv(temp_drive_flag, input_phy_drv) add_output(phy_drv_summary_output, phy_drv_long_output, helper) # Power supply check check_ps() # Check Power Supply Reduandancy check_power_redundancy() # Fan check if int(input_fan) != 0: fan_summary_output, fan_long_output = check_fan(input_fan) add_output(fan_summary_output, fan_long_output, helper) check_temperature_sensors() # Print out plugin information and exit nagios-style