Ad Widget

Collapse

Question about backend scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmanzer
    Junior Member
    • Jun 2006
    • 16

    #1

    Question about backend scripts

    I was working on a Linux script to be called via CRON to auto-update Cisco interface related items for Zabbix 1.4.2. It would basically do a SNMPWALK on a given set of devices (members of a host group) and insert/update items as needed to reflect what the SNMP scan discovered. Then I realized that Zabbix had the auto increment feature in MySQL removed and thus such activity on the back end might/would endanger the integrity of the DB.

    Even with the ifindex persistence option in most IOS images today Zabbix still wouldn't fine new interfaces like layer 3 VLANs and newly added linecards. We cannot afford the time to manually add these interfaces ourselves. Templates, while extremely useful for static SNMP OIDs like IP-MIB and TCP-MIB are not suitable at all to the changing nature of the ifindex table on a given Cisco switch or router. And we have hundreds of such devices. Some of them with quite a few unused ifindex values due to additions and deletions in production.

    My question is what can I do to have Zabbix catch the full range of interfaces that a network device might have? Is going through the trouble of writing a back end script the right thing to do? Should we just create a template with 1000s of interface items and let the non-existent OIDs timeout naturally? I have not seen any part of Zabbix that would accommodate this very well. We already use Zabbix elsewhere so there is a strong desire to continue expanding what Zabbix does for us.

    If I can find a proper and safe way to access the DB via a back end script I would certainly be willing to help others to are trying to do similar things.

    We have a similar problem with our Cisco Content Switching Modules (CSMs). CSMs have vast amounts of data available via SNMP but those OIDs are dynamic too and thus would prove elusive for templates to capture.

    Is there a programming API for Zabbix that would render all of this irrelevant?

    Any comments and recommendations would be very helpful since I'm not sure what to do about this.
  • Tenzer
    Senior Member
    • Nov 2007
    • 316

    #2
    You can access the database directly, you just need to take some precautions on what information zabbix needs and such...

    I for instance made a PHP script to add a screen for a switch, with a graph for each port, you can find it in this thread: http://www.zabbix.com/forum/showthread.php?t=8504

    Maybe that can help you out?

    Comment

    • cristhiano
      Member
      • Nov 2007
      • 48

      #3
      I am writing one script in PHP.
      It get SNMPWALK of interfaces of Cisco and create items in Zabbix, using functions of Zabbix.
      It start when trigger:count of interfaces change (value of OID 1.3.6.1.2.1.2.1.0).

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        ZABBIX 1.6 will support references by SNMP index, the syntax will be something close to:

        IF-MIB::ifOutOctets[index,IF-MIB::ifDescr,eth0]

        So, ZABBIX looks for index of IF-MIB::ifDescr having value 'eth0', and then appends the index to the main OID. So, if eth0's index is 2, ZABBIX will retrieve value of IF-MIB::ifOutOctets.2 at the end.

        The same technique can be applied to any SNMP resources (processes, dynamic data), not only interfaces.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • jmanzer
          Junior Member
          • Jun 2006
          • 16

          #5
          that's good news

          so items can have two SNMP oids referenced in its snmp_oid field? Very nice.

          ok, i can see a switch with fixed ports like a Catalyst 3550 with 48 Fast Ethernet ports being easy fa0/1 - fa0/48

          now what about a switch with variable interface names like a Catalyst 6500.
          from there you would see G1/1 - 48 or fa1/1 - 48 or Ten1/1 - Ten1/4. with several possibilities existing for each blade such a notation that you gave above would be a bit tricky. You don't know which blade will be used so you don't know which interfaces will exist.

          Perhaps just using templates to cover that would be fine.

          I'm already using 13 templates (different last number on each SNMP oid of each item in the template) to cover 13 possible content switching modules (13 slots in a Catalyst 6513). Depending on where the CSM is I just assign it the proper template. It's still 13 templates to make but once they are done they can be re-used infinitely.

          So will we see zabbix 1.6 in the first quarter?

          Comment

          • Crazy Marty
            Member
            • Sep 2007
            • 75

            #6
            Originally posted by Alexei
            ZABBIX 1.6 will support references by SNMP index, the syntax will be something close to:

            IF-MIB::ifOutOctets[index,IF-MIB::ifDescr,eth0]

            So, ZABBIX looks for index of IF-MIB::ifDescr having value 'eth0', and then appends the index to the main OID. So, if eth0's index is 2, ZABBIX will retrieve value of IF-MIB::ifOutOctets.2 at the end.

            The same technique can be applied to any SNMP resources (processes, dynamic data), not only interfaces.
            Thank you! Thank you! Thank you!

            Alexei, you rock!

            Comment

            Working...