Projet

Général

Profil

Révision a4dbacad

IDa4dbacada0790e70ebab9c4063956e41d57e2ced
Parent 4943ded3
Enfant 3b62e607

Ajouté par Diego Elio Pettenò il y a environ 13 ans

snmp__if_combined: restore the error graphing as it's done on snmp__if_multi

This brings it basically on feature parity with it, and more.

Voir les différences:

plugins/snmp/snmp__if_combined
454 454
	  # 7) lowerLayerDown
455 455
	  8  => 'ifOperStatus',
456 456
	  10 => 'ifInOctets',
457
	  13 => 'ifInDiscards',
458
	  14 => 'ifInErrors',
457 459
	  16 => 'ifOutOctets',
460
	  19 => 'ifOutDiscards',
461
	  20 => 'ifOutErrors',
458 462
	});
459 463

  
460 464
    # ifXEntry - SNMP v2 and up only - on some devices
......
580 584
send$if.negative recv$if
581 585
END
582 586
    }
587

  
588
    print <<END;
589

  
590
multigraph snmp_if_combined_err
591
graph_title $host interfaces errors
592
graph_args --base 1000
593
graph_vlabel errors in (-) / out (+) per \${graph_period}
594
graph_category network
595
END
596

  
597
    print "graph_order";
598
    foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
599
      print " recv$if=snmp_if_combined_err.$if.recv send$if=snmp_if_combined_err.$if.send";
600
    }
601
    print "\n";
602

  
603
    foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
604
      my $alias = $snmpinfo->{$if}->{ifDescr} || "Interface $if";
605

  
606
      if (! ($alias =~ /\d+/) ) {
607
	# If there are no numbers in the $alias add the if index
608
	$alias .=" (if $if)";
609
      }
610

  
611
      print <<END;
612
recv$if.label $alias
613
recv$if.graph no
614
send$if.label $alias
615
send$if.negative recv$if
616
END
617
    }
583 618
}
584 619

  
585 620
sub do_config_if {
......
644 679
      printf("recv.warning %s\nsend.warning %s\n", $warn, $warn);
645 680
    }
646 681

  
647
    if ( $ENV{MUNIN_CAP_DIRTYCONFIG} == 1 ) {
648
      do_fetch_if($if);
649
    }
682
    print <<END;
683
multigraph snmp_if_combined_err.$if
684
graph_title $alias errors
685
graph_args --base 1000
686
graph_vlabel errors in (-) / out (+) per \${graph_period}
687
graph_category network
688

  
689
recv.label recv
690
recv.type DERIVE
691
recv.graph no
692
recv.min 0
693
send.label Errors
694
send.type DERIVE
695
send.negative recv
696
send.min 0
697
END
650 698
}
651 699

  
652 700
sub do_fetch_if {
......
660 708
    # 2 means set to down
661 709
    # Everything else we ignore.
662 710

  
711
    print "multigraph snmp_if_combined.$if\n";
712

  
663 713
    if ($status == 2) {
664 714
	# Interface is down
665 715
	print "recv.value U\n";
666 716
	print "send.value U\n";
667 717
	print "send.extinfo This interface is currently down.\n";
668
	return;
718
	goto if_errors;
669 719
    }
670 720

  
671 721
    if (defined ($response = $snmpinfoX->{$if}->{ifHCInOctets} ||
......
683 733
	# No response...
684 734
	print "send.value U\n";
685 735
    }
736

  
737
  if_errors:
738

  
739
    print "multigraph snmp_if_combined_err.$if\n";
740

  
741
    if ($status == 2) {
742
	print "recv.value U\n";
743
	print "send.value U\n";
744
	print "send.extinfo This interface is down\n";
745
	return;
746
    }
747

  
748
    $response = ( $snmpinfo->{$if}->{ifInErrors} || 0 ) +
749
      ( $snmpinfo->{$if}->{ifInDiscards} || 0 );
750

  
751
    print "recv.value $response\n";
752

  
753
    $response = ( $snmpinfo->{$if}->{ifOutErrors} || 0 ) +
754
      ( $snmpinfo->{$if}->{ifOutDiscards} || 0 );
755

  
756
    print "send.value $response\n";
686 757
}
687 758

  
688 759

  
......
710 781
}
711 782

  
712 783
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
713
    print "multigraph snmp_if_combined.$if\n";
714

  
715 784
    do_fetch_if($if);
716 785
}

Formats disponibles : Unified diff