Skip to content

Instantly share code, notes, and snippets.

@blkperl
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save blkperl/9826382 to your computer and use it in GitHub Desktop.

Select an option

Save blkperl/9826382 to your computer and use it in GitHub Desktop.
class role::leonardo::client {
$dashboard_root = '/opt/leonardo/graphs/servers',
$collectd_name = regsubst($::fqdn, '\.', '_', 'G'),
$dashboard_dir = "${dashboard_root}/${::hostname}",
# Each dashboard needs a directory to hold the graph files
@@file { $dashboard_dir:
ensure => directory,
mode => '0755',
tag => "env_leonardo_${environment}",
}
# Each dashboard needs a a dash.yaml file
@@leonardo::dashboard { $::hostname:
target => "${dashboard_dir}/dash.yaml",
name => $::hostname,
description => 'System Metrics',
include_properties => ['common.yaml'],
tag => "env_leonardo_${environment}",
require => File[$dashboard_dir],
}
# Export a cpu graph
@@leonardo::graph { "${::hostname}-cpu":
target => "${dashboard_dir}/10-cpu.graph",
parameters => { 'title' => 'Combined CPU Usage',
'vtitle' => 'percent',
'area' => 'stacked' },
fields => {
'iowait' => { 'data' => "sumSeries(collectd.${collectd_name}.cpu*.cpu-wait)",},
'system' => { 'data' => "sumSeries(collectd.${collectd_name}.cpu*.cpu-system)",},
'user' => { 'data' => "sumSeries(collectd.${collectd_name}.cpu*.cpu-user)",},
},
tag => "env_leonardo_${environment}",
require => File[$dashboard_dir],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment