views:

70

answers:

1

Hello. I am programming web interface which communicates with cisco switches via telnet. I want to make such system which will be storing one telnet connection per switch and every script (web interface, cron jobs, etc.) will have access to it. This is needed to make a single query queue for each device and prevent huge cisco processor load caused by several concurent telnet connections. How do I can do this?

updated

Option with connection handling daemon is good and will work in the best way. Sharing telnet connection object between scripts may be difficult to implement and debug. But this option is interesting because interface is using only by couple of operators and cron jobs.

+1  A: 

The usual way would be to have a process running in the background that keeps hold of the persistent telnet connections and commands queued to go down them.

Then have the front-end scripts connect to it (eg. via a unix socket) to queue commands and get the results asynchronously.

But this might be overkill. How many people are you expecting to be using a switch interface concurrently? A lightweight alternative for just the web part of it would be to keep the telnet connection object in the web scripts, and configure the web server/gateway to only launch one instance of your webapp at once.

bobince