~free.ekanayaka/landscape-client/jaunty-1.5.2.1-0ubuntu0.9.04.0

« back to all changes in this revision

Viewing changes to landscape/monitor/memoryinfo.py

  • Committer: Free Ekanayaka
  • Date: 2010-06-16 10:01:20 UTC
  • Revision ID: free.ekanayaka@canonical.com-20100616100120-k185twz19yf1qqmh
* New upstream version (LP: #594594):
  - A new includes information about active network devices and their
    IP address in sysinfo output (LP: #272344).
  - A new plugin collects information about network traffic (#LP :284662).
  - Report information about which packages requested a reboot (LP: #538253).
  - Fix breakage on Lucid AMIs having no ramdisk (LP: #574810).
  - Migrate the inter-process communication system from DBus to Twisted AMP.

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]