diff --git a/manifests/checks/cpu.pp b/manifests/checks/cpu.pp new file mode 100644 index 0000000..b4a93a3 --- /dev/null +++ b/manifests/checks/cpu.pp @@ -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) + } +} \ No newline at end of file diff --git a/manifests/checks/disk.pp b/manifests/checks/disk.pp new file mode 100644 index 0000000..d97c27e --- /dev/null +++ b/manifests/checks/disk.pp @@ -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) + } +} \ No newline at end of file diff --git a/manifests/checks/instances/cpu.pp b/manifests/checks/instances/cpu.pp new file mode 100644 index 0000000..d077a48 --- /dev/null +++ b/manifests/checks/instances/cpu.pp @@ -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', + } +} diff --git a/manifests/checks/instances/disk.pp b/manifests/checks/instances/disk.pp new file mode 100644 index 0000000..d5dda72 --- /dev/null +++ b/manifests/checks/instances/disk.pp @@ -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', + } +} diff --git a/manifests/checks/instances/load.pp b/manifests/checks/instances/load.pp new file mode 100644 index 0000000..0321177 --- /dev/null +++ b/manifests/checks/instances/load.pp @@ -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', + } +} diff --git a/manifests/checks/instances/memory.pp b/manifests/checks/instances/memory.pp new file mode 100644 index 0000000..021e792 --- /dev/null +++ b/manifests/checks/instances/memory.pp @@ -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', + } +} diff --git a/manifests/checks/load.pp b/manifests/checks/load.pp new file mode 100644 index 0000000..e866a7b --- /dev/null +++ b/manifests/checks/load.pp @@ -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) + } +} \ No newline at end of file diff --git a/manifests/checks/memory.pp b/manifests/checks/memory.pp new file mode 100644 index 0000000..8fa9f0a --- /dev/null +++ b/manifests/checks/memory.pp @@ -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) + } +} \ No newline at end of file diff --git a/manifests/checks/network.pp b/manifests/checks/network.pp index a8d8708..656ed8f 100644 --- a/manifests/checks/network.pp +++ b/manifests/checks/network.pp @@ -15,7 +15,7 @@ # dimensions # e.g. # instances: -# net: +# network_stats: # collect_connection_state: 'False' # excluded_interfaces: '[lo, lo0]' # diff --git a/templates/checks/cpu.erb b/templates/checks/cpu.erb new file mode 100644 index 0000000..1fff41a --- /dev/null +++ b/templates/checks/cpu.erb @@ -0,0 +1,7 @@ + - name: <%= @title %> +<%- if not @send_rollup_stats.nil? -%> + send_rollup_stats: <%= @send_rollup_stats %> +<%- end -%> +<%- if @dimensions -%> + dimensions: <%= @dimensions %> +<%- end -%> \ No newline at end of file diff --git a/templates/checks/disk.erb b/templates/checks/disk.erb new file mode 100644 index 0000000..2b92858 --- /dev/null +++ b/templates/checks/disk.erb @@ -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 -%> \ No newline at end of file diff --git a/templates/checks/load.erb b/templates/checks/load.erb new file mode 100644 index 0000000..46f1446 --- /dev/null +++ b/templates/checks/load.erb @@ -0,0 +1,4 @@ + - name: <%= @title %> +<%- if @dimensions -%> + dimensions: <%= @dimensions %> +<%- end -%> \ No newline at end of file diff --git a/templates/checks/memory.erb b/templates/checks/memory.erb new file mode 100644 index 0000000..46f1446 --- /dev/null +++ b/templates/checks/memory.erb @@ -0,0 +1,4 @@ + - name: <%= @title %> +<%- if @dimensions -%> + dimensions: <%= @dimensions %> +<%- end -%> \ No newline at end of file