## diskstats.pp

define munin_node::diskstats () {
munin_node::plugin{"diskstat_iops_$name": plugin_name => "diskstat_" }

$disk_type=regsubst($name,'^(..).*$','\\1')
notify{"$name: disk type = $disktype":}

if "md" != regsubst($name,'^(..).*$','\\1') {
munin_node::plugin{"diskstat_latency_$name": plugin_name => "diskstat_" }
}

munin_node::plugin{"diskstat_throughput_$name": plugin_name => "diskstat_" }
include munin_node::install_diskstats
}
class munin_node::install_diskstats {
file { "/usr/share/munin/plugins/diskstat_":
source => "puppet:///munin_node/diskstat_",
owner => root,
group => root,
mode => 755,
}
}

## output
notice: Starting catalog run
notice: md6: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[md6]/Notify[md6: disk type = ]/message: defined 'message' as 'md6: disk type = '
notice: sdd: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[sdd]/Notify[sdd: disk type = ]/message: defined 'message' as 'sdd: disk type = '
notice: sdb: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[sdb]/Notify[sdb: disk type = ]/message: defined 'message' as 'sdb: disk type = '
notice: md5: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[md5]/Notify[md5: disk type = ]/message: defined 'message' as 'md5: disk type = '
notice: sdc: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[sdc]/Notify[sdc: disk type = ]/message: defined 'message' as 'sdc: disk type = '
notice: sda: disk type =
notice: //Node[stanmore]/Munin_node::Diskstats[sda]/Notify[sda: disk type = ]/message: defined 'message' as 'sda: disk type = '
notice: Finished catalog run in 4.06 seconds