Esempio n. 1
0
import errno
import os
import time

import psutil  # pylint: disable=import-error

from chromite.lib import cros_logging as logging
from chromite.lib import metrics

logger = logging.getLogger(__name__)

_cpu_count_metric = metrics.GaugeMetric('dev/cpu/count',
                                        description='Number of CPU cores.')
_cpu_time_metric = metrics.FloatMetric(
    'dev/cpu/time',
    description='percentage of time spent by the CPU '
    'in different states.')

_disk_free_metric = metrics.GaugeMetric(
    'dev/disk/free', description='Available bytes on disk partition.')
_disk_total_metric = metrics.GaugeMetric(
    'dev/disk/total', description='Total bytes on disk partition.')

_inodes_free_metric = metrics.GaugeMetric(
    'dev/inodes/free',
    description='Number of available inodes on '
    'disk partition (unix only).')
_inodes_total_metric = metrics.GaugeMetric(
    'dev/inodes/total',
    description='Number of possible inodes on '
    'disk partition (unix only)')
Esempio n. 2
0
    'puppet/version/config',
    description='The version of the puppet configuration.'
    '  By default this is the time that the configuration was parsed')
_puppet_version_metric = metrics.StringMetric(
    'puppet/version/puppet',
    description='Version of puppet client installed.')
_events_metric = metrics.GaugeMetric(
    'puppet/events',
    description='Number of changes the puppet client made to the system in its'
    ' last run, by success or failure')
_resources_metric = metrics.GaugeMetric(
    'puppet/resources',
    description='Number of resources known by the puppet client in its last'
    ' run')
_times_metric = metrics.FloatMetric(
    'puppet/times',
    description='Time taken to perform various parts of the last puppet run')
_age_metric = metrics.FloatMetric(
    'puppet/age',
    description='Time since last run')


class _PuppetRunSummary(object):
  """Puppet run summary information."""

  def __init__(self, f):
    """Instantiate instance.

    Args:
      f: file object to read summary from
    """