Question 1 of 30
In a network automation scenario, you are tasked with writing a Python script that interacts with a Cisco device using the Netmiko library. The script needs to connect to the device, execute a command to retrieve the device\'s hostname, and then log the output to a file. If the command executed is `show running-config | include hostname`, which of the following best describes the expected output handling and logging process in your script?
The script should capture the output of the command execution, parse the relevant line containing the hostname, and write it to a log file in a structured format such as JSON for easy readability and future processing.
The script should simply print the output of the command to the console without any further processing or logging, as this is sufficient for most automation tasks.
The script should execute the command and write the entire output to a log file without filtering for the hostname, as this provides a complete view of the device's configuration.
The script should only log the success or failure of the command execution without capturing the actual output, as logging the output is unnecessary for monitoring purposes.

Preparing for CISCO 100-490 Supporting Cisco Routing and Switching Network Devices v3.0? Now land the interview.

73% of qualified candidates get rejected because of weak resumes. Build an ATS-optimized, recruiter-ready resume in under 5 minutes - free to start.

Build My Resume Free