Skip to content

This Python script enables the execution of Telnet commands on a remote device and saves the output to files with timestamps. It offers functionalities to display memory and CPU usage, as well as to save configurations.

Notifications You must be signed in to change notification settings

LuisFilipeNunes/commandRunnerPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Telnet Command Runner

This Python script enables the execution of Telnet commands on a remote device and saves the output to files with timestamps. It offers functionalities to display memory and CPU usage, as well as to save configurations.

Features

Execute Telnet commands on a remote device.
Save the output of commands with timestamps.
Support for displaying memory and CPU usage.
Option to save device configurations periodically.
Option to save the Debug Gpon onu from equipment terminal on a separate file. 

Usage

Execution:
    Run the script with the required arguments:


    python3 command_runner.py -H <host> [-u <telnet_user>] [-t <telnet_port>] [-p <telnet_password>] [-i <interval>] [-T <Type>]


Arguments:
    -H, --host: Specifies the host IP address.
    -u, --telnet-user: Sets the Telnet username (default: admin).
    -t, --telnet-port: Specifies the Telnet port (default: 23).
    -p, --telnet-password: Sets the Telnet password (default: parks).
    -i, --interval: Sets the interval for saving configurations, in seconds (default: 30).
    -T, --Type: Changes the type of command sent to the device (default: save_config). Options: show_memory, show_cpu, save_config and debug_listener.

Example

To run the script and save CPU usage information at a 60 seconds interval:

python3 command_runner.py -H 192.168.1.100 -u admin -t 23 -p parks -i 60 -T show_cpu

To run the script and save Memory usage information at a 60 seconds interval:

python3 command_runner.py -H 192.168.1.100 -u admin -t 23 -p parks -i 60 -T show_cpu

To run the script and save the terminal output on a file.

python3 command_runner.py -H 192.168.1.100 -u admin -t 23 -p parks -i 60 -T debug_listener > debug_output.txt

Notes

Output files are saved with timestamps.
The script uses the pexpect library for handling Telnet interactions.
It supports basic error handling and logging.
Ensure proper permissions and network access for Telnet communication.

About

This Python script enables the execution of Telnet commands on a remote device and saves the output to files with timestamps. It offers functionalities to display memory and CPU usage, as well as to save configurations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages