Пример #1
0
    def _info_all(self):
        CollectorStatus.print_latest_status(verbose=True)
        if not _is_affirmative(self._config.get('dogstatsd6_enable')):
            DogstatsdStatus.print_latest_status(verbose=True)
        else:
            dsd6_status = Dogstatsd6._get_dsd6_stats(self._config)
            if dsd6_status:
                dsd6_status.render()

        ForwarderStatus.print_latest_status(verbose=True)
Пример #2
0
def main(config_path=None):
    """ The main entry point for the unix version of dogstatsd. """
    parser = optparse.OptionParser("%prog [start|stop|restart|status]")
    parser.add_option('-u',
                      '--use-local-forwarder',
                      action='store_true',
                      dest="use_forwarder",
                      default=False)
    opts, args = parser.parse_args()

    reporter, server = init(config_path,
                            use_watchdog=True,
                            use_forwarder=opts.use_forwarder)
    pid_file = PidFile('dogstatsd')
    daemon = Dogstatsd(pid_file.get_path(), server, reporter)

    # If no args were passed in, run the server in the foreground.
    if not args:
        daemon.run()
        return 0

    # Otherwise, we're process the deamon command.
    else:
        command = args[0]
        if command == 'info':
            DogstatsdStatus.print_latest_status()
            return 0

        if command == 'start':
            daemon.start()
        elif command == 'stop':
            daemon.stop()
        elif command == 'restart':
            daemon.restart()
        elif command == 'status':
            pid = pid_file.get_pid()
            if pid:
                message = 'dogstatsd is running with pid %s' % pid
            else:
                message = 'dogstatsd is not running'
            logger.info(message)
            sys.stdout.write(message + "\n")
        else:
            sys.stderr.write("Unknown command: %s\n\n" % command)
            parser.print_help()
            return 1
        return 0
Пример #3
0
def main(config_path=None):
    """ The main entry point for the unix version of dogstatsd. """
    parser = optparse.OptionParser("%prog [start|stop|restart|status]")
    parser.add_option('-u', '--use-local-forwarder', action='store_true',
                        dest="use_forwarder", default=False)
    opts, args = parser.parse_args()

    reporter, server = init(config_path, use_watchdog=True, use_forwarder=opts.use_forwarder)
    pid_file = PidFile('dogstatsd')
    daemon = Dogstatsd(pid_file.get_path(), server, reporter)

    # If no args were passed in, run the server in the foreground.
    if not args:
        daemon.run()
        return 0

    # Otherwise, we're process the deamon command.
    else:
        command = args[0]
        if command == 'info':
            DogstatsdStatus.print_latest_status()
            return 0

        if command == 'start':
            daemon.start()
        elif command == 'stop':
            daemon.stop()
        elif command == 'restart':
            daemon.restart()
        elif command == 'status':
            pid = pid_file.get_pid()
            if pid:
                message = 'dogstatsd is running with pid %s' % pid
            else:
                message = 'dogstatsd is not running'
            logger.info(message)
            sys.stdout.write(message + "\n")
        else:
            sys.stderr.write("Unknown command: %s\n\n" % command)
            parser.print_help()
            return 1
        return 0
Пример #4
0
def main(config_path=None):
    """ The main entry point for the unix version of dogstatsd. """
    parser = optparse.OptionParser("%prog [start|stop|restart|status]")
    parser.add_option("-u", "--use-local-forwarder", action="store_true", dest="use_forwarder", default=False)
    opts, args = parser.parse_args()

    # commands that don't need the daemon
    if args and args[0] in ["info", "status"]:
        command = args[0]
        if command == "info":
            logging.getLogger().setLevel(logging.ERROR)
            return DogstatsdStatus.print_latest_status()
        elif command == "status":
            pid = pid_file.get_pid()
            if pid:
                message = "dogstatsd is running with pid %s" % pid
            else:
                message = "dogstatsd is not running"
            log.info(message)
            sys.stdout.write(message + "\n")
            return 0

    reporter, server = init(config_path, use_watchdog=True, use_forwarder=opts.use_forwarder)
    pid_file = PidFile("dogstatsd")
    daemon = Dogstatsd(pid_file.get_path(), server, reporter)

    # If no args were passed in, run the server in the foreground.
    if not args:
        daemon.run()
        return 0

    # Otherwise, we're process the deamon command.
    else:
        command = args[0]

        if command == "start":
            daemon.start()
        elif command == "stop":
            daemon.stop()
        elif command == "restart":
            daemon.restart()
        else:
            sys.stderr.write("Unknown command: %s\n\n" % command)
            parser.print_help()
            return 1
        return 0
Пример #5
0
 def _info_all(self):
     CollectorStatus.print_latest_status(verbose=True)
     DogstatsdStatus.print_latest_status(verbose=True)
     ForwarderStatus.print_latest_status(verbose=True)
Пример #6
0
 def _info_all(self):
     CollectorStatus.print_latest_status(verbose=True)
     DogstatsdStatus.print_latest_status(verbose=True)
     ForwarderStatus.print_latest_status(verbose=True)
Пример #7
0
 def info(self):
     logging.getLogger().setLevel(logging.ERROR)
     return DogstatsdStatus.print_latest_status()
Пример #8
0
 def info(self):
     logging.getLogger().setLevel(logging.ERROR)
     return DogstatsdStatus.print_latest_status()