300-435 Question 109
Single answerA network engineer is implementing a Python script to collect interface statistics from a Cisco device using RESTCONF. The engineer wants this script to execute automatically every 15 minutes to ensure up-to-date data is available for reporting. Which approach should the engineer use to achieve this periodic execution?
- A
Use a job scheduler like cron to execute the script every 15 minutes
- B
Configure an EEM (Embedded Event Manager) policy on the Cisco device to trigger the Python script
- C
Use a RESTCONF subscription to automatically execute the script at a 15-minute interval
- D
Implement a loop within the script that runs every 15 minutes using a sleep timer
Show answer and explanation
Correct answer: A
Explanation
To achieve periodic execution of a script, using an external job scheduler like cron is the most efficient and practical solution. It allows the script to run at defined intervals without keeping the script continuously active, which would be resource-intensive. Other options, such as EEM or RESTCONF subscriptions, are not suitable for this specific use case.
- A. Correct.
This is the correct approach. A job scheduler like cron is an external tool designed for periodic task execution and is commonly used for automating script execution at regular intervals.
- B. Incorrect.
While EEM can trigger scripts based on specific events, it is not designed for periodic execution of external Python scripts like the one described in the scenario.
- C. Incorrect.
RESTCONF subscriptions are used for event-driven notifications from the device to an external system. They do not provide a mechanism for periodic execution of external scripts.
- D. Incorrect.
While a sleep timer within the script could achieve periodic execution, it is not a best practice as it would keep the script running continuously, potentially consuming unnecessary resources.