!_tar.gz file の展開
$ tar zxvf analysis-collectors.tar.gz
x cnae_data_collection.py
x README.md
x version.properties
$
!_python version の確認。 NAE 3.1(1) の場合、2.7.10 以上が必要。
$ python --version
Python 2.7.15
$
!_script を実行したものの、package 不足で error が出力される。
$ python cnae_data_collection.py
Traceback (most recent call last):
File "cnae_data_collection.py", line 28, in <module>
import requests
ImportError: No module named requests
$
!_足りない packet の install
$ pip install requests
Collecting requests
[snip]
Successfully installed certifi-2019.9.11 chardet-3.0.4 idna-2.8 requests-2.22.0 urllib3-1.25.6
$
!_install されている package の確認
$ pip freeze
certifi==2019.9.11
chardet==3.0.4
idna==2.8
requests==2.22.0
[snip]
$
$
!_引数をつけずに実行、もしくは -h で help が表示される。
$ python cnae_data_collection.py
usage: cnae_data_collection.py [-h] -APIC APIC [APIC ...] -clusterName
CLUSTERNAME -user USER -targetDir TARGETDIR
[-maxThreads MAXTHREADS]
[-aciVersion ACIVERSION]
[-switchVersion SWITCHVERSION]
[-thirdPartyServices THIRDPARTYSERVICES]
[-versionProperties VERSIONPROPERTIES]
[-connectionPreferencePrimary {outofband,inband}]
[-connectionPreferenceSecondary {outofband,inband}]
[-apicConfigExportPolicyName APICCONFIGEXPORTPOLICYNAME]
[-apicConfigExportFormat {xml,json}]
[-apicConfigExportTimeOut APICCONFIGEXPORTTIMEOUT]
[-nat NAT]
cnae_data_collection.py: error: argument -APIC is required
!_必要な引数は -APIC, -clusterName, -user, -targetDir のようなので、それらを入力し実行
$ python cnae_data_collection.py -APIC 10.71.168.217 -clusterName fab3 -user admin -targetDir ./
Enter password for APIC : ['10.71.168.217'] , user: admin
Password:
2019-10-31 14:19:12,354 - 4746372544 - INFO - Checking for python module compatibility
[snip]
2019-10-31 14:29:44,291 - 4746372544 - INFO - Data collection *SUCCESSFUL* for iteration: 3
2019-10-31 14:29:45,259 - 4746372544 - INFO - Compressed data file located at : /Users/yushimaz/Downloads/fab3_2019-10-31_05_19_06.tar.gz size: 11.0MB
2019-10-31 14:29:45,260 - 4746372544 - INFO - Exiting Candid Data collection
Total Candid Collection time candidDataCollectionStandalone: 638.736086845 seconds
$
|