Пример #1
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 20
        glances_processes.set_max_processes(20)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(
                _("Extended stats for top process is enabled (default behavor)"
                  ))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)
Пример #2
0
class GlancesStandalone(object):

    """This class creates and manages the Glances standalone session."""

    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 50
        glances_processes.set_max_processes(50)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(_("Extended stats for top process is enabled (default behavor)"))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)

    def serve_forever(self):
        """Main loop for the CLI."""
        while True:
            # Update system informations
            self.stats.update()

            # Update the screen
            self.screen.update(self.stats)

            # Update the CSV output
            if self.csv_tag:
                self.csvoutput.update(self.stats)

    def end(self):
        """End of the CLI."""
        self.screen.end()

        # Close the CSV file
        if self.csv_tag:
            self.csvoutput.exit()
Пример #3
0
class GlancesStandalone(object):
    """This class creates and manages the Glances standalone session."""
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 20
        glances_processes.set_max_processes(20)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(
                _("Extended stats for top process is enabled (default behavor)"
                  ))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)

    def serve_forever(self):
        """Main loop for the CLI."""
        while True:
            # Update system informations
            self.stats.update()

            # Update the screen
            self.screen.update(self.stats)

            # Update the CSV output
            if self.csv_tag:
                self.csvoutput.update(self.stats)

    def end(self):
        """End of the CLI."""
        self.screen.end()

        # Close the CSV file
        if self.csv_tag:
            self.csvoutput.exit()
Пример #4
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 50
        glances_processes.set_max_processes(50)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(_("Extended stats for top process is enabled (default behavor)"))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)
Пример #5
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # If configured, set the maximum processes number to display
        try:
            max_processes = int(
                self.stats.get_plugin('processlist').get_conf_value(
                    'max_processes'))
            logger.debug(
                _("Limit maximum displayed processes to %s") % max_processes)
        except:
            max_processes = None
            logger.warning(
                _("Maximum displayed processes is not configured (high CPU consumption)"
                  ))
        glances_processes.set_max_processes(max_processes)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(
                _("Extended stats for top process is enabled (default behavor)"
                  ))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 50
        glances_processes.set_max_processes(50)

        # If process extended stats is disabled by user
        if not args.enable_process_extended:
            logger.info(
                "Extended stats for top process are disabled (default behavior)"
            )
            glances_processes.disable_extended()
        else:
            logger.debug("Extended stats for top process are enabled")
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        if (not is_windows) and args.no_kernel_threads:
            # Ignore kernel threads in process list
            glances_processes.disable_kernel_threads()

        if args.process_tree:
            # Enable process tree view
            glances_processes.enable_tree()

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCursesStandalone(args=args)
Пример #7
0
class GlancesStandalone(object):

    """This class creates and manages the Glances standalone session."""

    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)

    def serve_forever(self):
        """Main loop for the CLI."""
        while True:
            # Update system informations
            self.stats.update()

            # Update the screen
            self.screen.update(self.stats)

            # Update the CSV output
            if self.csv_tag:
                self.csvoutput.update(self.stats)

    def end(self):
        """End of the CLI."""
        self.screen.end()

        # Close the CSV file
        if self.csv_tag:
            self.csvoutput.exit()
Пример #8
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)
Пример #9
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # Default number of processes to displayed is set to 50
        glances_processes.set_max_processes(50)

        # If process extended stats is disabled by user
        if not args.enable_process_extended:
            logger.info("Extended stats for top process are disabled (default behavior)")
            glances_processes.disable_extended()
        else:
            logger.debug("Extended stats for top process are enabled")
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        if (not is_windows) and args.no_kernel_threads:
            # Ignore kernel threads in process list
            glances_processes.disable_kernel_threads()

        if args.process_tree:
            # Enable process tree view
            glances_processes.enable_tree()

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCursesStandalone(args=args)
Пример #10
0
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # If configured, set the maximum processes number to display
        try:
            max_processes = int(self.stats.get_plugin('processlist').get_conf_value('max_processes'))
            logger.debug(_("Limit maximum displayed processes to %s") % max_processes)
        except:
            max_processes = None
            logger.warning(_("Maximum displayed processes is not configured (high CPU consumption)"))
        glances_processes.set_max_processes(max_processes)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(_("Extended stats for top process is enabled (default behavor)"))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)
Пример #11
0
class GlancesStandalone(object):

    """This class creates and manages the Glances standalone session."""

    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # If configured, set the maximum processes number to display
        try:
            max_processes = int(self.stats.get_plugin('processlist').get_conf_value('max_processes'))
            logger.debug(_("Limit maximum displayed processes to %s") % max_processes)
        except:
            max_processes = None
            logger.warning(_("Maximum displayed processes is not configured (high CPU consumption)"))
        glances_processes.set_max_processes(max_processes)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(_("Extended stats for top process is enabled (default behavor)"))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)

    def serve_forever(self):
        """Main loop for the CLI."""
        while True:
            # Update system informations
            self.stats.update()

            # Update the screen
            self.screen.update(self.stats)

            # Update the CSV output
            if self.csv_tag:
                self.csvoutput.update(self.stats)

    def end(self):
        """End of the CLI."""
        self.screen.end()

        # Close the CSV file
        if self.csv_tag:
            self.csvoutput.exit()
Пример #12
0
class GlancesStandalone(object):
    """This class creates and manages the Glances standalone session."""
    def __init__(self, config=None, args=None):
        # Init stats
        self.stats = GlancesStats(config=config, args=args)

        # If configured, set the maximum processes number to display
        try:
            max_processes = int(
                self.stats.get_plugin('processlist').get_conf_value(
                    'max_processes'))
            logger.debug(
                _("Limit maximum displayed processes to %s") % max_processes)
        except:
            max_processes = None
            logger.warning(
                _("Maximum displayed processes is not configured (high CPU consumption)"
                  ))
        glances_processes.set_max_processes(max_processes)

        # If process extended stats is disabled by user
        if args.disable_process_extended:
            logger.info(_("Extended stats for top process is disabled"))
            glances_processes.disable_extended()
        else:
            logger.debug(
                _("Extended stats for top process is enabled (default behavor)"
                  ))
            glances_processes.enable_extended()

        # Manage optionnal process filter
        if args.process_filter is not None:
            glances_processes.set_process_filter(args.process_filter)

        # Initial system informations update
        self.stats.update()

        # Init CSV output
        if args.output_csv is not None:
            from glances.outputs.glances_csv import GlancesCSV

            self.csvoutput = GlancesCSV(args=args)
            self.csv_tag = True
        else:
            self.csv_tag = False

        # Init screen
        self.screen = GlancesCurses(args=args)

    def serve_forever(self):
        """Main loop for the CLI."""
        while True:
            # Update system informations
            self.stats.update()

            # Update the screen
            self.screen.update(self.stats)

            # Update the CSV output
            if self.csv_tag:
                self.csvoutput.update(self.stats)

    def end(self):
        """End of the CLI."""
        self.screen.end()

        # Close the CSV file
        if self.csv_tag:
            self.csvoutput.exit()