Ad Widget

Collapse

XML Generator for switches

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PaulKennedy
    Junior Member
    • May 2008
    • 3

    #1

    XML Generator for switches

    I have had to monitor all ports on several types of switches, mostly Cisco. The attached Perl script pulls port info from the iftable and generates a complete XML import file with item and trigger definitions.

    Enjoy
    Attached Files
  • stalker
    Junior Member
    • Aug 2008
    • 29

    #2
    Cool! Thank you!

    It would be really cool if this functionality has been integrated in itself zabbix
    Last edited by stalker; 25-09-2008, 07:51.

    Comment

    • odium4u
      Junior Member
      • Sep 2008
      • 20

      #3
      Sharing makes friends ... I have made some modifications to do the following.

      1) Create graphics for each interface found.
      2) Changed labels to be less complex and easier to identify.
      3) Description item now pulls Description field from interface configurations on cisco switches/routers.
      4) Changed item descriptions to reorder most useful information right under Description.

      I did make a new throw map, so you may need to duplicate this if needed. If you need any further help or info, please let me know.

      Attached are example screenshots. (yes, compiz fails sometimes)
      Attached Files

      Comment

      • PaulKennedy
        Junior Member
        • May 2008
        • 3

        #4
        Thank you odium4u, I will definitely use the Cisco description fields.

        Comment

        • cjwallace
          Senior Member
          • Sep 2008
          • 126

          #5
          Silly question time.

          How do i use your script, ie where do i install \ copy it to in order for it to work

          Thanks

          Craig

          Comment

          • cjwallace
            Senior Member
            • Sep 2008
            • 126

            #6
            Guys.

            Can anyone let me know how i install these types of script

            Cheers

            Craig

            Comment

            • odium4u
              Junior Member
              • Sep 2008
              • 20

              #7
              Originally posted by cjwallace
              Guys.

              Can anyone let me know how i install these types of script

              Cheers

              Craig
              Craig,

              The script provided is a Perl script that will query a networking (switch/router) via the SNMP protocol to create an XML file for import into Zabbix. The script requires additional Perl modules like Net:SNMP, so just having the basic perl will not work.

              If you are not familiar with Perl or SNMP, then this may require assistance more then I am able to provide.

              Example Usage:
              Target: Cisco Switch running at 192.168.69.10 with SNMP public community enabled.
              Solution: Run the script with the switch information to generate an XML file. Import that XML file into Zabbix and the host, graphs and triggers will not exist in Zabbix.

              Hope this helps...

              Comment

              • SMB
                Member
                • Sep 2007
                • 30

                #8
                Thank you for this, but after importing the xml the ifIn and ifOut items for each interface never update. snmpget for the OID's does work. The host says it's monitored and each item says enabled but they never update.

                Any ideas?

                Comment

                • odium4u
                  Junior Member
                  • Sep 2008
                  • 20

                  #9
                  What does the raw values "500 latest values" show in the graph field for In/OutOctets?

                  If it showing 0 for all values, you are not getting data from the router/switch properly.
                  Edit: Or you are not doing any traffic on that port and there is nothing to delta or compare.

                  Should look like this...
                  Attached Files

                  Comment

                  • SMB
                    Member
                    • Sep 2007
                    • 30

                    #10
                    Thanks for the reply.

                    It seems that Zabbix had become confused in some way. Disabling the host item for a period of time and reenabling it got Zabbix polling the switches correctly.

                    Again, thank you to yourself and PaulKennedy, this script saved me a whole lot of work that I probably just would never have done .

                    Comment

                    • troffasky
                      Senior Member
                      • Jul 2008
                      • 565

                      #11
                      Line 138, I substituted 'public' with '$cstring'.

                      Comment

                      • Slowride
                        Junior Member
                        • Jan 2009
                        • 8

                        #12
                        Originally posted by odium4u
                        Sharing makes friends ... I have made some modifications to do the following.

                        1) Create graphics for each interface found.
                        2) Changed labels to be less complex and easier to identify.
                        3) Description item now pulls Description field from interface configurations on cisco switches/routers.
                        4) Changed item descriptions to reorder most useful information right under Description.

                        I did make a new throw map, so you may need to duplicate this if needed. If you need any further help or info, please let me know.

                        Attached are example screenshots. (yes, compiz fails sometimes)
                        Thanks for the script. can you explain were in the script is the logic to decide between v1 IfinOctets and v2 IfHCInOctets?

                        ifHCInOctets
                        .1.3.6.1.2.1.31.1.1.1.6.<port>

                        ifHCOutOctets
                        .1.3.6.1.2.1.31.1.1.1.10.<port>

                        Comment

                        • troffasky
                          Senior Member
                          • Jul 2008
                          • 565

                          #13
                          I've hacked on this quite a bit, and no, my additions are not an entry for the Obfuscated Perl Contest...they just look like it.

                          Modifications:

                          - Use Getopt::Long for user options
                          - Detects DOCSIS device, adds some DOCSIS items
                          - Multiply octets by 8 to get bps rather than Bps
                          - Add packets-per-second, although you'll want to read the comments in the source code
                          - Don't add loopback interfaces by default

                          Tested on Sonicwall TZ190, Procurve 2650 and a handful of DOCSIS cable modems.

                          You'll have to save it as templater.pl; for some reason, .txt files are limited to 19k but .c files are limited to 900k...go figure!
                          Attached Files

                          Comment

                          • troffasky
                            Senior Member
                            • Jul 2008
                            • 565

                            #14
                            Fixed issue where ifType was 1 ("other"). Not adding ifType 1 as I'm yet to find a host where ifType 1 ever has any traffic.

                            Tested with Cisco 877.

                            Doesn't work with SNMPv1 agents.
                            Attached Files
                            Last edited by troffasky; 16-01-2009, 22:19.

                            Comment

                            • odium4u
                              Junior Member
                              • Sep 2008
                              • 20

                              #15
                              Nice additions and work, thank you for posting!

                              Comment

                              Working...