Check_centreon_snmp_traffic plugin bug fixes for Linux Virtual Machine Nic monitoring

Source: Internet
Author: User

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 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.