# Python Paramiko - how do I wait for response from switch

**URL:** https://forum.networklessons.com/t/python-paramiko-how-do-i-wait-for-response-from-switch/16258
**Category:** Network Automation
**Created:** [January 24, 2022, 9:34pm UTC](https://forum.networklessons.com/t/python-paramiko-how-do-i-wait-for-response-from-switch/16258 "2022-01-24T21:34:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gmvenus](https://cdn-forum.networklessons.com/letter_avatar_proxy/v4/letter/g/a5b964/32.png) [@gmvenus](https://forum.networklessons.com/u/gmvenus)
#### Post date: [January 24, 2022, 9:34pm UTC](https://forum.networklessons.com/t/python-paramiko-how-do-i-wait-for-response-from-switch/16258/1 "2022-01-24T21:34:23Z")

</div>

Hello,  
I went through the Network automation classes and able to do some scripts for most configuration and show output and take action based on the output etc.

Now I need to monitor the switch console and take an action when I see a message something like “BGP session went down”  
Can someone please give some tips on how to do this, basically using paramiko wait for response from switch

thanks,venu

---

<div class="post-metadata">

### Author: ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)
#### Post date: [January 27, 2022, 9:02am UTC](https://forum.networklessons.com/t/python-paramiko-how-do-i-wait-for-response-from-switch/16258/2 "2022-01-27T09:02:20Z")

</div>

Hello Venu

I’m sure there are several ways to do this, but one that comes to mind involves the use of [Embedded Event Manager (EEM) scripting](https://networklessons.com/cisco/ccie-enterprise-infrastructurecisco-ios-embedded-event-manager) in conjunction with Python.

EEM supports Python scripts. Python scripts can be executed as part of EEM actions in EEM applets.

This NetworkLessons note shows how to [match a string within CLI output](https://notes.networklessons.com/eem-matching-a-string-within-cli-output). You can then use the EEM script to call a Python script. This EEM/Python interaction is further described in this Cisco documentation:

> **[Programmability Configuration Guide, Cisco IOS XE Everest 16.6.x - EEM Python...](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/166/b_166_programmability_cg/eem_python_module.html)**
>
> EEM Python Module

If you want to do it natively within Python using Paramiko, take a look at this StackOverflow thread where a user searched for a particular string in the output of the CLI:  
[https://stackoverflow.com/questions/40094461/paramiko-capturing-command-output](https://stackoverflow.com/questions/40094461/paramiko-capturing-command-output)

I hope this has been helpful!

Laz
