Defined Type: netops::check

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

Overview

Parameters:

  • ipv4 (Stdlib::IP::Address::V4)
  • ipv6 (Optional[Stdlib::IP::Address::V6]) (defaults to: undef)
  • snmp_community (Optional[String]) (defaults to: undef)
  • group (String) (defaults to: 'network')
  • alarms (Boolean) (defaults to: false)
  • bfd (Boolean) (defaults to: false)
  • bgp (Boolean) (defaults to: false)
  • critical (Boolean) (defaults to: false)
  • interfaces (Boolean) (defaults to: false)
  • parents (Optional[Array[Stdlib::Host]]) (defaults to: undef)
  • os (Optional[String]) (defaults to: undef)
  • ospf (Boolean) (defaults to: false)
  • vcp (Boolean) (defaults to: false)
  • vrrp_peer (Optional[String]) (defaults to: undef)
  • site (Optional[Wmflib::Sites]) (defaults to: undef)
  • role (Optional[String]) (defaults to: undef)


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
174
175
176
177
178
179
180
181
# File 'modules/netops/manifests/check.pp', line 67

define netops::check(
    Stdlib::IP::Address::V4 $ipv4,
    Optional[Stdlib::IP::Address::V6] $ipv6 = undef,
    Optional[String] $snmp_community        = undef,
    String $group                           = 'network',
    Boolean $alarms                         = false,
    Boolean $bfd                            = false,
    Boolean $bgp                            = false,
    Boolean $critical                       = false,
    Boolean $interfaces                     = false,
    Optional[Array[Stdlib::Host]] $parents  = undef,
    Optional[String] $os                    = undef,
    Boolean $ospf                           = false,
    Boolean $vcp                            = false,
    Optional[String] $vrrp_peer             = undef,
    Optional[Wmflib::Sites] $site           = undef,
    Optional[String] $role                  = undef,
) {

    # If we get an array convert it to a comma separated string
    $real_parents = $parents ? {
        Array   => $parents.join(','),
        default => $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,
            os         => $os,
        }
    }

    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',
        }
    }
}