def get_monitor_group(subparser):
    """
    Retrieve the monitor group for the argument parser.

    Since the monitor group is shared between commands, we provide a common
    function to generate the group for it. The user can pass the subparser, and
    the group is added, and returned.
    """
    # Monitoring via https://github.com/spack/spack-monitor
    monitor_group = subparser.add_argument_group()
    monitor_group.add_argument(
        '--monitor', action='store_true', dest='use_monitor', default=False,
        help="interact with a montor server during builds.")
    monitor_group.add_argument(
        '--monitor-no-auth', action='store_true', dest='monitor_disable_auth',
        default=False, help="the monitoring server does not require auth.")
    monitor_group.add_argument(
        '--monitor-tags', dest='monitor_tags', default=None,
        help="One or more (comma separated) tags for a build.")
    monitor_group.add_argument(
        '--monitor-keep-going', action='store_true', dest='monitor_keep_going',
        default=False, help="continue the build if a request to monitor fails.")
    monitor_group.add_argument(
        '--monitor-host', dest='monitor_host', default="http://127.0.0.1",
        help="If using a monitor, customize the host.")
    monitor_group.add_argument(
        '--monitor-prefix', dest='monitor_prefix', default="ms1",
        help="The API prefix for the monitor service.")
    return monitor_group