{"id":18797800,"url":"https://github.com/networktocode/flowtracker","last_synced_at":"2025-04-13T16:32:23.537Z","repository":{"id":35733278,"uuid":"40011937","full_name":"networktocode/flowtracker","owner":"networktocode","description":"Trace a flow through a data center fabric of Nexus switches","archived":true,"fork":false,"pushed_at":"2015-10-07T18:54:22.000Z","size":204,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T12:40:02.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/networktocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T15:31:23.000Z","updated_at":"2024-06-25T18:43:53.000Z","dependencies_parsed_at":"2022-09-19T09:41:35.726Z","dependency_job_id":null,"html_url":"https://github.com/networktocode/flowtracker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fflowtracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fflowtracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fflowtracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/networktocode%2Fflowtracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/networktocode","download_url":"https://codeload.github.com/networktocode/flowtracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248743939,"owners_count":21154772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:09:38.939Z","updated_at":"2025-04-13T16:32:23.294Z","avatar_url":"https://github.com/networktocode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flowtracker Overview\n\nThis script enables on demand troubleshooting of a DC fabric running Nexus switches, by taking in a 5-tuple and tracing the path of this flow across the network.\n\nIt can be executed on any standalone host with Python installed (e.g. Linux, Mac, or Windows).\n\nIt **requires** the external python libraries, ``pycsco`` and ``netmiko``, but these can be installed automatically using the installation instructions below.\n\n# Installation\n(syntax below for Linux/Mac, but analogous steps for Windows)\n\n## via ``pip``:\n\nIf your host has ``pip`` installed, you can simply do:\n```\nsudo pip install flowtracker\n```\n\n## by cloning this repository:\n```\ngit clone https://github.com/networktocode/flowtracker.git\ncd flowtracker\nsudo python setup.py install\n```\n\nBoth methods install an executable on the host's system path so that the script can be executed by simply typing ``flowtracker`` from the command prompt.\n\n# Usage\n\n## Script arguments\n\nThe arguments given to the script supply information about the flow to track, and the Nexus switches to contact. All arguments can be supplied either via command line flags, or by interactive prompt to the user. If an argument isn't supplied by a flag, the user will be prompted for that argument. A special flag `-h` or `--help` prints a description about each of the other arguments and how to use them as command line flags. Below is the output from running ``flowtracker -h``.\n```\nusage: flowtracker  [-h] [--src SRC] [--dest DEST] [--proto PROTO]\n                    [--target TARGET] [--user USER] [--pwd PWD]\n                    [--src_port SRC_PORT] [--dest_port DEST_PORT]\n                    [--vrf VRF] [--mode {interactive,auto}] [--use_mgmt]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --src SRC             The source IP address or hostname of the flow.\n  --dest DEST           The destination IP address or hostname of the flow.\n  --proto PROTO         The IP protocol number. Common names like icmp, tcp,\n                        and udp may be used.\n  --target TARGET       The IP address or hostname of the switch to start the\n                        flow track.\n  --user USER           The SSH/NXAPI username for the switch.\n  --pwd PWD             The SSH/NXAPI password for the switch.\n  --src_port SRC_PORT   The source layer 4 port of the flow.\n  --dest_port DEST_PORT\n                        The destination layer 4 port of the flow.\n  --vrf VRF             The VRF of the flow.\n  --mode {interactive,auto}\n                        Interactive mode prompts the user to continue at each\n                        hop.\n  --use_mgmt            Use the Management IP address to connect to each hop.\n                        Uses the NXAPI instead of SSH.\n```\n\nThe ``--mode`` argument, which can only be supplied as a command line flag, provides two modes to run the script, ``interactive``(default) and ``auto``. ``interactive`` will prompt the user to Enter to continue to next hop, at each hop in the path, after printing flow information. ``auto`` will automatically move on to each hop.\n\nThe ``--use_mgmt`` flag, if set, instructs the script to connect to each switch on its management interface. If it is not set, the script uses the next hop IP address, learned at each hop, to connect to the next hop. A side effect of setting this flag is that the script attempts to use NX-API, with SSH as fall back. If the flag isn't set, the script only uses SSH. Using NX-API yields dramatic speed improvements in the running time of the script.\n\nLike most other arguments, if the SSH/NXAPI password (``--pwd``) isn't supplied via a command line flag, the user is prompted for it. When the user types at the prompt, the password is not displayed on screen. However if ``--pwd`` is supplied via command line flag, the password is displayed on screen.\n\n## Running the script:\n\nBelow is an example runing the script with a combination of command line flags and prompts. ``--mode``, ``--use_mgmt``, ``--target``, and ``--user`` are supplied via command line flags. The flow's *source IP*, *destination IP*, *source port*, *destination port*, *IP protocol* are supplied by responding to prompts. Likewise are the *password*, and *vrf*. The *password* is hidden, and the optional **vrf** argument is not supplied, so the \"default\" vrf will be used.\n\nInitial execution:\n```\nflowtracker --mode auto --use_mgmt --target p9372-1 --user cisco\n```\n\nPrompts:\n```\nEnter source IP of the flow: 3.3.3.3\nEnter destination IP of the flow: 4.4.4.4\nEnter IP protocol(tcp, udp, icmp, \u003cnumber\u003e): tcp\nSSH/NXAPI Password:\n(Optional) TCP/UDP Source Port: 1234\n(Optional) TCP/UDP Destination Port: 80\n(Optional) VRF of the flow:\n```\nBelow is the output of the script given the above input. First a FLOW OVERVIEW is displayed, recapping the inputs given. Then, the output at each hop in the path is displayed and separated by a line of #'s. \n\nAt each hop, we see which hop we are CONNECTED TO, its HOP NUMBER, and the LOAD_SHARE_MODE. We also see the outgoing interface of the flow in OUT_IF, and the NEXT_HOP. At the bottom, interface statistics about the OUT_IF are displayed:\n\n```\nFLOW OVERVIEW:\n\nSRC: 3.3.3.3\nDEST: 4.4.4.4\nPROTO: 6\nSRC_PORT: 1234\nDEST_PORT: 80\nVRF: default\n\n\n#############################################################################\n\nCONNECTED TO: 9372-1 (p9372-1)\nHOP NUMBER: 1\n\nLOAD_SHARE_MODE: address source-destination port source-destination\nVRF: default\nOUT_IF: Eth1/52\nDEST: 4.4.4.4\nNEXT_HOP: 10.10.60.1\n\nOUT_IF:\n  RESETS: 6\n  TX_STATS:\n    1552 unicast packets  233683 multicast packets  3 broadcast packets\n    235246 output packets  24675632 bytes\n    0 jumbo packets\n    0 output error  0 collision  0 deferred  0 late collision\n    0 lost carrier  0 no carrier  0 babble  0 output discard\n    0 Tx pause\n\n\n\n\nElapsed Time for Hop: 1.347575 seconds.\n\n#############################################################################\n\nCONNECTED TO: N9K2 (10.10.60.1)\nHOP NUMBER: 2\n\nLOAD_SHARE_MODE: address source-destination port source-destination\nVRF: default\nOUT_IF: Eth2/3\nDEST: 4.4.4.4\nNEXT_HOP: 10.10.70.2\n\nOUT_IF:\n  RESETS: 2\n  TX_STATS:\n    81 unicast packets  27053 multicast packets  3 broadcast packets\n    27150 output packets  3490279 bytes\n    0 jumbo packets\n    0 output error  0 collision  0 deferred  0 late collision\n    0 lost carrier  0 no carrier  0 babble  0 output discard\n    0 Tx pause\n\n\n\n\nElapsed Time for Hop: 4.153353 seconds.\n\n#############################################################################\n\nCONNECTED TO: 9372-2 (10.10.70.2)\nHOP NUMBER: 3\n\nLOAD_SHARE_MODE: address source-destination port source-destination\nVRF: default\nOUT_IF: sup-eth1 , local, attached\nDEST: 4.4.4.4\nNEXT_HOP: sup-eth1\n\nOUT_IF:\n  RESETS: N/A\n  TX_STATS: N/A\n\n\nElapsed Time for Hop: 0.192762 seconds.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetworktocode%2Fflowtracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetworktocode%2Fflowtracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetworktocode%2Fflowtracker/lists"}