1
# -*- encoding: utf-8 -*-
3
# Copyright © 2013 ZHAW SoE
4
# Copyright © 2014 Intel Corp.
6
# Authors: Lucas Graf <graflu0@students.zhaw.ch>
7
# Toni Zehnder <zehndton@students.zhaw.ch>
8
# Lianhao Lu <lianhao.lu@intel.com>
10
# Licensed under the Apache License, Version 2.0 (the "License"); you may
11
# not use this file except in compliance with the License. You may obtain
12
# a copy of the License at
14
# http://www.apache.org/licenses/LICENSE-2.0
16
# Unless required by applicable law or agreed to in writing, software
17
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
19
# License for the specific language governing permissions and limitations
22
from ceilometer.hardware import plugin
23
from ceilometer.hardware.pollsters import util
24
from ceilometer import sample
27
class _Base(plugin.HardwarePollster):
30
INSPECT_METHOD = 'inspect_cpu'
33
class CPUUtil1MinPollster(_Base):
36
def generate_one_sample(host, c_data):
37
return util.make_sample_from_host(host,
39
type=sample.TYPE_GAUGE,
41
volume=c_data.cpu_1_min,
45
class CPUUtil5MinPollster(_Base):
48
def generate_one_sample(host, c_data):
49
return util.make_sample_from_host(host,
51
type=sample.TYPE_GAUGE,
53
volume=c_data.cpu_5_min,
57
class CPUUtil15MinPollster(_Base):
60
def generate_one_sample(host, c_data):
61
return util.make_sample_from_host(host,
62
name='cpu.util.15min',
63
type=sample.TYPE_GAUGE,
65
volume=c_data.cpu_15_min,