To check if VDB databases are updated in Cisco FMC and print the results to an Excel file using Python, you can use the following approach:
1.Access Cisco FMC through API: Use the Cisco FMC API to retrieve the VDB database information. You can find more details about the API in the Cisco FMC API documentation.
import requests
import jsonfmc_feeds_url = “https://10.10.10.10/api/fmc_feeds/access”
fmc_headers = {‘content-type’: ‘application/json’}
fmc_auth = (‘admin’, ‘YourPassword’) # replace ‘YourPassword’ with your actual passwordresponse = requests.get(fmc_feeds_url, headers=fmc_headers, auth=fmc_auth, verify=False)
feeds = json.loads(response.text)
2.Parse the API response: Extract the VDB database information from the API response.
vdb_databases = [feed for feed in feeds[‘items’] if feed[‘name’].startswith(‘VDB’)]
3.Create an Excel file and print the results: Use a library like pandas to create an Excel file and print the results.
import pandas as pd
df = pd.DataFrame(vdb_databases)
df.to_excel(‘VDB_databases.xlsx’, index=False)

Leave a comment