The ThousandEyes Instant Test Chatbot allows a user to launch Enterprise Endpoint or Enterprise Agent Instant Tests for Select Applications or a Custom URL through a Webex Bot. This allows a user to independently launch tests and proactively gather data before reporting problems to a help desk.
The bot has the following options (and their tests) pre-encoded:
Note: All URLs are accurate at the time of publishing, but may change over time. URLs can be updated at the top of the test_creation.py
file and are mapped to the help card options in the test_selector()
method.
This Webex Bot assumes a ThousandEyes deployment exists with at least one Endpoint Agent and/or one Enterprise Agent.
To use the ThousandEyes APIs, a Bearer Token
is required for a user with the API access
permissions. To generate a Bearer Token, go to Account Settings > Users and Roles > User API Tokens
and generate a OAuth Bearer Token. Note this token.
To create a Webex Bot, follow this workflow:
developer.webex.com
My Webex Apps
Create a New App
Create a Bot
to start the wizardAdd Bot
and you will be given an access tokenAdditional Webex Bot documentation can be found here.
The app needs to be reachable on port 4000
from the public internet for Webex Webhooks to be received and processed. Any option is valid like AWS Lambda, Heroku, GCP, etc. Ngrok
is used here to expose the local app for simplicity.
The flask app runs on http://localhost:4000 by default, so it requires a Ngrok forwarding address to port 4000
to recieve the webhooks.
Follow these instructions to set up ngrok:
Getting Started
> Your Authtoken
on the menu on the left-hand side. Copy the token on this page.ngrok authtoken [yourtoken]
replacing [yourtoken] with the authtoken you copied in Step 2.
ngrok http 4000
git clone [repository name]
.env_sample
file to .env
. Rename config_sample.py
to config.py
..env
and Webex Bot Email to config.py
:BOT_TOKEN=''
BOT_EMAIL = ""
config.py
(ex: Ngrok forwarding address)WEBHOOK_BASE_URL = ""
.env
THOUSAND_EYES_TOKEN=''
pip3 install -r requirements.txt
python3 app.py
To use the bot, start a conversation by adding the bot to a 1-1 or Group space.
Send the command network-help
to display the primary card for launching tests:
This card requires 2 things:
To use an Enterprise Agent, enter the Agent Name
as seen on the ThousandEyes Dashboard:
To use an Endpoint Agent, enter the Agent Hostname
as seen on the ThousandEyes Dashboard:
After clicking submit
, the proper test will run, and after some time the results will be returned to the Webex space in the form of cards. 2 types of results exist: Success
, and Failure
.
Success
: A 2XX HTTP Response code from the target urlFailure
: A Non 2XX HTTP Response code from the target urlThe code can easily be updated and amended to consider metrics during state determination as well, like: loss, latency, etc. Refer to generate_result.py
> generate_result()
to modify the determination code.
Example test results are shown below:
Provided under Cisco Sample Code License, for details see LICENSE
Our code of conduct is available here
See our contributing guidelines here
Please note: This script is meant for demo purposes only. All tools/ scripts in this repo are released for use "AS IS" without any warranties of any kind, including, but not limited to their installation, use, or performance. Any use of these scripts and tools is at your own risk. There is no guarantee that they have been through thorough testing in a comparable environment and we are not responsible for any damage or data loss incurred with their use.
You are responsible for reviewing and testing any scripts you run thoroughly before use in any non-testing environment.
Owner
Contributors
Categories
CollaborationCloud CollaborationObservabilityObservabilityProducts
ThousandEyesWebexProgramming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community