Automation Scripts

Reply
Highlighted

Best way to install additional Python modules on NetMRI appliance?

cshaad123
Techie
Posts: 9
5396     0

I would like to install some additional Python modules for use in NetMRI scripts.  It doesn't look like pip is installed in the sandbox by default.  What is the best way to install new modules to have them work from scripts and not interfere with any system processes?  Thanks for any info.

Re: Best way to install additional Python modules on NetMRI appliance?

Adviser
Posts: 401
5397     0

SSH into the NetMRI appliance type in “sandbox login”

 

Then run the following

I used the following get-pip.py script to install it and then we were able to install other modules via “pip install”

 

So now in the UI Python scripts you can use the new installed module.

 

NOTE:  I have not tested if the “sandbox” gets upgraded, if it resets these modules or not.

 

 

[root@sandbox ~]# wget https://bootstrap.pypa.io/get-pip.py 
--2017-12-21 08:14:20--  https://bootstrap.pypa.io/get-pip.py 
Resolving bootstrap.pypa.io... 151.101.188.175 
Connecting to bootstrap.pypa.io|151.101.188.175|:443... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 1595408 (1.5M) [text/x-python] 
Saving to: `get-pip.py' 
 
100%[===========================================================================================>] 1,595,408    212K/s   in 11s     
 
2017-12-21 08:14:32 (145 KB/s) - `get-pip.py' saved [1595408/1595408] 
 
[root@sandbox ~]# python3 get-pip.py 
Collecting pip 
 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 
   100% |████████████████████████████████| 1.3MB 105kB/s 
Collecting wheel 
 Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB) 
   100% |████████████████████████████████| 51kB 113kB/s 
Installing collected packages: pip, wheel 
Successfully installed pip-9.0.1 wheel-0.30.0 
 
 
 
[root@sandbox ~]# pip install whateveryou want

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

Re: Best way to install additional Python modules on NetMRI appliance?

[ Edited ]
Adviser
Posts: 62
5397     0

If there is no internet connection on the sandbox you can use the following workaround to upload script or modules to sandbox:

 

Upload the script or module to the sandbox environment by using SCP to send the file into the administrator shell's /Backup/Sandbox directory (below is an example):
scp get-pip.py admin@172.23.28.2:/Backup/Sandbox

 

In the administrative shell, the /Backup/Sandbox directory maps to the /mnt/host/data/userdata directory inside the sandbox. After the file has been successfully uploaded to the sandbox, login to the sandbox via the administrative shell.
sandbox login

 

Once inside the sandbox, use the standard installation procedure to install script or modules located at
/mnt/host/data/userdata. As an example:

 

#cd /mnt/host/data/userdata
#python3 get-pip.py
#pip install package_name

 

 

The above information will also be added to Admin Guide in Future Releases of NetMRI

Showing results for 
Search instead for 
Do you mean 

Recommended for You