Test check_centreon_snmp_traffic to detect the NIC traffic of windows. It can detect the NIC traffic of the switch, but cannot detect the eth0 Nic of the Linux virtual machine. The error is error: Card speed is null, check Command Options.
To fix this error, follow these steps:
Place
If(!$ Speed_card&&!Defined($ Opt_t)){Print "Error: Card speed is null, check Command Options \ n";Exit $ Errors{'Unknown'};}
Change
If (!$ Speed_card &&! Defined ( $ Opt_t )){ # Print "error: Card speed is null, check Command Options \ n"; # exit $ errors {'unknown '}; # xiugai If (! Defined ( $ In_bits )&&! Defined ( $ Out_bits )){ Print " Error: Card speed is null, check Command Options \ n " ; Exit $ Errors { ' Unknown ' };} # Set Default 100 MB $ Speed_card = 100000000 ;}
That is, when the network card speed ($ speed_card = 0) is not detected, but the network card Traffic value ($ in_bits and $ out_bits) is obtained, the network card speed is assigned to 100000000 by default, 100 MB. In this way, we can get the detection result. Because the-W and-C parameters use percentages, pay attention to the value size when setting these two parameters.
In addition, by default, the command line does not output status results. You can make the following changes to make the output results contain status strings, such as OK at the beginning of the following:
OK: Traffic in:30.04MB/s (3.0%), Out:4.80MB/s (0.5%) | Traffic_in =30039837, 6 bits/s;40000000;200000000;0;1000000000Traffic_out =4801448, 7 bits/s;40000000;200000000;0;1000000000
The modification method is to put
Printf ( " Traffic in: %. 2f " . $ In_prefix . " B/S ( " . $ In_usage . " %), Out: %. 2f " .$ Out_prefix . " B/S ( " . $ Out_usage . " %) " , $ In_traffic , $ Out_traffic );
Change
Printf ( $ Status ." : Traffic in: %. 2f " . $ In_prefix . " B/S ( " . $ In_usage . " %), Out: %. 2f " . $ Out_prefix ." B/S ( " . $ Out_usage . " %) " , $ In_traffic , $ Out_traffic );