

def get_alarm_refs(entity=None):
    "\n    Useful method that will return a list of dict with the moref and alarm\n    status for all triggered alarms on a given entity.\n\n\n    :param entity:\n    :return list: [{'alarm':'alarm-101', 'status':'red'}]\n    "
    alarm_states = entity.triggeredAlarmState
    ret = []
    for alarm_state in alarm_states:
        tdict = {
            'alarm': alarm_state.key.split('.')[0],
            'status': alarm_state.overallStatus,
        }
        ret.append(tdict)
    return ret

dataset/ETHPy150Open vmware/pyvmomi-community-samples/samples/tools/alarm.py get_alarm_refs/original