Add check setup for system checks.

Change-Id: If921cbd4abda73611ee633d786bd9c06e557825e
This commit is contained in:
Ryan Bak 2015-05-06 16:20:47 -06:00
parent 610ab282cc
commit 1299be941c
13 changed files with 255 additions and 1 deletions

40
manifests/checks/cpu.pp Normal file
View File

@ -0,0 +1,40 @@
# == Class: monasca::checks::cpu
#
# Sets up the monasca cpu check.
#
# === Parameters
#
# [*instances*]
# A hash of instances for the check.
# Each instance should be a hash of the check's parameters.
# Parameters for the cpu check are:
# name (the instance key): The name of the instance.
# send_rollup_stats (default = False)
# dimensions
# e.g.
# instances:
# cpu_stats:
# dimensions:
#
class monasca::checks::cpu(
$instances = undef,
){
$conf_dir = $::monasca::agent::conf_dir
if($instances){
Concat["${conf_dir}/cpu.yaml"] ~> Service['monasca-agent']
concat { "${conf_dir}/cpu.yaml":
owner => 'root',
group => $::monasca::group,
mode => '0640',
warn => true,
require => File[$conf_dir],
}
concat::fragment { 'cpu_header':
target => "${conf_dir}/cpu.yaml",
order => '0',
content => "---\ninit_config: null\ninstances:\n",
}
create_resources('monasca::checks::instances::cpu', $instances)
}
}

44
manifests/checks/disk.pp Normal file
View File

@ -0,0 +1,44 @@
# == Class: monasca::checks::disk
#
# Sets up the monasca disk check.
#
# === Parameters
#
# [*instances*]
# A hash of instances for the check.
# Each instance should be a hash of the check's parameters.
# Parameters for the disk check are:
# name (the instance key): The name of the instance.
# use_mount (default = True)
# send_io_stats (default = True)
# send_rollup_stats (default = False)
# device_blacklist_re
# ignore_filesystem_types
# dimensions
# e.g.
# instances:
# disk_stats:
# dimensions:
#
class monasca::checks::disk(
$instances = undef,
){
$conf_dir = $::monasca::agent::conf_dir
if($instances){
Concat["${conf_dir}/disk.yaml"] ~> Service['monasca-agent']
concat { "${conf_dir}/disk.yaml":
owner => 'root',
group => $::monasca::group,
mode => '0640',
warn => true,
require => File[$conf_dir],
}
concat::fragment { 'disk_header':
target => "${conf_dir}/disk.yaml",
order => '0',
content => "---\ninit_config: null\ninstances:\n",
}
create_resources('monasca::checks::instances::disk', $instances)
}
}

View File

@ -0,0 +1,14 @@
#
# configure monasca plugin yaml file for cpu interfaces
#
define monasca::checks::instances::cpu (
$send_rollup_stats = undef,
$dimensions = undef,
) {
$conf_dir = $::monasca::agent::conf_dir
concat::fragment { "${title}_cpu_instance":
target => "${conf_dir}/cpu.yaml",
content => template('monasca/checks/cpu.erb'),
order => '1',
}
}

View File

@ -0,0 +1,18 @@
#
# configure monasca plugin yaml file for disk interfaces
#
define monasca::checks::instances::disk (
$use_mount = undef,
$send_io_stats = undef,
$send_rollup_stats = undef,
$device_blacklist_re = undef,
$ignore_filesystem_types = undef,
$dimensions = undef,
) {
$conf_dir = $::monasca::agent::conf_dir
concat::fragment { "${title}_disk_instance":
target => "${conf_dir}/disk.yaml",
content => template('monasca/checks/disk.erb'),
order => '1',
}
}

View File

@ -0,0 +1,13 @@
#
# configure monasca plugin yaml file for load interfaces
#
define monasca::checks::instances::load (
$dimensions = undef,
) {
$conf_dir = $::monasca::agent::conf_dir
concat::fragment { "${title}_load_instance":
target => "${conf_dir}/load.yaml",
content => template('monasca/checks/load.erb'),
order => '1',
}
}

View File

@ -0,0 +1,13 @@
#
# configure monasca plugin yaml file for memory interfaces
#
define monasca::checks::instances::memory (
$dimensions = undef,
) {
$conf_dir = $::monasca::agent::conf_dir
concat::fragment { "${title}_memory_instance":
target => "${conf_dir}/memory.yaml",
content => template('monasca/checks/memory.erb'),
order => '1',
}
}

39
manifests/checks/load.pp Normal file
View File

@ -0,0 +1,39 @@
# == Class: monasca::checks::load
#
# Sets up the monasca load check.
#
# === Parameters
#
# [*instances*]
# A hash of instances for the check.
# Each instance should be a hash of the check's parameters.
# Parameters for the load check are:
# name (the instance key): The name of the instance.
# dimensions
# e.g.
# instances:
# load_stats:
# dimensions:
#
class monasca::checks::load(
$instances = undef,
){
$conf_dir = $::monasca::agent::conf_dir
if($instances){
Concat["${conf_dir}/load.yaml"] ~> Service['monasca-agent']
concat { "${conf_dir}/load.yaml":
owner => 'root',
group => $::monasca::group,
mode => '0640',
warn => true,
require => File[$conf_dir],
}
concat::fragment { 'load_header':
target => "${conf_dir}/load.yaml",
order => '0',
content => "---\ninit_config: null\ninstances:\n",
}
create_resources('monasca::checks::instances::load', $instances)
}
}

View File

@ -0,0 +1,39 @@
# == Class: monasca::checks::memory
#
# Sets up the monasca memory check.
#
# === Parameters
#
# [*instances*]
# A hash of instances for the check.
# Each instance should be a hash of the check's parameters.
# Parameters for the memory check are:
# name (the instance key): The name of the instance.
# dimensions
# e.g.
# instances:
# memory_stats:
# dimensions:
#
class monasca::checks::memory(
$instances = undef,
){
$conf_dir = $::monasca::agent::conf_dir
if($instances){
Concat["${conf_dir}/memory.yaml"] ~> Service['monasca-agent']
concat { "${conf_dir}/memory.yaml":
owner => 'root',
group => $::monasca::group,
mode => '0640',
warn => true,
require => File[$conf_dir],
}
concat::fragment { 'memory_header':
target => "${conf_dir}/memory.yaml",
order => '0',
content => "---\ninit_config: null\ninstances:\n",
}
create_resources('monasca::checks::instances::memory', $instances)
}
}

View File

@ -15,7 +15,7 @@
# dimensions
# e.g.
# instances:
# net:
# network_stats:
# collect_connection_state: 'False'
# excluded_interfaces: '[lo, lo0]'
#

7
templates/checks/cpu.erb Normal file
View File

@ -0,0 +1,7 @@
- name: <%= @title %>
<%- if not @send_rollup_stats.nil? -%>
send_rollup_stats: <%= @send_rollup_stats %>
<%- end -%>
<%- if @dimensions -%>
dimensions: <%= @dimensions %>
<%- end -%>

19
templates/checks/disk.erb Normal file
View File

@ -0,0 +1,19 @@
- name: <%= @title %>
<%- if not @use_mount.nil? -%>
use_mount: <%= @use_mount %>
<%- end -%>
<%- if not @send_io_stats.nil? -%>
send_io_stats: <%= @send_io_stats %>
<%- end -%>
<%- if not @send_rollup_stats.nil? -%>
send_rollup_stats: <%= @send_rollup_stats %>
<%- end -%>
<%- if not @device_blacklist_re.nil? -%>
device_blacklist_re: <%= @device_blacklist_re %>
<%- end -%>
<%- if not @ignore_filesystem_types.nil? -%>
ignore_filesystem_types: <%= @ignore_filesystem_types %>
<%- end -%>
<%- if @dimensions -%>
dimensions: <%= @dimensions %>
<%- end -%>

View File

@ -0,0 +1,4 @@
- name: <%= @title %>
<%- if @dimensions -%>
dimensions: <%= @dimensions %>
<%- end -%>

View File

@ -0,0 +1,4 @@
- name: <%= @title %>
<%- if @dimensions -%>
dimensions: <%= @dimensions %>
<%- end -%>