Defined Type: netops::check

Defined in:
modules/netops/manifests/check.pp

Overview

Parameters:

  • ipv4 (Any)
  • ipv6 (Any) (defaults to: undef)
  • snmp_community (Any) (defaults to: undef)
  • group (Any) (defaults to: 'network')
  • alarms (Any) (defaults to: false)
  • bfd (Any) (defaults to: false)
  • bgp (Any) (defaults to: false)
  • critical (Any) (defaults to: false)
  • interfaces (Any) (defaults to: false)
  • parents (Any) (defaults to: undef)
  • os (Any) (defaults to: undef)
  • ospf (Any) (defaults to: false)
  • vcp (Any) (defaults to: false)
  • vrrp_peer (Any) (defaults to: false)


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'modules/netops/manifests/check.pp', line 60

define netops::check(
    $ipv4,
    $ipv6=undef,
    $snmp_community=undef,
    $group='network',
    $alarms=false,
    $bfd=false,
    $bgp=false,
    $critical=false,
    $interfaces=false,
    $parents=undef,
    $os=undef,
    $ospf=false,
    $vcp=false,
    $vrrp_peer=false,
) {

    # If we get an array convert it to a comma separated string
    if $parents and is_array($parents) {
        $real_parents = join($parents, ',')
    # Otherwise, pass it as is (undef or string)
    } else {
        $real_parents = $parents
    }

    @monitoring::host { $title:
        critical   => $critical,
        ip_address => $ipv4,
        group      => $group,
        parents    => $real_parents,
        os         => $os,
    }

    if $ipv6 {
        @monitoring::host { "${title} IPv6":
            ip_address => $ipv6,
            group      => $group,
        }
    }

    if $alarms {
      $monitor_enable='present'
    } else {
      $monitor_enable='absent'
    }
    @monitoring::service { "${title} Juniper alarms":
        ensure        => $monitor_enable,
        host          => $title,
        group         => $group,
        description   => 'Juniper alarms',
        check_command => "check_jnx_alarms!${snmp_community}",
        notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#Juniper_alarm',
    }

    if $interfaces {
        @monitoring::service { "${title} interfaces":
            host          => $title,
            group         => $group,
            description   => 'Router interfaces',
            check_command => "check_ifstatus_nomon!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#Router_interface_down',
        }
    }

    if $bgp {
        @monitoring::service { "${title} BGP status":
            host          => $title,
            group         => $group,
            description   => 'BGP status',
            check_command => "check_bgp!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#BGP_status',
        }
    }

    if $vcp {
        @monitoring::service { "${title} VCP status":
            host          => $title,
            group         => $group,
            description   => 'Juniper virtual chassis ports',
            check_command => "check_vcp!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#VCP_status',
        }
    }

    if $vrrp_peer {
        @monitoring::service { "${title} VRRP status":
            host          => $title,
            group         => $group,
            description   => 'VRRP status',
            check_command => "check_vrrp!${vrrp_peer}!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#VRRP_status',
        }
    }

    if $bfd {
        @monitoring::service { "${title} BFD status":
            host          => $title,
            group         => $group,
            description   => 'BFD status',
            check_command => "check_bfd!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#BFD_status',
        }
    }

    if $ospf {
        @monitoring::service { "${title} OSPF status":
            host          => $title,
            group         => $group,
            description   => 'OSPF status',
            check_command => "check_ospf!${snmp_community}",
            notes_url     => 'https://wikitech.wikimedia.org/wiki/Network_monitoring#OSPF_status',
        }
    }
}