| 1 | # SNMP::Info::Layer3::Meraki | ||
| 2 | # | ||
| 3 | # Copyright (c) 2024 SNMP::Info Developers | ||
| 4 | # All rights reserved. | ||
| 5 | # | ||
| 6 | # Redistribution and use in source and binary forms, with or without | ||
| 7 | # modification, are permitted provided that the following conditions are met: | ||
| 8 | # | ||
| 9 | # * Redistributions of source code must retain the above copyright notice, | ||
| 10 | # this list of conditions and the following disclaimer. | ||
| 11 | # * Redistributions in binary form must reproduce the above copyright | ||
| 12 | # notice, this list of conditions and the following disclaimer in the | ||
| 13 | # documentation and/or other materials provided with the distribution. | ||
| 14 | # * Neither the name of the University of California, Santa Cruz nor the | ||
| 15 | # names of its contributors may be used to endorse or promote products | ||
| 16 | # derived from this software without specific prior written permission. | ||
| 17 | # | ||
| 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 22 | # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 23 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 24 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 28 | # POSSIBILITY OF SUCH DAMAGE. | ||
| 29 | |||
| 30 | # I whipped this up from the suggestions in the included link and other pm files. | ||
| 31 | # https://sourceforge.net/p/netdisco/mailman/message/37257000/ | ||
| 32 | # - custom addition 4/25/24 | ||
| 33 | |||
| 34 | package SNMP::Info::Layer3::Meraki; | ||
| 35 | |||
| 36 | use strict; | ||
| 37 | use warnings; | ||
| 38 | use Exporter; | ||
| 39 | use SNMP::Info::Layer3; | ||
| 40 | |||
| 41 | @SNMP::Info::Layer3::Meraki::ISA = qw/SNMP::Info::Layer3 Exporter/; | ||
| 42 | @SNMP::Info::Layer3::Meraki::EXPORT_OK = qw//; | ||
| 43 | |||
| 44 | our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); | ||
| 45 | |||
| 46 | $VERSION = '3.985003'; | ||
| 47 | |||
| 48 | %MIBS = ( | ||
| 49 | %SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS, | ||
| 50 | ); | ||
| 51 | |||
| 52 | %GLOBALS = ( | ||
| 53 | %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer3::GLOBALS, | ||
| 54 | ); | ||
| 55 | |||
| 56 | %FUNCS = ( %SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer3::FUNCS, ); | ||
| 57 | |||
| 58 | %MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer3::MUNGE, ); | ||
| 59 | |||
| 60 | sub layers { | ||
| 61 | return '00000110'; | ||
| 62 | } | ||
| 63 | |||
| 64 | sub vendor { | ||
| 65 | return 'cisco meraki'; | ||
| 66 | } | ||
| 67 | |||
| 68 | # Keep a fallback for devices whose sysDescr is unavailable or differs | ||
| 69 | # from the usual form. These are Meraki product OID assignments from the | ||
| 70 | # MERAKI-CLOUD-CONTROLLER-MIB product tree. | ||
| 71 | my %MERAKI_PRODUCT_MODELS = ( | ||
| 72 | 1 => 'MINI', | ||
| 73 | 2 => 'ID2', | ||
| 74 | 3 => 'WPG', | ||
| 75 | 4 => 'OD1', | ||
| 76 | 5 => 'OD2', | ||
| 77 | 6 => 'OD3', | ||
| 78 | 7 => 'MO1', | ||
| 79 | 8 => 'SOL', | ||
| 80 | 9 => 'LR1', | ||
| 81 | 10 => 'MR11', | ||
| 82 | 11 => 'MR12', | ||
| 83 | 12 => 'MR14', | ||
| 84 | 13 => 'MR16', | ||
| 85 | 14 => 'MR24', | ||
| 86 | 15 => 'MR62', | ||
| 87 | 16 => 'MR66', | ||
| 88 | 17 => 'MR34', | ||
| 89 | 18 => 'MR18', | ||
| 90 | 19 => 'MR26', | ||
| 91 | 20 => 'MR32', | ||
| 92 | 21 => 'MR72', | ||
| 93 | 22 => 'MR42', | ||
| 94 | 23 => 'MR52', | ||
| 95 | 24 => 'MR53', | ||
| 96 | 25 => 'MR84', | ||
| 97 | 26 => 'MR30H', | ||
| 98 | 27 => 'MR33', | ||
| 99 | 28 => 'MR74', | ||
| 100 | 29 => 'MR70', | ||
| 101 | 30 => 'MR45', | ||
| 102 | 31 => 'MR55', | ||
| 103 | 32 => 'MR42E', | ||
| 104 | 33 => 'MR53E', | ||
| 105 | 34 => 'MR20', | ||
| 106 | 35 => 'GR10', | ||
| 107 | 36 => 'GR60', | ||
| 108 | 37 => 'MR36', | ||
| 109 | 38 => 'MR46', | ||
| 110 | 39 => 'MR46E', | ||
| 111 | 40 => 'MR56', | ||
| 112 | 41 => 'MR76', | ||
| 113 | 42 => 'MR86', | ||
| 114 | 43 => 'MR44', | ||
| 115 | 44 => 'MR36H', | ||
| 116 | 45 => 'MR28', | ||
| 117 | 46 => 'GR12', | ||
| 118 | 47 => 'GR62', | ||
| 119 | 48 => 'MR78', | ||
| 120 | 49 => 'MR57', | ||
| 121 | 50 => 'CW9162I', | ||
| 122 | 51 => 'CW9164I', | ||
| 123 | 52 => 'CW9166D1', | ||
| 124 | 53 => 'CW9166I', | ||
| 125 | 54 => 'CW9163E', | ||
| 126 | 55 => 'CW9176I', | ||
| 127 | 56 => 'CW9176D1', | ||
| 128 | 57 => 'CW9178I', | ||
| 129 | 58 => 'CW9172I', | ||
| 130 | 59 => 'CW9171I', | ||
| 131 | 60 => 'CW9172H', | ||
| 132 | 61 => 'CW9174E', | ||
| 133 | 62 => 'CW9174I', | ||
| 134 | 63 => 'CW9179F', | ||
| 135 | 100 => 'Z1', | ||
| 136 | |||
| 137 | # In older Dashboard copies of the MIB only | ||
| 138 | 101 => 'MX70', | ||
| 139 | 102 => 'MX80', | ||
| 140 | 103 => 'MX90', | ||
| 141 | 104 => 'MX400', | ||
| 142 | 105 => 'MX600', | ||
| 143 | 106 => 'MX100', | ||
| 144 | 107 => 'MX64', | ||
| 145 | 108 => 'MX64W', | ||
| 146 | 109 => 'MX84', | ||
| 147 | 110 => 'MX65', | ||
| 148 | 111 => 'MX65W', | ||
| 149 | 112 => 'MX250', | ||
| 150 | 113 => 'MX450', | ||
| 151 | 114 => 'MX650', | ||
| 152 | 116 => 'Z3', | ||
| 153 | 117 => 'GX20', | ||
| 154 | 118 => 'MX67', | ||
| 155 | 119 => 'MX67W', | ||
| 156 | 120 => 'MX67C', | ||
| 157 | 121 => 'MX68', | ||
| 158 | 122 => 'MX68W', | ||
| 159 | 123 => 'MX68CW', | ||
| 160 | 124 => 'Z3C', | ||
| 161 | 125 => 'MX85', | ||
| 162 | 126 => 'MX75', | ||
| 163 | 127 => 'MX95', | ||
| 164 | 128 => 'MX105', | ||
| 165 | 129 => 'GX50', | ||
| 166 | 130 => 'Z4', | ||
| 167 | 132 => 'C8455-G2', | ||
| 168 | 200 => 'Meraki VM10', | ||
| 169 | 300 => 'MS22', | ||
| 170 | 301 => 'MS22P', | ||
| 171 | 302 => 'MS42', | ||
| 172 | 303 => 'MS42P', | ||
| 173 | 304 => 'MS220-8', | ||
| 174 | 305 => 'MS220-8P', | ||
| 175 | 306 => 'MS220-24', | ||
| 176 | 307 => 'MS220-24P', | ||
| 177 | 308 => 'MS220-48', | ||
| 178 | 309 => 'MS220-48LP', | ||
| 179 | 310 => 'MS220-48FP', | ||
| 180 | 311 => 'MS320-24', | ||
| 181 | 312 => 'MS320-24P', | ||
| 182 | 313 => 'MS320-48', | ||
| 183 | 314 => 'MS320-48LP', | ||
| 184 | 315 => 'MS320-48FP', | ||
| 185 | 316 => 'MS420-24', | ||
| 186 | 317 => 'MS420-48', | ||
| 187 | 318 => 'MS350-24', | ||
| 188 | 319 => 'MS350-24P', | ||
| 189 | 320 => 'MS350-48', | ||
| 190 | 321 => 'MS350-48LP', | ||
| 191 | 322 => 'MS350-48FP', | ||
| 192 | 323 => 'MS410-16', | ||
| 193 | 324 => 'MS410-32', | ||
| 194 | 325 => 'MS425-16', | ||
| 195 | 326 => 'MS425-32', | ||
| 196 | 327 => 'MS350-24X', | ||
| 197 | 328 => 'MS225-24', | ||
| 198 | 329 => 'MS225-24P', | ||
| 199 | 330 => 'MS225-48', | ||
| 200 | 331 => 'MS225-48LP', | ||
| 201 | 332 => 'MS225-48FP', | ||
| 202 | 333 => 'MS250-24', | ||
| 203 | 334 => 'MS250-24P', | ||
| 204 | 335 => 'MS250-48', | ||
| 205 | 336 => 'MS250-48LP', | ||
| 206 | 337 => 'MS250-48FP', | ||
| 207 | 338 => 'MS120-8', | ||
| 208 | 339 => 'MS120-8LP', | ||
| 209 | 340 => 'MS120-8FP', | ||
| 210 | 341 => 'MS120-24', | ||
| 211 | 342 => 'MS120-24P', | ||
| 212 | 343 => 'MS120-48', | ||
| 213 | 344 => 'MS120-48LP', | ||
| 214 | 345 => 'MS210-24', | ||
| 215 | 346 => 'MS210-24P', | ||
| 216 | 347 => 'MS210-48', | ||
| 217 | 348 => 'MS210-48LP', | ||
| 218 | 349 => 'MS210-48FP', | ||
| 219 | 356 => 'MS120-48FP', | ||
| 220 | 357 => 'MS355-24X', | ||
| 221 | 358 => 'MS355-24X2', | ||
| 222 | 359 => 'MS355-48X', | ||
| 223 | 360 => 'MS355-48X2', | ||
| 224 | 361 => 'MS450-12', | ||
| 225 | 362 => 'MS390-24', | ||
| 226 | 363 => 'MS390-24P', | ||
| 227 | 364 => 'MS390-24U', | ||
| 228 | 365 => 'MS390-24UX', | ||
| 229 | 366 => 'MS390-48', | ||
| 230 | 367 => 'MS390-48P', | ||
| 231 | 368 => 'MS390-48U', | ||
| 232 | 369 => 'MS390-48UX', | ||
| 233 | 370 => 'MS390-48UX2', | ||
| 234 | 371 => 'MS125-24', | ||
| 235 | 372 => 'MS125-24P', | ||
| 236 | 373 => 'MS125-48', | ||
| 237 | 374 => 'MS125-48LP', | ||
| 238 | 375 => 'MS125-48FP', | ||
| 239 | |||
| 240 | # Cloud-managed Catalyst, not in the MIB; identified from Dashboard | ||
| 241 | 388 => 'C9300', | ||
| 242 | 395 => 'MS130-8', | ||
| 243 | 396 => 'MS130-8P', | ||
| 244 | 397 => 'MS130-8X', | ||
| 245 | 398 => 'MS130-12X', | ||
| 246 | 399 => 'MS130-24', | ||
| 247 | 400 => 'MS130-24P', | ||
| 248 | 401 => 'MS130-24X', | ||
| 249 | 402 => 'MS130-48', | ||
| 250 | 403 => 'MS130-48P', | ||
| 251 | 404 => 'MS130-48X', | ||
| 252 | 405 => 'MS130R-8P', | ||
| 253 | 443 => 'MS150-48MP-4X', | ||
| 254 | 444 => 'MS150-24T-4G', | ||
| 255 | 445 => 'MS150-24P-4G', | ||
| 256 | 446 => 'MS150-24T-4X', | ||
| 257 | 447 => 'MS150-24P-4X', | ||
| 258 | 448 => 'MS150-24MP-4X', | ||
| 259 | 449 => 'MS150-48T-4G', | ||
| 260 | 450 => 'MS150-48LP-4G', | ||
| 261 | 451 => 'MS150-48FP-4G', | ||
| 262 | 452 => 'MS150-48T-4X', | ||
| 263 | 453 => 'MS150-48LP-4X', | ||
| 264 | 454 => 'MS150-48FP-4X', | ||
| 265 | 483 => 'MS130-8P-I', | ||
| 266 | ); | ||
| 267 | |||
| 268 | sub model { | ||
| 269 | my $meraki = shift; | ||
| 270 | my $descr = $meraki->description() || ''; | ||
| 271 | |||
| 272 | # Meraki sysDescr values begin with the product model, for example: | ||
| 273 | # "Meraki MS120-8FP Cloud Managed PoE Switch". | ||
| 274 | # Some APs prefix it with "=", as in "=Meraki MR28 Cloud Managed AP". | ||
| 275 | if ( $descr =~ /^=?Meraki\s+(\S+)/i ) { | ||
| 276 | my $product = $1; | ||
| 277 | return $product | ||
| 278 | unless $product =~ /^(?:cloud|managed|network|networks|security | ||
| 279 | |wireless|access|switch|router)\b/ix; | ||
| 280 | } | ||
| 281 | |||
| 282 | # Otherwise map a registered Meraki sysObjectID suffix. | ||
| 283 | my $id = $meraki->id() || ''; | ||
| 284 | if ( $id =~ /(?:^|\.)29671\.2\.(\d+)$/ | ||
| 285 | and exists $MERAKI_PRODUCT_MODELS{$1} ) | ||
| 286 | { | ||
| 287 | return $MERAKI_PRODUCT_MODELS{$1}; | ||
| 288 | } | ||
| 289 | |||
| 290 | return $meraki->SUPER::model(); | ||
| 291 | } | ||
| 292 | |||
| 293 | sub serial1 { | ||
| 294 | my $meraki = shift; | ||
| 295 | my $serial = $meraki->entity_derived_serial(); | ||
| 296 | return $serial if defined $serial and $serial !~ /^\s*$/; | ||
| 297 | return; | ||
| 298 | } | ||
| 299 | |||
| 300 | 1; | ||
| 301 | __END__ |