ThousandEyes-CLI を使って CLI から TE の状態・設定を確認する
ThousandEyes(以下、TE)はWeb管理画面から操作するのが一般的だと思います。設定は出来ませんが、ThousandEyes-CLIを使うことでCLIから状態や設定を確認することは出来ます。今回はThousandEyes-CLIをインストールし、起動するまでの手順をメモします。
検証環境¶
対象 | バージョン |
---|---|
macOS | Sequoia 15.5 |
Python | 3.13.5 |
インストール¶
GitHUb からクローンします。
git clone https://github.com/CiscoDevNet/thousandeyes-cli.git
cd thousandeyes-cli
完了後はPythonの仮想環境を作成しておきます。仮想環境を作成したら必要なライブラリをインストールします。requirements.txt
は以下の内容になっていました。
requirements.txt
rich
requests
pyyaml
jinja2
prompt_toolkit
これをインストールすると私の環境ではreadlineをビルドする際にエラーとなってしまいました。
% uv pip install -r requirements.txt
Resolved 15 packages in 61ms
× Failed to build `readline==6.2.4.2`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)
[stdout]
patching file vi_mode.c
patching file callback.c
patching file 'support/shobj-conf'
patching file patchlevel
patching file input.c
patching file patchlevel
patching file vi_mode.c
patching file patchlevel
checking build system type... arm-apple-darwin24.5.0
checking host system type... arm-apple-darwin24.5.0
Beginning configuration for readline-6.2 for arm-apple-darwin24.5.0
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name...
============ Building the readline library ============
(省略)
Modules/3.x/readline.c:1179:34: error: incompatible function pointer types assigning to 'char *(*)(FILE *, FILE *, const char *)' (aka
'char *(*)(struct __sFILE *, struct __sFILE *, const char *)') from 'char *(FILE *, FILE *, char *)' (aka 'char *(struct __sFILE *,
struct __sFILE *, char *)') [-Wincompatible-function-pointer-types]
1179 | PyOS_ReadlineFunctionPointer = call_readline;
| ^ ~~~~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/cc' failed with exit code 1
hint: This usually indicates a problem with the package or the build environment.
ThousandEyes-CLIのソースコードを確認したのですが、readlineはimportされていないようです(?)。その為、readlineはスキップし、他のライブラリを手動でインストールしてしまいます。
uv pip install jinja2 prompt_toolkit pyyaml requests rich
Ubuntu へインストールする¶
Ubuntu へインストールする場合は事前に以下をインストールしておきます。libncurses-devがインストールされていればreadlineのビルドも正常に完了しました。
apt -y install gcc libncurses-dev
ThousandEyes-CLIを起動する¶
ThousandEyes-CLIを起動するとトークンの入力を求められます。ThouandEyesの管理画面上で発行したトークンを入力します。
% python thousandeyes-cli.py
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ThousandEyes API Status: Accessible │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Bearer Authentication Token: TOKEN
CLIかららは以下のコマンドが実行できるようです。
thousandeyes# show
show accounts
show agents
show alerts
show alerts rules
show alerts suppression windows
show bgp monitors
show credentials
show dashboards
show endpoints
show endpoints labels
show endpoints tests
show tags
show tests
試しにshow accounts
を実行すると以下のように表示されました。
thousandeyes# show accounts
{
"accountGroups": [
{
"accountGroupName": "USERNAME",
"aid": "1234567",
"isCurrentAccountGroup": true,
"isDefaultAccountGroup": true,
"organizationName": "ORGANIZATION",
"orgId": "123456"
}
],
"_links": {
"self": {
"href": "https://api.thousandeyes.com/v7/account-groups"
}
}
}