Defined Type: monitoring::icinga::git_merge

Defined in:
modules/monitoring/manifests/icinga/git_merge.pp

Overview

This define allows you to monitor for unmerged remote changes to repositories that need manual merge in production as part of our workflow.

Parameters:

  • dir (Any) (defaults to: "/var/lib/git/operations/${title}")
  • user (Any) (defaults to: 'gitpuppet')
  • remote (Any) (defaults to: 'origin')
  • remote_branch (Any) (defaults to: 'production')
  • interval (Any) (defaults to: 10)
  • ensure (Any) (defaults to: present)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'modules/monitoring/manifests/icinga/git_merge.pp', line 4

define monitoring::icinga::git_merge (
    $dir           = "/var/lib/git/operations/${title}",
    $user          = 'gitpuppet',
    $remote        = 'origin',
    $remote_branch = 'production',
    $interval      = 10,
    $ensure        = present
    ) {
    $sane_title = regsubst($title, '\W', '_', 'G')

    nrpe::plugin { "check_${sane_title}-needs-merge":
        content => template('monitoring/check_git-needs-merge.erb'),
    }

    nrpe::monitor_service { "${sane_title}_merged":
        ensure       => $ensure,
        description  => "Unmerged changes on repository ${title}",
        nrpe_command => "/usr/local/lib/nagios/plugins/check_${sane_title}-needs-merge",
        sudo_user    => 'root',
        retries      => $interval,
        notes_url    => 'https://wikitech.wikimedia.org/wiki/Monitoring/unmerged_changes',
    }

    sudo::user { "${sane_title}_needs_merge":
        ensure => absent,
    }
}