Archived community.zenoss.org | full text search
Skip navigation
5048 Views 14 Replies Latest reply: Nov 15, 2011 9:03 PM by Shane Scott RSS
Michael s Rank: White Belt 15 posts since
Sep 26, 2011
Currently Being Moderated

Sep 27, 2011 4:28 AM

Problem Installing Shane Scotts Device Search

Hello everybody,

i am using Zenoss Core Version 3.2.0 and want to have a global search function for the interface descriptions. In the IRC Channel hackman238(i think he was Shane Scott) told me that his ZenPack Device Search does this job after a little modifcation.

I have to add "device.os.interfaces.interface.description" in line 30 in "%ZENHOME/ZenPacks/ZenPacks.ShaneScott.DeviceSearch-1.0.0-py2.6.egg/ZenPacks/ShaneScott/DeviceSearch/__init__.py"

But when i install the ZenPack as Zenoss User with the following command: "zenpack --install=ZenPacks.ShaneScott.DeviceSearch-1.0.0-py2.6.egg"

i get a huge Error and Warning list. I suppose it has something to do with some Transforms i had already in Zenoss...

 

I append a huge log from my console that you can see what i have done till now. (You can jump over the mid part because its a repeating error output)

 

So can you please take a look over this log and tell me what i have done wrong? At the moment there is still a search box in the top left to the user name, but it doesnt work.

 

Thanks

Michael

Attachments:
  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    1. Sep 27, 2011 8:18 PM (in response to TitoOrtega)
    Re: Problem Installing Shane Scotts Device Search

    Tito:

     

    No one should ever take your advice for anything after reading your posts.

     

    My packs are not dangerous, infact, this problem is a transform issue which I've been discussing with Mike in IRC.

     

    Best,

    --Shane

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    3. Sep 28, 2011 9:51 AM (in response to Michael s)
    Re: Problem Installing Shane Scotts Device Search

    Michael:

     

    Try:

    import re

     

    # test device object is not None

    if device:

       # code for showing the 95th percentile in graphs

       fs_id = device.prepId(evt.component)

       for f in device.os.interfaces():

          if f.id != fs_id: continue

     

          # Extract the percent and utilization from the summary

          m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.message)

          if not m: continue

          currentusage = (float(m.groups()[0])) * 8

          p = (currentusage / f.speed) * 100

          evtKey = evt.eventKey

     

          # Whether Input or Output Traffic

          if evtKey == "ifInOctets_ifInOctets|high utilization":

              evtNewKey = "Input"

          elif evtKey == "ifOutOctets_ifOutOctets|high utilization":

              evtNewKey = "Output"

     

     

       # code to show correct units in events

          # Check the speed to determine the appropriate conversion

          # Gbps utilization

          if currentusage > 1000000000:

              Usage = currentusage / 1000000000

              evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Gbps) or %3.2f%% is being used." %  (Usage, p)

          # Mbps utilization

          elif currentusage > 1000000:

              Usage = currentusage / 1000000

              evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Mbps) or %3.2f%%  is being used." %  (Usage, p)

          # Kbps utilization

          elif currentusage > 1000:

              Usage = currentusage / 1000

              evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Kbps) or %3.2f%%  is being used." %  (Usage, p)

          # bps  utilization

          elif currentusage < 1000:

              Usage = currentusage

              evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f bps) or %3.2f%%  is being used." %  (Usage, p)

          break

     

       # no generating of "High-Threshold"-Warnings for Tunnel-, Dialer- or Virtual-Access-Interfaces

     

       if evt.component.find("Tunnel") >= 0:

          evt._action = "drop"

     

       if evt.component.find("Dialer") >= 0:

          evt._action = "drop"

     

       if evt.component.find("Virtual-Access") >= 0:

          evt._action = "drop"

     

     

    I think this will work by bailing when device is not set.

     

    --Shane

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    5. Sep 29, 2011 4:27 PM (in response to TitoOrtega)
    Re: Problem Installing Shane Scotts Device Search

    Tito:

     

    Transforms cannot break ZODB or an install. If you ahd problems its because you did not remove the pack, upgrade to zenoss 3 and nistall the new pack. That is how it should be done.

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    6. Sep 29, 2011 4:27 PM (in response to Michael s)
    Re: Problem Installing Shane Scotts Device Search

    Mike:

     

    Can you post one of the events? I'll double check the code.

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    11. Oct 18, 2011 9:17 PM (in response to Michael s)
    Re: Problem Installing Shane Scotts Device Search

    Michael s:

     

    I hope you're well! I've recently updated the pack to provide the needed functionality out of the box.

     

    You can find it and documentation here: http://shanewilliamscott.com/Code/devicepropertysearch-zenpack.html

     

    Is your transform still give you grief?

     

    Best,

    --Shane W. Scott(Hackman238)

      ZCA - community/zca/blog

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    13. Nov 15, 2011 8:58 PM (in response to Michael s)
    Re: Problem Installing Shane Scotts Device Search

    Michael:

     

    I think f.speed is sometimes invalid and causing a problem.

     

    Try this:

     

    import re
    
    # test device object is not None
    if device:
       # code for showing the 95th percentile in graphs
       fs_id = device.prepId(evt.component)
    
       for f in device.os.interfaces():
          if f.id != fs_id: continue
          # Extract the percent and utilization from the summary
          m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.message)
          if not m: continue
          currentusage = (float(m.groups()[0])) * 8
          #computer percent using f.speed where f.speed != None, otherwise assume speed = 1
          speed = (f.speed or 1)
          p = (currentusage / int(speed)) * 100
          evtKey = evt.eventKey
          # Whether Input or Output Traffic
          if evtKey == "ifInOctets_ifInOctets|high utilization":
              evtNewKey = "Input"
          elif evtKey == "ifOutOctets_ifOutOctets|high utilization":
              evtNewKey = "Output"
    
       # code to show correct units in events
          # Check the speed to determine the appropriate conversion
          # check if speed > 1
          if speed > 1:
              # Gbps utilization
              if currentusage > 1000000000:
                  Usage = currentusage / 1000000000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Gbps) or %3.2f%% is being used." %  (Usage, p)
              # Mbps utilization
              elif currentusage > 1000000:
                  Usage = currentusage / 1000000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Mbps) or %3.2f%%  is being used." %  (Usage, p)
              # Kbps utilization
              elif currentusage > 1000:
                  Usage = currentusage / 1000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Kbps) or %3.2f%%  is being used." %  (Usage, p)
              # bps  utilization
              elif currentusage < 1000:
                  Usage = currentusage
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f bps) or %3.2f%%  is being used." %  (Usage, p)
              break
            else:
              # Gbps utilization
              if currentusage > 1000000000:
                  Usage = currentusage / 1000000000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Gbps is being used. Interface speed invalid" %  (Usage)
              # Mbps utilization
              elif currentusage > 1000000:
                  Usage = currentusage / 1000000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Mbps) is being used. Interface speed invalid" %  (Usage)
              # Kbps utilization
              elif currentusage > 1000:
                  Usage = currentusage / 1000
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f Kbps) is being used. Interface speed invalid" %  (Usage)
              # bps  utilization
              elif currentusage < 1000:
                  Usage = currentusage
                  evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f bps) is being used. Interface speed invalid" %  (Usage)
              break
    
       # no generating of "High-Threshold"-Warnings for Tunnel-, Dialer- or Virtual-Access-Interfaces
       if evt.component.find("Tunnel") >= 0:
          evt._action = "drop"
       if evt.component.find("Dialer") >= 0:
          evt._action = "drop"
       if evt.component.find("Virtual-Access") >= 0:
          evt._action = "drop"
    
  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    14. Nov 15, 2011 9:03 PM (in response to Shane Scott)
    Re: Problem Installing Shane Scotts Device Search

    Michael:

     

    The DeviceSearch pack has been updated to fix the dependancy bug.

     

    Best,

    --Shane

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points