~ahasenack/landscape-client/landscape-client-1.5.5-0ubuntu0.10.04.0

« back to all changes in this revision

Viewing changes to landscape/monitor/memoryinfo.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2010-06-28 18:07:18 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100628180718-vytyqgbtkiirv5sb
Tags: 1.5.2.1-0ubuntu0.10.04.0
Filter duplicate network interfaces in get_active_interfaces (LP: #597000)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
from landscape.lib.sysstats import MemoryStats
5
5
 
6
6
from landscape.accumulate import Accumulator
7
 
from landscape.monitor.monitor import MonitorPlugin
 
7
from landscape.monitor.plugin import MonitorPlugin
8
8
 
9
9
 
10
10
class MemoryInfo(MonitorPlugin):
14
14
    # Prevent the Plugin base-class from scheduling looping calls.
15
15
    run_interval = None
16
16
 
17
 
    def __init__(self, interval=15, monitor_interval=60*60,
 
17
    def __init__(self, interval=15, monitor_interval=60 * 60,
18
18
                 source_filename="/proc/meminfo", create_time=time.time):
19
19
        self._interval = interval
20
20
        self._monitor_interval = monitor_interval
52
52
        self._monitor.ping()
53
53
        new_timestamp = int(self._create_time())
54
54
        memstats = MemoryStats(self._source_filename)
55
 
        memory_step_data = self._accumulate(new_timestamp, memstats.free_memory,
56
 
                                            "accumulate-memory")
57
 
        swap_step_data = self._accumulate(new_timestamp, memstats.free_swap,
58
 
                                          "accumulate-swap")
 
55
        memory_step_data = self._accumulate(
 
56
            new_timestamp, memstats.free_memory, "accumulate-memory")
 
57
        swap_step_data = self._accumulate(
 
58
            new_timestamp, memstats.free_swap, "accumulate-swap")
59
59
 
60
60
        if memory_step_data and swap_step_data:
61
61
            timestamp = memory_step_data[0]