Projet

Général

Profil

Révision c0108c95

IDc0108c9583c776286507aaac8370c2bb5b1da591
Parent 4ce9e742
Enfant 6906c857

Ajouté par Kai il y a environ 5 ans

Fixed data for UAP

Data for UAP's is (now?) encapsulated within 'stat'->'ap', changed reference to reflect this change.
Also: Fixed handling of uninitialized values in case they do not exist (// 0).

Voir les différences:

plugins/ubiquiti/unifi_api
789 789
		if ( $Data{'device'}{$thisDevice}->{'type'} ne "uap" ) { next; }
790 790

  
791 791
		foreach ( @{$Data{'device'}{$thisDevice}{'radio'}} ) {
792
			print $thisDevice , "_" , $_->{"name"} , "_pack.value " , $_->{"pckt"} , "\n";;
792
			print $thisDevice , "_" , $_->{"name"} , "_pack.value " , ($_->{"pckt"} // 0), "\n";;
793 793
		}
794 794
	}
795 795

  
......
801 801
		print "multigraph unifi_xfer_per_radio.$thisDevice\n";
802 802

  
803 803
		foreach ( @{$Data{'device'}{$thisDevice}{'radio'}} ) {
804
			print $_->{"name"} , "_pkt.value "  , $_->{"pckt"} , "\n";
805
			print $_->{"name"} , "_dret.value " , $_->{"dret"} , "\n";
806
			print $_->{"name"} , "_err.value "  , $_->{"err"}  , "\n";
804
			print $_->{"name"} , "_pkt.value "  , ($_->{"pckt"} // 0) , "\n";
805
			print $_->{"name"} , "_dret.value " , ($_->{"dret"} // 0) , "\n";
806
			print $_->{"name"} , "_err.value "  , ($_->{"err"} // 0) , "\n";
807 807
		}
808 808
	}
809 809
	return 1;
......
816 816
	print "multigraph unifi_xfer_per_network\n";
817 817

  
818 818
	foreach my $thisNet ( sort keys %{$Data{'networks'}} ) {
819
		print $thisNet , "_rxbytes.value " , $Data{'networks'}{$thisNet}->{"rx"} , "\n";
820
		print $thisNet , "_txbytes.value " , $Data{'networks'}{$thisNet}->{"tx"} , "\n";
819
		print $thisNet , "_rxbytes.value " , ($Data{'networks'}{$thisNet}->{"rx"} // 0) , "\n";
820
		print $thisNet , "_txbytes.value " , ($Data{'networks'}{$thisNet}->{"tx"} // 0) , "\n";
821 821
	}
822 822

  
823 823
	if ( ! $PluginConfig{'enable_detail_xfer_network'} ) { return 1; }
824 824

  
825 825
	foreach my $thisNet ( sort keys %{$Data{'networks'}} ) {
826 826
		print "multigraph unifi_xfer_per_network.$thisNet\n";
827
		print "rxbyte.value " , $Data{'networks'}{$thisNet}->{"rx"} , "\n";
828
		print "txbyte.value " , $Data{'networks'}{$thisNet}->{"tx"} , "\n";
827
		print "rxbyte.value " , ($Data{'networks'}{$thisNet}->{"rx"} // 0) , "\n";
828
		print "txbyte.value " , ($Data{'networks'}{$thisNet}->{"tx"} // 0) , "\n";
829 829
	}
830 830
	return 1;
831 831
}
......
1026 1026
				my $name  = make_safe( $thisRadio->{'name'}, "" );
1027 1027
				my $label = ( $thisRadio->{'channel'} < 12 ) ? '2.4Ghz' : '5Ghz';
1028 1028

  
1029
				$_ = $thisDevice->{'stat'};
1029
				$_ = $thisDevice->{'stat'}->{'ap'};
1030 1030

  
1031 1031
				push @theseRadios, {
1032 1032
					'name'  => $name,
1033 1033
					'label' => $label . '-' . $thisDevice->{'name'},
1034
					'pckt'  => $_->{$name . '-rx_packets'} + $_->{$name . '-tx_packets'},
1035
					'dret'  => $_->{$name . '-rx_dropped'} + $_->{$name . '-tx_retries'} + $_->{$name . '-tx_dropped'},
1036
					'err'   => ($_->{$name . '-rx_errors'} || 0) + ($_->{$name . '-tx_errors'} || 0),
1034
					'pckt'  => ($_->{$name . '-rx_packets'} // 0) + ($_->{$name . '-tx_packets'} // 0),
1035
					'dret'  => ($_->{$name . '-rx_dropped'} // 0) + ($_->{$name . '-tx_retries'} // 0) + ($_->{$name . '-tx_dropped'} // 0),
1036
					'err'   => ($_->{$name . '-rx_errors'} // 0) + ($_->{$name . '-tx_errors'} // 0),
1037 1037
					'type'  => $label
1038 1038
				};
1039 1039
			}

Formats disponibles : Unified diff