Projet

Général

Profil

Révision 66d48afb

ID66d48afbbb2f99ed10a0cb548fc681cbc3f5e482
Parent 7724b4cd
Enfant 04def756

Ajouté par Lars Kruse il y a environ 9 ans

[asterisk] fix codecs accounting (Closes: #699)

The following issues are fixed by lelutin:
  • line ending matching does not match for lines that only use \n as
    line ending
  • iteration is broken because the index for setting values in the
    codecs accounting array is never reset to 0 before new loops.
  • iax channels don't use a codec hex value, but rather their names
    (sip still uses the hex values as far as I can see)

see https://github.com/munin-monitoring/contrib/issues/699

Voir les différences:

plugins/asterisk/asterisk
320 320
  }
321 321

  
322 322
  # split the channels' listing and drop header and footnotes
323
  my @sipchannels = $sipchannels_response ? split(/\r\n/, $sipchannels_response) : ();
323
  my @sipchannels = $sipchannels_response ? split(/\r\n|\n/, $sipchannels_response) : ();
324 324
  pop(@sipchannels); shift(@sipchannels);
325
  my @iaxchannels = $iaxchannels_response ? split(/\r\n/, $iaxchannels_response) : ();
325
  my @iaxchannels = $iaxchannels_response ? split(/\r\n|\n/, $iaxchannels_response) : ();
326 326
  pop(@iaxchannels); shift(@iaxchannels);
327 327

  
328
  $i = 0;
328 329
  foreach my $sipchan (@sipchannels) {
329 330
    my $found = 0;
330 331
    my @fields = split ' ', $sipchan;
......
346 347
    }
347 348
  }
348 349

  
350
  $i = 0;
349 351
  foreach my $iaxchan (@iaxchannels) {
350 352
    my $found = 0;
351 353
    my @fields = split ' ', $iaxchan;
......
354 356
      $unknown += 1;
355 357
      next;
356 358
    }
357
    foreach my $codec (@CODECSX) {
359
    foreach my $codec (@CODECS) {
358 360
      if ($fields[8] eq "$codec") {
359 361
	$results[$i] = $results[$i] + 1;
360 362
	$found = 1;

Formats disponibles : Unified diff