Defined Type: mtail::program

Defined in:
puppet/modules/mtail/manifests/program.pp

Overview

Define: mtail::program

Install an mtail “program” to extract metrics from log files.

Parameters

ensure

The usual metaparameter.

content

The content of the file provided as a string. Either this or 'source' must be specified.

source

The content of the file provided as a puppet:/// file reference. Either this or 'content' must be specified.

destination

The directory where the mtail script will be installed provided as a string. Defaults to '/etc/mtail'.

Parameters:

  • ensure (Any) (defaults to: present)
  • content (Any) (defaults to: undef)
  • source (Any) (defaults to: undef)
  • destination (Any) (defaults to: '/etc/mtail')


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'puppet/modules/mtail/manifests/program.pp', line 22

define mtail::program(
    $ensure      = present,
    $content     = undef,
    $source      = undef,
    $destination = '/etc/mtail',
) {
    include ::mtail

    $basename = regsubst($title, '\W', '-', 'G')
    $filename = "${destination}/${basename}.mtail"

    if !defined(File[$destination]) {
        file { $destination:
            ensure => directory,
            owner  => 'root',
            group  => 'root',
            mode   => '0755',
        }
    }

    file { $filename:
        ensure  => $ensure,
        content => $content,
        source  => $source,
        notify  => Service['mtail'],
        require => File[$destination],
    }
}