Sample code using the NetCloud Manager API for key use cases
python3 -m venv .venv . .venv/bin/activate pip install -r requirements.txt
You need to create API keys in NCM to use these scripts so they can access your NCM account. To make them available to the script, set them in the environment, for example:
export X_CP_API_ID=b89a24a3 export X_CP_API_KEY=4b1d77fe271241b1cfafab993ef0891d export X_ECM_API_ID=c71b3e68-33f5-4e69-9853-14989700f204 export X_ECM_API_KEY=f1ca6cd41f326c00e23322795c063068274caa30
(These are not valid keys, get your own from the NCM site!)
Remember to enter your virtual environment again if you are in a new terminal and to export your keys (see above).
Run the example scripts. They will provide usage information if you use the --help option. For instance:
Specific examples are described below.
This repository could benefit from being a Python package using
This way when following the directions on the main README, there could be one extra step to install the package, e.g.
pip install -e /location/of/api-samples
Then the samples could be run pretty seamlessly, and modified in-place with key changes, etc. As it is when trying to run the sample
net_device_signal_samples.py I had to manually modify the PYTHONPATH so that the internally-defined
monitoring.utils.session package could be correctly imported by Python within the virtual environment.
I could supply a PR if this idea seems good. It's not a big deal, would just make quick operation of the samples a little easier and quicker.