Mixed inventory, unknown alert
Normalize uppercase and padded status, reject malformed latency and keep unmatched log hosts separate
A fictional MSP has supplied a CSV inventory and monitoring logs. Write a reusable Python report that identifies offline hosts, rejects malformed data and correlates validated alert evidence.
A fictional MSP has supplied an inventory export and event log. Write a reusable Python analyzer that validates records, correlates known alerts, and returns a defensible report.
The function you write must work against different inventories and logs. You won't be given the final answer. When you're ready, use Check to run five fictional cases in the browser, including missing files, inconsistent data and repeated alerts.
These scenarios check behavior, not whether you copied the sample result. The scenarios are disclosed so you can reason about your implementation. Your code is checked locally in the browser; it is not an accredited or proctored exam.
Normalize uppercase and padded status, reject malformed latency and keep unmatched log hosts separate
Produce an empty alert/incident report without inventing failures
Reject invalid status, negative latency, blank hosts and case-insensitive duplicate hostnames
Return an explicit header error rather than misclassifying incomplete data
Keep valid inventory findings and report a missing log source
You shouldn't have to build a complete inventory analyzer from memory after only repairing code. These three independent challenges let you practice CSV headers, device filtering and alert correlation separately. Then return to the full assessment and combine those ideas.
Practice three independent building blocks before combining them in the final analyzer.
Independent build: Write headers_ok(csv_text), a function that returns True only when the CSV header contains host, status and latency_ms (in any order). Return False for missing columns or empty input. Use csv.DictReader and StringIO. The sample should print 'True / False'.
True / FalseTry solving it before asking for help. Hints never show a completed program.
Your printed output and errors will appear here.
Run the code, then step through the executed lines to watch variable values change.
How to work: Write the analyzer inside the editor, choose Run to inspect your code, then choose Check to evaluate the five different scenarios. The starter includes a function contract but intentionally does not implement the pipeline. Only the five automated checks passing records a browser-local verification flag.
Need to review a concept? Read Python for IT Automation → or revisit Files, Exceptions & Modules →.
Write one analyzer and check it against five different temporary CSV and log scenarios. A memorized output cannot pass.
A fictional MSP has supplied an inventory export and event log. Write a reusable Python analyzer that validates records, correlates known alerts, and returns a defensible report. Define analyze_inventory(csv_path, log_path) with the exact return contract shown in starter code. Read a CSV with DictReader and require host, status and latency_ms headers. If missing, return an empty report with error='missing columns'. Normalize hostnames to uppercase and statuses to lowercase. Accept only online, offline, unknown, and nonnegative integer latency. Count missing/invalid/duplicate host records as invalid rows; track valid_count separately. Never infer healthy status from missing information. Only ALERT lines of the form 'ALERT HOSTNAME event_name' count. Deduplicate hostnames and cross-reference against validated inventory. List unmatched alerts separately. If the event-log path is missing, keep the validated CSV counts and return error='missing log file'. Return the six-key report dictionary in a stable, sorted form. Do not print from analyze_inventory; the verification harness prints its own summary.
5 scenario checks completedTry solving it before asking for help. Hints never show a completed program.
Your printed output and errors will appear here.
Run the code, then step through the executed lines to watch variable values change.