def parse_daemon_args(arbiter=False):
    """Generic parsing function for daemons

    All daemons:
        '-n', "--name": Set the name of the daemon to pick in the configuration files.
        This allows an arbiter to find its own configuration in the whole Alignak configuration
        Using this parameter is mandatory for all the daemons except for the arbiter
        (defaults to arbiter-master). If several arbiters are existing in the
        configuration this will allow to determine which one is the master/spare.
        The spare arbiter must be launched with this parameter!

        '-e', '--environment': Alignak environment file - the most important and mandatory
        parameter to define the name of the alignak.ini configuration file

        '-c', '--config': Daemon configuration file (ini file) - deprecated!
        '-d', '--daemon': Run as a daemon
        '-r', '--replace': Replace previous running daemon
        '-f', '--debugfile': File to dump debug logs.

        These parameters allow to override the one defined in the Alignak configuration file:
            '-o', '--host': interface the daemon will listen to
            '-p', '--port': port the daemon will listen to

            '-l', '--log_file': set the daemon log file name
            '-i', '--pid_file': set the daemon pid file name

    Arbiter only:
            "-a", "--arbiter": Monitored configuration file(s),
            (multiple -a can be used, and they will be concatenated to make a global configuration
            file) - Note that this parameter is not necessary anymore
            "-V", "--verify-config": Verify configuration file(s) and exit



    :param arbiter: Do we parse args for arbiter?
    :type arbiter: bool
    :return: args
    """
    parser = argparse.ArgumentParser(description="Alignak version %s daemon parameters" % VERSION,
                                     epilog="And that's it!")
    if arbiter:
        parser.add_argument('-a', '--arbiter', action='append',
                            dest='legacy_cfg_files',
                            help='Legacy configuration file(s). '
                                 'This option is still available but is is preferable to declare '
                                 'the Nagios-like objects files in the alignak-configuration '
                                 'section of the environment file specified with the -e option.'
                                 'Multiple -a can be used to include several configuration files.')

        parser.add_argument('-V', '--verify-config', dest='verify_only', action='store_true',
                            help='Verify the configuration file(s) and exit')

        parser.add_argument('-k', '--alignak-name', dest='alignak_name',
                            default='My Alignak',
                            help='Set the name of the Alignak instance. If not set, the arbiter '
                                 'name will be used in place. Note that if an alignak_name '
                                 'variable is defined in the configuration, it will overwrite '
                                 'this parameter. '
                                 'For a spare arbiter, this parameter must contain its name!')
        parser.add_argument('-n', '--name', dest='daemon_name',
                            default='arbiter-master',
                            help='Daemon unique name. Must be unique for the same daemon type.')
    else:
        parser.add_argument('-n', '--name', dest='daemon_name', required=True,
                            help='Daemon unique name. Must be unique for the same daemon type.')

    parser.add_argument('-c', '--config', dest='config_file',
                        help='Daemon configuration file. '
                             'Deprecated parameter, do not use it anymore!')

    parser.add_argument('-d', '--daemon', dest='is_daemon', default=False, action='store_true',
                        help='Run as a daemon. Fork the launched process and daemonize.')

    parser.add_argument('-r', '--replace', dest='do_replace', default=False, action='store_true',
                        help='Replace previous running daemon if any pid file is found.')

    parser.add_argument('-vv', '--debug', dest='debug', default=False, action='store_true',
                        help='Set log level to debug mode (DEBUG)')

    parser.add_argument('-v', '--verbose', dest='verbose', default=False, action='store_true',
                        help='Set log level to verbose mode (INFO)')

    parser.add_argument('-o', '--host', dest='host',
                        help='Host interface used by the daemon. '
                             'Default is 0.0.0.0 (all interfaces).')

    parser.add_argument('-p', '--port', dest='port',
                        help='Port used by the daemon. '
                             'Default is set according to the daemon type.')

    parser.add_argument('-l', '--log_file', dest='log_filename',
                        help='File used for the daemon log. Set as empty to disable log file.')

    parser.add_argument('-Lm', '--log_level', dest='log_level',
                        help='Log level: DEBUG, INFO, WARNING, ERROR or CRITICAL. '
                             'Overrides the -v and -vv options.')

    parser.add_argument('-i', '--pid_file', dest='pid_filename',
                        help='File used to store the daemon pid')

    parser.add_argument('-e', '--environment', dest='env_file', required=True,
                        default='../../etc/alignak.ini',
                        help='Alignak global environment file. '
                             'This file defines all the daemons of this Alignak '
                             'instance and their configuration. Each daemon configuration '
                             'is defined in a specifc section of this file.')

    # parser.add_argument('env_file',
    #                     help='Alignak global environment file. '
    #                          'This file defines all the daemons of this Alignak '
    #                          'instance and their configuration. Each daemon configuration '
    #                          'is defined in a specifc section of this file.')

    return parser.parse_args()