Archived community.zenoss.org | full text search
Skip navigation
1 2 Previous Next 27395 Views 18 Replies Latest reply: Jun 29, 2010 10:13 AM by jcurry RSS
Wouter DHaeseleer ZenossMaster 204 posts since
Jun 22, 2007
Currently Being Moderated

Jul 24, 2008 5:51 AM

Cool tool: Check your layer3 deps

Hi,

Since my zenoss his layer3 dependences did not work correctly I have created a tool which can see if zenoss is able to build the layer3 deps.

Just download this file (and put it in $ZENHOME/bin)
http://www.zenoss.com/Members/netdata/tracepath.py

or if your zenoss server has direct access to the internet you could do this:
wget http://www.zenoss.com/Members/netdata/tracepath.py -O $ZENHOME/bin/tracepath.py


Once you did this just run trancepath.py with the device you want to track down.


tracepath.py swiss11
Getting path from zenoss0101 to swiss11...
zenoss -> VGB-DC01-SW01 -> VG_Turnhout -> pbru223.controlnet.equant.net -> pkt47.controlnet.equant.net -> CHEL-ZO01-SW01 -> swiss11 


So as you can see this reveals the path from the zenoss server until the device you gave as argument.

When zenoss was unable to trace the path it will throw an error:

tracepath.py pkt1401
Getting path from zenoss0101 to pkt1401...
Traceback (most recent call last):
  File "/opt/zenoss/bin/tracepath.py", line 30, in ?
    path = source.os.traceRoute(destination, [])
  File "/opt/zenoss/Products/ZenModel/OperatingSystem.py", line 121, in traceRoute
    return nextdev.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/Device.py", line 507, in traceRoute
    return self.os.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/OperatingSystem.py", line 121, in traceRoute
    return nextdev.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/Device.py", line 507, in traceRoute
    return self.os.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/OperatingSystem.py", line 121, in traceRoute
    return nextdev.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/Device.py", line 507, in traceRoute
    return self.os.traceRoute(target, ippath)
  File "/opt/zenoss/Products/ZenModel/OperatingSystem.py", line 122, in traceRoute
    raise TraceRouteGap("unable to trace to %s, gap at %s" % (target.id,
Products.ZenModel.Exceptions.TraceRouteGap: unable to trace to pkt1401, gap at pbr213.controlnet.equant.net


As you you can see zenoss throws an error that there is a gap at pbr213.controlnet.equant.net

So this means zenoss is unable to see the routes that will lead to pkt1401

When you use this script without a correct device it will lead to this:
 tracepath.py foobar
Getting path from zenoss0101 to foobar...
Invalid destination.


I hope I could help a lot of people with this tool !
  • zarxcky Rank: White Belt 77 posts since
    Apr 15, 2008
    Currently Being Moderated
    1. Jul 24, 2008 7:14 AM (in response to Wouter DHaeseleer)
    Testing tracepath.py shows error
    Hi,

    I'm testing out your tool and only got this error:

    python /usr/local/zenoss/bin/tracepath.py mydevice.dyndns.org
    Getting path from localhost to mydevice.dyndns.org...
    Traceback (most recent call last):
    File "/usr/local/zenoss/bin/tracepath.py", line 30, in ?
    path = source.os.traceRoute(destination, [])
    AttributeError: 'NoneType' object has no attribute 'os'

    Weird isn't? Any clue?
  • zarxcky Rank: White Belt 77 posts since
    Apr 15, 2008
    Currently Being Moderated
    3. Jul 24, 2008 10:03 PM (in response to Wouter DHaeseleer)
    Error tracepath.py
    Hi,

    I'm using default zenping configuration. Im not touching anything inside the $ZENHOME/etc since the zenoss installed.

    Perhaps you can update your code here so I can test the new changes you made.
  • zarxcky Rank: White Belt 77 posts since
    Apr 15, 2008
    Currently Being Moderated
    5. Jul 29, 2008 6:20 AM (in response to Wouter DHaeseleer)
    the same error locally/remotely
    Okay,

    I'm using zenoss 2.2.0. My zenping working as shown by zenoss status, and my zenping config are shown below:

    #
    # Configuration file for zenping
    #
    # To enable a particular option, uncomment the desired entry.
    #
    # Parameter Setting
    # --------- -------
    #
    # Host of zenhub daemon. Default is localhost.,
    # default: localhost
    #hubhost localhost
    #
    # Port zenhub listens on.Default is 8789.,
    # default: 8789
    #hubport 8789
    #
    # Username for zenhub login. Default is
    # admin., default: admin
    #hubusername admin
    #
    # Password for zenhub login. Default is
    # zenoss., default: zenoss
    #hubpassword zenoss
    #
    # Name of monitor instance to use for
    # configuration. Default is localhost.,
    # default: localhost
    #monitor localhost
    #
    # Initial time to wait for a ZenHub connection,
    # default: 30
    #hubtimeout 30
    #
    # Logging severity threshold, default: 20
    #logseverity 20
    #
    # override default logging path
    #logpath None
    #
    # config file must define all params (see man)
    #configfile None
    #
    # user to become when running default:zenoss,
    # default: zenoss
    #uid zenoss
    #
    # Cycle continuously on cycleInterval
    # from zope, default: False
    #cycle False
    #
    # Become a unix daemon, default: False
    #daemon False
    #
    # output log info in html table format,
    # default: False
    #weblog False
    #
    # Run under a supervisor which will restart
    # it, default: False
    #watchdog False
    #
    # The path to the watchdog reporting socket
    #watchdogPath None
    #
    # wait seconds for initial heartbeat,
    # default: 36000
    #starttimeout 36000
    #
    # host that roots the ping dependency
    # tree: typically the collecting hosts'
    # name; defaults to our fully qualified
    # domain name (localhost), default: localhost
    # name localhost
    #
    # Run in test mode: doesn't really ping,
    # but reads the list of IP Addresses
    # that are up from /tmp/testping, default:
    # False
    #test False
    #
    # use the given (privileged) file descriptor
    #useFileDescriptor None

    Got the conf above from genconf. Then I uncomment:

    # host that roots the ping dependency
    # tree: typically the collecting hosts'
    # name; defaults to our fully qualified
    # domain name (localhost), default: localhost
    name localhost

    And restart zenping. Try again tracepath.py against devices locally and remotely shown:

    Locally:

    python /usr/local/zenoss/bin/tracepath.py 192.168.3.5
    Getting path from localhost to 192.168.3.5...
    Traceback (most recent call last):
    File "/usr/local/zenoss/bin/tracepath.py", line 30, in ?
    path = source.os.traceRoute(destination, [])
    AttributeError: 'NoneType' object has no attribute 'os'


    Localhost:

    python /usr/local/zenoss/bin/tracepath.py localhost
    Getting path from localhost to localhost...
    Invalid destination.

    Remotely:

    python /usr/local/zenoss/bin/tracepath.py moddar.homeip.net
    Getting path from localhost to moddar.homeip.net...
    Traceback (most recent call last):
    File "/usr/local/zenoss/bin/tracepath.py", line 30, in ?
    path = source.os.traceRoute(destination, [])
    AttributeError: 'NoneType' object has no attribute 'os'

    The same error for locally and remotely.
  • zarxcky Rank: White Belt 77 posts since
    Apr 15, 2008
    Currently Being Moderated
    7. Jul 29, 2008 10:55 PM (in response to Wouter DHaeseleer)
    Progress..
    Sorry netdata,

    I misunderstood of what you say in the first place, which means to put the fqdn for the zenoss server instead of localhost.

    Now I getting a little feedback, albeit questionable still.

    -------------------------------------

    From the output locally:

    tracepath.py 192.168.3.6
    Getting path from billion.dyndns.org to 192.168.3.6...
    zenoss -> -> 192.168.3.6

    What's the mean by the missing link between zenoss & 192.168.3.6 ? Maybe the missing link can be replaced by some readable error message.

    ---------------------------------------

    From the output remotely:

    tracepath.py korriger.homeip.net
    Getting path from billion.dyndns.org to korriger.homeip.net...
    Traceback (most recent call last):
    File "/usr/local/zenoss/bin/tracepath.py", line 30, in ?
    path = source.os.traceRoute(destination, [])
    File "/usr/local/zenoss/Products/ZenModel/OperatingSystem.py", line 119, in traceRoute
    raise TraceRouteGap("unable to trace to %s, gap at %s" % (target.id,
    Products.ZenModel.Exceptions.TraceRouteGap: unable to trace to korriger.homeip.net, gap at billion.dyndns.org

    Some error message which seem to cannot trace the routes between source and destination.

    -------------------------------------------

    Testing between zenoss server and the fqdn of internal server:

    tracepath.py viva.mordor.com
    Getting path from billion.dyndns.org to viva.mordor.com...
    Invalid destination.

    tracepath.py 192.168.3.135 (a.k.a viva.mordor.com)
    Getting path from billion.dyndns.org to 192.168.3.135...
    zenoss -> -> 192.168.3.135

    This is all output of what I get from my test. :wink:
  • tbannister Rank: White Belt 42 posts since
    Mar 5, 2008
    Currently Being Moderated
    8. Aug 29, 2008 3:30 PM (in response to zarxcky)
    Re: Progress..

     

     


    From the output locally:

    tracepath.py 192.168.3.6
    Getting path from billion.dyndns.org to 192.168.3.6...
    zenoss -> -> 192.168.3.6

    What's the mean by the missing link between zenoss & 192.168.3.6 ? Maybe the missing link can be replaced by some readable error message.



    Actually the blank doesn't represent an error. It actually means there's a direct connection between the two devices. The script doesn't handle the special case where there's no intermediate devices well. This can be fixed by changing the last couple of lines in the file from:
    
    print "zenoss -> " \
        + " -> ".join([ dmd.Networks.findIp(ip).device().id for ip in path[:-1] ]) \
        + " -> " + arg
    


    to

    
    if len(path) > 1:
        print "zenoss -> " \
        + " -> ".join([ dmd.Networks.findIp(ip).device().id for ip in path[:-1] ]) \
        + " -> " + arg
    else:
        print "zenoss -> " + arg
    


    It also doesn't handle no device specified either. Running "tracepath.py" outputs:

    
      File "/usr/local/zenoss/zenoss/bin/tracepath.py", line 12, in ?
        arg = sys.argv[1]
    IndexError: list index out of range
    


    But that requires writing a usage function and doing the argument handling properly, which is beyond what I'm prepared to write today.
  • CHackenmueller Rank: White Belt 11 posts since
    Oct 24, 2007
    Currently Being Moderated
    9. Nov 12, 2008 5:15 PM (in response to tbannister)
    Re: Progress..
    I followed the programs instructions and added the name value into the file recommended.

    I now get this error:

    Traceback (most recent call last):
      File "./tracepath.ph", line 20, in ?
        name, source = line.split(' ')
    ValueError: need more than 1 value to unpack
  • HummerBoy Rank: Green Belt 116 posts since
    Dec 17, 2008
    Currently Being Moderated
    10. Jan 13, 2009 12:54 AM (in response to CHackenmueller)
    same issue
    I get the same error. It seems to be unable to get the name from the command line. Any updates would be appreciated.
  • HummerBoy Rank: Green Belt 116 posts since
    Dec 17, 2008
    Currently Being Moderated
    12. Jan 13, 2009 5:53 PM (in response to Wouter DHaeseleer)
    zenping.conf
    My zenping.conf only has one line with 'name crt-monitor' in it which is the server name. We believe that some of the commands used in the PY file are not implemented on our server hence the error we are getting. We rewrote the file using shell commands (called it tracepath.sh and put it in the same directory). Try using this and see if it does what you need.

    I also added a 'Tracepath' command under the zenoss Settings tab and used the command line of 'tracepath.sh ${device/id}'. Now I can select the Run Commands drop down under each object and check the trace path.

    #!/bin/bash
    if [ -z $1 ]; then
      echo "Usage: $0 destination"
      echo "eg: $0 `hostname`"
    else
      routepath=""
      echo "From "$HOSTNAME" to"
      for name in `/usr/sbin/traceroute $1|grep  "^ "|awk '{print $2}'`; do
        routepath="$routepath$name -> ";
      done
      echo $routepath| sed s/' ->$'/''/g
    fi
    

    Here is an example output from one of our devices using this (domain changed to protect the innocent) ...
    
    Command: tracepath.sh ${device/id}
    Description: Trace layer 3 path
    Output:
    ==== ad2-main1 ====
    tracepath.sh ad2-main1
    From crt-monitor to
    fca_cbr1.ourdomain.au -> 10.50.50.2 -> 10.10.11.4 -> 10.9.5.142 -> 10.9.5.141 -> ad2-main1.ourdomain.au
    DONE in 3 seconds on 1 targets
    
  • HummerBoy Rank: Green Belt 116 posts since
    Dec 17, 2008
    Currently Being Moderated
    13. Jan 14, 2009 12:30 AM (in response to HummerBoy)
    Gotcha
    Ok, I figured it out (without knowing Python). Toss out the shell script shown above as all it did was a different trace route.

    The problem has nothing to do with the zenping.conf file. It was an issue with us (me) interpreting your (NetData's) suggestions for setting up. Most of confusion came from it echoing the source and destination names then failing.

    The Python script does a lookup of the device name in the database and resolves an actual device to a Zenoss device, not an normal trace route. The error 'invalid source' is caused by no object in Zenoss for the Zenoss server its self. I created a new object under Devices/Server/Linux/SLES to represent the actual Zenoss server I was using and all of a sudden I was getting invalid destination. Bingo!

    Now all I have to figure out is how to get into Zenoss all the WAN router devices and routing tables that our telco is providing and won't tell us anything about.
  • fdeckert Rank: Green Belt 110 posts since
    Jul 2, 2008
    Currently Being Moderated
    14. Jan 14, 2009 3:28 AM (in response to HummerBoy)
    RE: Gotcha
    Hi guys,

    Many thanks netdata for that script, it helped us improve our layer3 tology as it shown us strait we did it wrong.

    To answer hummerboy, we had to build our topology "by hand" as our telco is proving us an MPLS cloud.

    To build the topology we did the following:
    - on the router collectors we removed the RouteMap collector to avoid seeing the telco could
    - we created a "dummy" network 192.168.105.0/24
    - on each router we added a "dummy" interface "ethcloud" with ip 192.168.105.x and we locked the interface to avoid the modeler removing it.
    - on zenping.conf we set the root device as the router zenoss is using.
    - on that router we manually added routes to all remote networks though the dummy network.
    - on each router we added a route to the local network on the ethernet interface.

    Say we have a zenoss server is in paris (192.168.0.2/24) , it's router is 192.168.0.1, and we have a device in London (192.168.1.2/24) with a router 192.168.1.1.

    zenoss.paris 
     eth0 (automatic) 192.168.0.2
     Default route (automatic) 0.0.0.0/0 => 192.168.0.1
    router.paris 
      eth0 (automatic) : 192.168.0.1
      ethcloud (manual) : 192.168.105.1
      route (manual) : 192.168.1.0/24 => 192.168.105.2 / ethcloud / local / indirect
    router.london
      eth0 (automatic) : 192.168.1.1
      ethcloud (manual) : 192.168.105.2
      route (manual) : 192.168.1.0/24 => none / eth0 / local / direct
    device.london
      eth0 (automatic) : 192.168.1.2


    Now zenping is able to build a path from zenoss to the device through the clould and so create dependencies.

    --
    Florian Deckert
    SopraGroup - France
1 2 Previous Next

More Like This

  • Retrieving data ...