The sending and receiving of Linux Snmptrap

Source: Internet
Author: User
Tags snmp snmpwalk cpu usage

The sending and receiving of Linux Snmptrap

Because of the need to manage some parameters of the server, such as CPU usage, iowait, and so on, the manager will poll the managed server through Snmpwalk for five minutes.

Such indicators are business indicators, are necessary to understand some of the parameters, but also need to have alarm indicator information.

However, because the alarm information is usually the active alarm by the managed server, it is not possible to use the Snmpwalk by the management actively, but by the managed server through the snmptrap.


Here are some settings for snmptrap on both sides.

The first is the management, you need to configure the snmptrapd.conf, you can put it in the same path as snmpd.conf, in my local environment for (/ETC/SNMP/SNMPTRAPD.CONF)

Configuration code:  conf Code   authcommunity execute,log,net public    traphandle  .1.3.6.1.4.1.2021.251.1 /root/traptest/test.pl   where authcommunity is to set access rights for all users: executable, record, pass.   Set Traphandle (that is, execute test.pl when you receive the. 1.3.6.1.4.1.2021.251.1 Class OID information).   test.pl content:  perl code   #!/usr/bin/perl  use strict;  my  $file = "File.trap";   open (Handout, ">>./$file");   while (<STDIN>)   {       print HANDOUT  "$_";  }   then enter the command:  linux code   snmptrapd -c /etc/snmp/snmptrapd.conf    set this profile as the default profile and start the SNMPTRAPD process:  linux code     # snmptrapd -d -f -Lo    on the managed side, use the command:  linux code   snmptrap -v 2c -c public 10.0.0.214:162  "" &NBSP;. 1.3.6.1.4.1.2021.251.1 syslocation.0 s  "this is Test     The following information will be received by the management:  linux code &NBSP;&NBSP;RECEIVED&NBSP;98&NBSP;BYTES&NBSP;FROM&NBSP;UDP:  [221.176.14.88]:58750  0000: 30 60 02 01  01 04 06  70  75 62 6c 69  63 a7 53 02    0 ' ... public. s.  0016: 04 1b ce 4f  f1 02 01 00  02  01&NBSP;00&NBSP;30&NBSP;&NBSP;45&NBSP;30&NBSP;10&NBSP;06&NBSP;&NBSP;&NBSP;&NBSP, ..... O....... 0E0..   0032: 08 2b 06 01  02 01 01 03  00 43  04 28  8d b0 5b 30    .+ ..... C. (.. [0  0048: 18 06 0a 2b  06 01 06 03  01  01 04 01  00 06 0a 2b    ...+...........+   0064: 06 01 04 01  8f 65 81 7b  01 30 17 06  08 2b 06  01    .....e.{.0...+.   0080: 02 01 01 06  00 04 0b 6c  6f 6e  67 74  65 6e 67 66    .......this is test   0096: 65 69                                                      2012-07-16 10:44:17 <UNKNOWN> [UDP: [221.176.14.88]:58750]:   DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks:  (680374363)  78 days,  17:55:43.63   snmpv2-mib::snmptrapoid.0 = oid: ucd-snmp-mib::ucdstart snmpv2-mib::syslocation.0 = string: this is test    so far, The simplest snmptrap send and receive is complete.


The sending and receiving of Linux Snmptrap

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.