Esempio n. 1
0
    def get(self):

        processes = self.get_arguments('processes', None)
        date_from = self.get_argument('date_from', False)
        date_to = self.get_argument('date_to', False)

        if date_from:
            date_from = datestring_to_utc_datetime(date_from)
        # Default - 24 hours period
        else:
            day = timedelta(hours=24)
            date_from = self.now - day

        if date_to:
            date_to = datestring_to_utc_datetime(date_to)
        else:
            date_to = self.now

        date_from = datetime_to_unixtime(date_from)
        date_to = datetime_to_unixtime(date_to)


        all_processes_checks = settings.PROCESS_CHECKS

        if len(processes) > 0:
            processes_checks = processes
        else:
            processes_checks = settings.PROCESS_CHECKS

        process_data = process_model.get_process_data(processes_checks, date_from, date_to)

        # Convert the dates to local time for display
        date_from = utc_unixtime_to_localtime(date_from)
        date_to = utc_unixtime_to_localtime(date_to)

        # Get the difference between UTC and localtime - used to display 
        # the ticks in the charts
        zone_difference = localtime_utc_timedelta()

        # Get the max date - utc, converted to localtime
        max_date = utc_now_to_localtime()

        self.render('processes.html',
                current_page=self.current_page,
                all_processes_checks=all_processes_checks,
                processes_checks=processes_checks,
                processes=processes,
                process_data=process_data,
                date_from=date_from,
                date_to=date_to,
                zone_difference=zone_difference,
                max_date=max_date
                )
Esempio n. 2
0
    def get(self):

        processes = self.get_arguments('processes', None)
        date_from = self.get_argument('date_from', False)
        date_to = self.get_argument('date_to', False)

        if date_from:
            date_from = datestring_to_utc_datetime(date_from)
        # Default - 24 hours period
        else:
            day = timedelta(hours=24)
            date_from = self.now - day

        if date_to:
            date_to = datestring_to_utc_datetime(date_to)
        else:
            date_to = self.now

        date_from = datetime_to_unixtime(date_from)
        date_to = datetime_to_unixtime(date_to)

        all_processes_checks = settings.PROCESS_CHECKS

        if len(processes) > 0:
            processes_checks = processes
        else:
            processes_checks = settings.PROCESS_CHECKS

        process_data = process_model.get_process_data(processes_checks,
                                                      date_from, date_to)

        # Convert the dates to local time for display
        date_from = utc_unixtime_to_localtime(date_from)
        date_to = utc_unixtime_to_localtime(date_to)

        # Get the difference between UTC and localtime - used to display
        # the ticks in the charts
        zone_difference = localtime_utc_timedelta()

        # Get the max date - utc, converted to localtime
        max_date = utc_now_to_localtime()

        self.render('processes.html',
                    current_page=self.current_page,
                    all_processes_checks=all_processes_checks,
                    processes_checks=processes_checks,
                    processes=processes,
                    process_data=process_data,
                    date_from=date_from,
                    date_to=date_to,
                    zone_difference=zone_difference,
                    max_date=max_date)
Esempio n. 3
0
    def post(self):

        date = self.get_argument('exceptions-date')
        date_utc = datestring_to_utc_datetime(date)
        date_unix = datetime_to_unixtime(date_utc)

        exception_model.delete_before_date(date_unix)

        self.redirect('/settings')
Esempio n. 4
0
    def post(self):

        date = self.get_argument('exceptions-date')
        date_utc = datestring_to_utc_datetime(date)
        date_unix = datetime_to_unixtime(date_utc)

        exception_model.delete_before_date(date_unix)

        self.redirect('/settings')
Esempio n. 5
0
    def get(self):
        date_from = self.get_argument('date_from', False)
        date_to = self.get_argument('date_to', False)
        charts = self.get_arguments('charts', None)

        if date_from:
            date_from = datestring_to_utc_datetime(date_from)
        # Default - 24 hours period
        else:
            day = timedelta(hours=24)
            date_from = self.now - day

        if date_to:
            date_to = datestring_to_utc_datetime(date_to)
        else:
            date_to = self.now

        date_from = datetime_to_unixtime(date_from)
        date_to = datetime_to_unixtime(date_to)

        if len(charts) > 0:
            active_checks = charts
        else:
            active_checks = settings.SYSTEM_CHECKS

        checks = system_model.get_system_data(active_checks, date_from,
                                              date_to)
        first_check_date = system_model.get_first_check_date()

        # Convert the dates to local time for display
        first_check_date = utc_unixtime_to_localtime(first_check_date)
        date_from = utc_unixtime_to_localtime(date_from)
        date_to = utc_unixtime_to_localtime(date_to)

        # Get the difference between UTC and localtime - used to display
        # the ticks in the charts
        zone_difference = localtime_utc_timedelta()

        # Get the max date - utc, converted to localtime
        max_date = utc_now_to_localtime()

        if checks != False:
            network = []
            network_interfaces = []

            disk = []
            volumes = []

            # Add network adapters
            if 'network' in active_checks:
                for check in checks['network']:
                    network.append(check)

                _interfaces = get_network_interfaces()
                for interface in _interfaces:
                    if interface not in network_interfaces:
                        network_interfaces.append(interface)

            # Add disk volumes
            if 'disk' in active_checks:
                for check in checks['disk']:
                    disk.append(check)

                _volumes = get_disk_volumes()
                for volume in _volumes:
                    if volume not in volumes:
                        volumes.append(volume)

            self.render('system.html',
                        current_page='system',
                        active_checks=active_checks,
                        charts=charts,
                        checks=checks,
                        network=network,
                        network_interfaces=network_interfaces,
                        volumes=volumes,
                        disk=disk,
                        date_from=date_from,
                        date_to=date_to,
                        first_check_date=first_check_date,
                        zone_difference=zone_difference,
                        max_date=max_date)
Esempio n. 6
0
    def get(self):
        date_from = self.get_argument('date_from', False)
        date_to = self.get_argument('date_to', False)
        charts = self.get_arguments('charts', None)

        if date_from:
            date_from = datestring_to_utc_datetime(date_from)
        # Default - 24 hours period
        else:
            day = timedelta(hours=24)
            date_from = self.now - day

        if date_to:
            date_to = datestring_to_utc_datetime(date_to)
        else:
            date_to = self.now

        date_from = datetime_to_unixtime(date_from)
        date_to = datetime_to_unixtime(date_to)

        if len(charts) > 0:
            active_checks = charts
        else:
            active_checks = settings.SYSTEM_CHECKS

        checks = system_model.get_system_data(active_checks, date_from, date_to)
        first_check_date = system_model.get_first_check_date()

        # Convert the dates to local time for display
        first_check_date = utc_unixtime_to_localtime(first_check_date)
        date_from = utc_unixtime_to_localtime(date_from)
        date_to = utc_unixtime_to_localtime(date_to)

        # Get the difference between UTC and localtime - used to display 
        # the ticks in the charts
        zone_difference = localtime_utc_timedelta()

        # Get the max date - utc, converted to localtime
        max_date = utc_now_to_localtime()

        if checks != False:
            network = []
            network_interfaces = []

            disk = []
            volumes = []

            # Add network adapters 
            if 'network' in active_checks:
                for check in checks['network']:
                    network.append(check)   

                _interfaces = get_network_interfaces()
                for interface in _interfaces:
                    if interface not in network_interfaces:
                        network_interfaces.append(interface)

            # Add disk volumes
            if 'disk' in active_checks:
                for check in checks['disk']:
                    disk.append(check)

                _volumes = get_disk_volumes()
                for volume in _volumes:
                    if volume not in volumes:
                        volumes.append(volume)

            self.render('system.html',
                    current_page='system',
                    active_checks=active_checks,
                    charts=charts,
                    checks=checks,
                    network=network,
                    network_interfaces=network_interfaces,
                    volumes=volumes,
                    disk=disk,
                    date_from=date_from,
                    date_to=date_to,
                    first_check_date=first_check_date,
                    zone_difference=zone_difference,
                    max_date=max_date
                    )