def get_critical_process_from_monit(duthost, container_name):
    """Gets command lines of critical processes by parsing the Monit configration file
    of each container.

    Args:
        duthost: Hostname of DuT.
        container_name: Name of container.

    Returns:
        A list contains command lines of critical processes. Bool varaible indicates
        whether the operation in this funciton was done successfully or not.
    """
    critical_process_list = []
    succeeded = True

    monit_config_file_name = "monit_" + container_name
    file_content = duthost.shell("bash -c '[ -f /etc/monit/conf.d/{0} ] && cat /etc/monit/conf.d/{0}'"
                                 .format(monit_config_file_name))
    if file_content["rc"] != 0:
        succeeded = False
        return critical_process_list, succeeded

    for line in file_content["stdout_lines"]:
        if "process_checker" in line:
            command_line = line.split(" {} ".format(container_name))[1].strip(" \n\"")
            critical_process_list.append(command_line)

    return critical_process_list, succeeded