Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

Automation Scripts


Issue Getting Output from device CLI via NetMRI API

New Member
Posts: 1
1458     0



I need to get output from a device CLI via the NetMRI API from an external server. I am testing with the python script below which was posted here by SBaksh 


The issue seems to be with dis_sessions. This line just returns None:

cli_connection = client.api_request('dis_sessions/open_session_and_connection', params={'device_id': i.DeviceID})

 Here is the complete script:

# Script-Filter:
#     true
# Script-Login:
#     false
# Script-Variables:
# Script-Timeout: 
#	3670
import infoblox_netmri
from infoblox_netmri.client import InfobloxNetMRI
client = infoblox_netmri.client.InfobloxNetMRI(
# Get brokers for required objects
device_broker = client.get_broker('Device')	
# Search for our 2 devices to get the Id's	
devices =[
for i in devices:
    # Open Dis and Cli Session
    print('Opening DIS and Cli Session for device_id: ',i.DeviceID)
    cli_connection = client.api_request('dis_sessions/open_session_and_connection', params={'device_id': i.DeviceID})
    print("Cli Connection: ",cli_connection)
    # Send Command
    response = client.api_request('cli_connections/send_command', params={'SessionID': cli_connection['cli_connection']['SessionID'], 'device_id': i.DeviceID, 'command': 'sh ip int brief'})
    print("Send Response: ",response)
    # Close the Session
    response = client.api_request('dis_sessions/close', params={'SessionID': cli_connection['cli_connection']['SessionID']})
    print("Close response: ",response) 


Re: Issue Getting Output from device CLI via NetMRI API

Posts: 23
1459     0

Hi, Did you ever get this to work? I tested my script again and it is working fine (with show cdp nei).


Showing results for 
Search instead for 
Did you mean: 

Recommended for You