Ad Widget

Collapse

command-line import/export facility dynamic items, triggers and graphs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DB601
    Member
    • Jun 2010
    • 30

    #16
    hello,

    i want execute this script and i followed these steps but i have this msg:
    " -bash: ./cisco_xml.pl: /usr/bin/perl^M: bad interpreter: No such file or directory "

    can someone help me please!!!!!!!!!!!!!!!! i'm confused :'(

    thank you



    Originally posted by dima_dm
    You can:
    1) Configure SNMP on switch or router

    On Zabbix Server
    2) check SNMP configuration on device
    HostIP - IP of you device
    public - SNMP community
    Example:
    snmpwalk -v 2c -c public HostIP .1.3.6.1.2.1.2.2.1.1
    IF-MIB::ifIndex.1 = INTEGER: 1
    IF-MIB::ifIndex.2 = INTEGER: 2
    IF-MIB::ifIndex.3 = INTEGER: 3
    IF-MIB::ifIndex.4 = INTEGER: 4
    IF-MIB::ifIndex.5 = INTEGER: 5
    IF-MIB::ifIndex.6 = INTEGER: 6
    IF-MIB::ifIndex.7 = INTEGER: 7
    IF-MIB::ifIndex.8 = INTEGER: 8
    IF-MIB::ifIndex.9 = INTEGER: 9
    IF-MIB::ifIndex.10 = INTEGER: 10
    IF-MIB::ifIndex.11 = INTEGER: 11
    IF-MIB::ifIndex.12 = INTEGER: 12
    IF-MIB::ifIndex.13 = INTEGER: 13
    IF-MIB::ifIndex.14 = INTEGER: 14
    IF-MIB::ifIndex.15 = INTEGER: 15
    IF-MIB::ifIndex.16 = INTEGER: 16
    IF-MIB::ifIndex.17 = INTEGER: 17
    IF-MIB::ifIndex.18 = INTEGER: 18
    IF-MIB::ifIndex.19 = INTEGER: 19
    IF-MIB::ifIndex.20 = INTEGER: 20
    IF-MIB::ifIndex.21 = INTEGER: 21
    IF-MIB::ifIndex.22 = INTEGER: 22
    IF-MIB::ifIndex.23 = INTEGER: 23
    IF-MIB::ifIndex.24 = INTEGER: 24
    IF-MIB::ifIndex.25 = INTEGER: 25
    IF-MIB::ifIndex.26 = INTEGER: 26
    IF-MIB::ifIndex.27 = INTEGER: 27
    IF-MIB::ifIndex.28 = INTEGER: 28
    IF-MIB::ifIndex.29 = INTEGER: 29
    IF-MIB::ifIndex.30 = INTEGER: 30
    IF-MIB::ifIndex.31 = INTEGER: 31
    IF-MIB::ifIndex.32 = INTEGER: 32
    IF-MIB::ifIndex.33 = INTEGER: 33
    IF-MIB::ifIndex.34 = INTEGER: 34
    IF-MIB::ifIndex.35 = INTEGER: 35
    IF-MIB::ifIndex.36 = INTEGER: 36
    IF-MIB::ifIndex.37 = INTEGER: 37
    3) run script
    ./cisco_xml.pl Hostname HostIP 75 5 public 5 lab-cisco
    Where
    Hostname - Name of you device
    HostIP - IP of you device
    public - SNMP community
    lab-cisco - Zabbix Group for device (group must exist in Zabbix)
    4) Import xml file Template_Hostname.xml into Zabbix
    5) Create host Hostname and link it with Template_Hostname

    Comment

    • canepan
      Junior Member
      • Jul 2010
      • 3

      #17
      Not a Zabbix problem

      You need to have the perl interpreter installed in /usr/bin for the script to work properly.
      Also, the windows CR/LF should be converted in Unix format (with dos2unix or similar)
      Last edited by canepan; 06-07-2010, 13:31.

      Comment

      • DB601
        Member
        • Jun 2010
        • 30

        #18
        What's CR/LF ??
        i tried to download perl for a second time in user/bin but i have always the same msg!

        Comment

        • canepan
          Junior Member
          • Jul 2010
          • 3

          #19
          CR/LF is the way windows writes end-of-line in text files.
          Unix only uses LF, so ou have to change it for the script to work.
          A command which works with all distros is:

          tr -d '\r' < input.file > output.file

          Comment

          • DB601
            Member
            • Jun 2010
            • 30

            #20
            thanks ! now it works but i still have a problem with the compilation
            i have this :

            Host: Template_Routeur_A
            IP: 10.192.2.1
            Percent: 75
            Comm string: SNMP
            Slow: community
            Groups: 5
            Fan not fountd. ERROR: No response from remote host '10.192.2.1'.
            ERROR: No response from remote host '10.192.2.1'.


            do you now why?

            Comment

            • dima_dm
              Senior Member
              • Dec 2009
              • 2697

              #21
              Originally posted by DB601
              thanks ! now it works but i still have a problem with the compilation
              i have this :

              Host: Template_Routeur_A
              IP: 10.192.2.1
              Percent: 75
              Comm string: SNMP
              Slow: community
              Groups: 5
              Fan not fountd. ERROR: No response from remote host '10.192.2.1'.
              ERROR: No response from remote host '10.192.2.1'.


              do you now why?
              1) Configure SNMP on switch or router
              XXXXXX - community
              Example:
              snmp-server community XXXXXX RO 1

              access-list 1 permit 10.0.2.0 0.0.0.255
              access-list 1 deny any

              2) check SNMP configuration on device
              10.192.2.1 - IP of you device
              XXXXXX - SNMP community
              Example:
              snmpwalk -v 2c -c XXXXXX 10.192.2.1 .1.3.6.1.2.1.2.2.1.1
              Last edited by dima_dm; 07-07-2010, 09:18.

              Comment

              • DB601
                Member
                • Jun 2010
                • 30

                #22
                Originally posted by dima_dm
                1) Configure SNMP on switch or router
                XXXXXX - community
                Example:
                snmp-server community XXXXXX RO 1

                access-list 1 permit 10.0.2.0 0.0.0.255
                access-list 1 deny any

                2) check SNMP configuration on device
                10.192.2.1 - IP of you device
                XXXXXX - SNMP community
                Example:
                snmpwalk -v 2c -c XXXXXX 10.192.2.1 .1.3.6.1.2.1.2.2.1.1



                Thank you,

                in your prog you use NET::SNMP to find port_num ..
                I want generate

                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.1 = STRING: "ftp"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.2 = STRING: "http"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.3 = STRING: "egp"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.4 = STRING: "gre"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.5 = STRING: "icmp"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.6 = STRING: "eigrp"
                SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.7 = STRING: "ipinip"
                ..
                ..

                ..
                i want to have in the items the name of the protocol for exemple "ftp" and not "fan_1" and make a graph for each item of NBAR protocols with their name and not the number of protocol.

                how can i do?

                is NET::SNMP qualfied for that work? if yes how may i use it in the program perl ?

                else ?

                please help

                thank you

                Comment

                • DB601
                  Member
                  • Jun 2010
                  • 30

                  #23
                  in your prog you use NET::SNMP to find port_num ..
                  I want generate

                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.1 = STRING: "ftp"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.2 = STRING: "http"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.3 = STRING: "egp"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.4 = STRING: "gre"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.5 = STRING: "icmp"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.6 = STRING: "eigrp"
                  SNMPv2-SMI::enterprises.9.9.244.1.2.1.1.2.1.7 = STRING: "ipinip"
                  ..
                  ..

                  ..
                  i want to have in the items the name of the protocol for exemple "ftp" and not "fan_1" and make a graph for each item of NBAR protocols with their name and not the number of protocol.

                  how can i do?

                  is NET::SNMP qualfied for that work? if yes how may i use it in the program perl ?

                  else ?

                  please help
                  answer please !!

                  Comment

                  • dima_dm
                    Senior Member
                    • Dec 2009
                    • 2697

                    #24
                    Originally posted by DB601
                    is NET::SNMP qualfied for that work?
                    Yes. If you will find corresponding MIBs.
                    Originally posted by DB601
                    if yes how may i use it in the program perl ?
                    See perldoc -m Net::SNMP

                    If distribution of the traffic (ftp,http, ssh,icmp etc) statistics are necessary to you, it is better to use netflow.
                    Last edited by dima_dm; 09-07-2010, 07:45.

                    Comment

                    • Melanxolik
                      Senior Member
                      • Nov 2009
                      • 174

                      #25
                      The script does not work with cisco 3560, for this cisco ports are formed

                      592888838 packets input, 4018252900 bytes, 0 no buffer
                      SNMPv2-SMI::mib-2.17.4.4.1.3.24 = Counter32: 592888838

                      2124032910 packets output, 241446436 bytes, 0 underruns
                      SNMPv2-SMI::mib-2.17.4.4.1.4.24 = Counter32: 2124032910


                      2124032910 packets output, 241446436 bytes, 0 underruns
                      IF-MIB::ifOutOctets.10124 = Counter32: 241446436

                      Comment

                      • dima_dm
                        Senior Member
                        • Dec 2009
                        • 2697

                        #26
                        Originally posted by Melanxolik
                        The script does not work with cisco 3560, for this cisco ports are formed
                        Can you describe more in detail this problem? I have not understood last message.
                        Last edited by dima_dm; 09-07-2010, 09:52.

                        Comment

                        • DB601
                          Member
                          • Jun 2010
                          • 30

                          #27
                          Originally posted by dima_dm
                          Can you describe more in detail this problem? I have not understood last message.

                          I read the perldoc, it's not very clear for me because i don't control very well objects in perl.


                          i found this:


                          se strict;

                          ## Validate the version of Perl

                          BEGIN
                          {
                          die('Perl version 5.6.0 or greater is required') if ($] < 5.006);
                          }

                          ## Version of the Net::SNMP module

                          our $VERSION = v5.2.0;

                          ## Load our modules

                          use Net::SNMP:ispatcher();
                          use Net::SNMP::PDU qw( :ALL );
                          use Net::SNMP::Security();
                          use Net::SNMP::Transport qw( orts );
                          ## Handle importing/exporting of symbols

                          use Exporter();

                          our @ISA = qw( Exporter );

                          our @EXPORT = qw(
                          INTEGER INTEGER32 OCTET_STRING OBJECT_IDENTIFIER IPADDRESS COUNTER
                          COUNTER32 GAUGE GAUGE32 UNSIGNED32 TIMETICKS OPAQUE COUNTER64 NOSUCHOBJECT
                          NOSUCHINSTANCE ENDOFMIBVIEW snmp_dispatcher
                          );

                          our @EXPORT_OK = qw( snmp_event_loop oid_context_match );

                          our %EXPORT_TAGS = (
                          asn1 => [
                          qw( INTEGER INTEGER32 OCTET_STRING NULL OBJECT_IDENTIFIER SEQUENCE
                          IPADDRESS COUNTER COUNTER32 GAUGE GAUGE32 UNSIGNED32 TIMETICKS
                          OPAQUE COUNTER64 NOSUCHOBJECT NOSUCHINSTANCE ENDOFMIBVIEW
                          GET_REQUEST GET_NEXT_REQUEST GET_RESPONSE SET_REQUEST TRAP
                          GET_BULK_REQUEST INFORM_REQUEST SNMPV2_TRAP REPORT )
                          ],
                          debug => [
                          qw( DEBUG_ALL DEBUG_NONE DEBUG_MESSAGE DEBUG_TRANSPORT DEBUG_DISPATCHER
                          DEBUG_PROCESSING DEBUG_SECURITY snmp_debug )
                          ],
                          generictrap => [
                          qw( COLD_START WARM_START LINK_DOWN LINK_UP AUTHENTICATION_FAILURE
                          EGP_NEIGHBOR_LOSS ENTERPRISE_SPECIFIC )
                          ],
                          snmp => [
                          qw( SNMP_VERSION_1 SNMP_VERSION_2C SNMP_VERSION_3 SNMP_PORT
                          SNMP_TRAP_PORT snmp_debug snmp_dispatcher snmp_dispatch_once
                          snmp_type_ntop oid_base_match oid_lex_sort ticks_to_time )
                          ],
                          translate => [
                          qw( TRANSLATE_NONE TRANSLATE_OCTET_STRING TRANSLATE_NULL
                          TRANSLATE_TIMETICKS TRANSLATE_OPAQUE TRANSLATE_NOSUCHOBJECT
                          TRANSLATE_NOSUCHINSTANCE TRANSLATE_ENDOFMIBVIEW TRANSLATE_UNSIGNED
                          TRANSLATE_ALL )
                          ]
                          );

                          Exporter::export_ok_tags( qw( asn1 debug generictrap snmp translate ) );

                          $EXPORT_TAGS{ALL} = [ @EXPORT_OK ];

                          ## Debugging bit masks

                          sub DEBUG_ALL() { 0xff } # All
                          sub DEBUG_NONE() { 0x00 } # None
                          sub DEBUG_MESSAGE() { 0x02 } # Message/PDU encoding/decoding
                          sub DEBUG_TRANSPORT() { 0x04 } # Transport Layer
                          sub DEBUG_DISPATCHER() { 0x08 } # Dispatcher
                          sub DEBUG_PROCESSING() { 0x10 } # Message Processing
                          sub DEBUG_SECURITY() { 0x20 } # Security

                          ## Package variables

                          our $DEBUG = DEBUG_NONE; # Debug mask

                          our $DISPATCHER; # Dispatcher instance

                          our $BLOCKING = 0; # Count of blocking objects

                          our $NONBLOCKING = 0; # Count of non-blocking objects

                          BEGIN
                          {
                          # Validate the creation of the Dispatcher object.

                          if (!defined($DISPATCHER = Net::SNMP:ispatcher->instance)) {
                          die('FATAL: Failed to create Dispatcher instance');
                          }
                          }



                          How may i use it to have the name of my protocol ??

                          Comment

                          • dima_dm
                            Senior Member
                            • Dec 2009
                            • 2697

                            #28
                            Originally posted by DB601
                            How may i use it to have the name of my protocol ??
                            How To Ask Questions The Smart Way

                            Comment

                            • DB601
                              Member
                              • Jun 2010
                              • 30

                              #29
                              Originally posted by dima_dm
                              How To Ask Questions The Smart Way
                              http://catb.org/esr/faqs/smart-questions.html
                              i was looking for answers to my problem not advices about "how to ask questions"

                              Comment

                              • dima_dm
                                Senior Member
                                • Dec 2009
                                • 2697

                                #30
                                Originally posted by DB601
                                i was looking for answers to my problem not advices about "how to ask questions"
                                Read given document and you will understand, why you will not receive the answer to the question.

                                Comment

                                Working...