Skip to content

Commit

Permalink
Merge branch 'smartos'
Browse files Browse the repository at this point in the history
  • Loading branch information
alq666 committed Dec 18, 2012
2 parents 78dad60 + 858bd06 commit 8565a55
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 90 deletions.
11 changes: 2 additions & 9 deletions checks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
"""Base class for Checks.
If you are writing your own checks you should subclass the Check class.
The typicall workflow works like this:
1. Create your Check class
2. Declare your metrics as gauges or counters
3. Call save_sample for each metric
4. Call get_metrics() to get results
5. Plug the results into checks/common.py
If you are writing your own checks you should subclass the AgentCheck class.
The Check class is being deprecated so don't write new checks with it.
"""

import logging
Expand Down
35 changes: 18 additions & 17 deletions checks/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def __init__(self, agentConfig, emitters, systemStats):
# Unix System Checks
self._unix_system_checks = {
'disk': u.Disk(checks_logger),
'io': u.IO(),
'io': u.IO(checks_logger),
'load': u.Load(checks_logger),
'memory': u.Memory(checks_logger),
'network': u.Network(checks_logger),
'processes': u.Processes(),
'processes': u.Processes(checks_logger),
'cpu': u.Cpu(checks_logger)
}

Expand Down Expand Up @@ -163,24 +163,25 @@ def run(self, checksd=None):
payload.update(load)

memory = sys_checks['memory'].check(self.agentConfig)
payload.update({
'memPhysUsed' : memory.get('physUsed'),
'memPhysFree' : memory.get('physFree'),
'memPhysTotal' : memory.get('physTotal'),
'memPhysUsable' : memory.get('physUsable'),
'memSwapUsed' : memory.get('swapUsed'),
'memSwapFree' : memory.get('swapFree'),
'memSwapTotal' : memory.get('swapTotal'),
'memCached' : memory.get('physCached'),
'memBuffers': memory.get('physBuffers'),
'memShared': memory.get('physShared')
})

ioStats = sys_checks['io'].check(checks_logger, self.agentConfig)
if memory:
payload.update({
'memPhysUsed' : memory.get('physUsed'),
'memPhysFree' : memory.get('physFree'),
'memPhysTotal' : memory.get('physTotal'),
'memPhysUsable' : memory.get('physUsable'),
'memSwapUsed' : memory.get('swapUsed'),
'memSwapFree' : memory.get('swapFree'),
'memSwapTotal' : memory.get('swapTotal'),
'memCached' : memory.get('physCached'),
'memBuffers': memory.get('physBuffers'),
'memShared': memory.get('physShared')
})

ioStats = sys_checks['io'].check(self.agentConfig)
if ioStats:
payload['ioStats'] = ioStats

processes = sys_checks['processes'].check(checks_logger, self.agentConfig)
processes = sys_checks['processes'].check(self.agentConfig)
payload.update({'processes': processes})

networkTraffic = sys_checks['network'].check(self.agentConfig)
Expand Down
Loading

0 comments on commit 8565a55

Please sign in to comment.