ThousandEyes-Test-Report

published

This script leverages ThousandEyes v7 REST APIs to pull detailed information from a ThousandEyes account and formats it into a comprehensive CSV file for Cloud and Enterprise Agent Tests. This script aims to streamline the process of extracting and analyzing ThousandEyes test data, reducing the time and effort required to gather and analyze network performance data for better monitoring and optimization.

Sample Output:

image

Primary Language: Python 3.x
Dependencies (Python Libraries): 
- Requests library for API calls
- CSV module for data formatting
- dotenv module for loading environment variables from a .env file
- OS module for interacting with the operating system
- SYS module for system-specific parameters and functions
Standalone Script: Designed as a standalone script, but can be integrated into larger automation frameworks if needed

Contacts:

Installation:

Clone the repo

git clone https://github.com/apignata2/ThousandEyes-Test-Report.git

Set up a Python venv
First make sure that you have Python 3 installed on your machine. We will then be using venv to create an isolated environment with only the necessary packages.

Install virtualenv via pip

pip install virtualenv

Create the venv

python3 -m venv venv

Activate your venv

source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Configuration:

  1. Obatin the OAuth Bearer Token from your ThousandEyes Account for the authentication when communicating with the APIs
https://app.thousandeyes.com/account-settings/users-roles/

Create an OAuth Bearer Token

image

Copy the Token and store in a secure location

image

  1. Create a .env File
  • Create a file named .env in the root directory of your python project.

  • This file will contain your environment variables in the format KEY=VALUE.

  • The KEY will be BEARER_TOKEN and VALUE as OAuth Bearer Token you generated

  • We will store OAuth Bearer Token in the .env file

Example:

image

(Optional) Set the file path of the .env file

Windows example:

image

Mac example:

image

  1. (Optional) Set Account Group Name
  • The script will pull the default account group, if no name is set
  • You can confirm account group in ThousandEyes by checking the image below

image

  • To change the account group name, set the variable Account_Group_Name in the python code
    image

Usage

Run the script:

python3 main.py

Version

1.0.0 (Oct 2024) - Intial Release

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.