Write a script to monitor and alert on specific system resource thresholds.
Process chronologically ordered resource samples and generate one alert when a metric reaches or exceeds its threshold after being below it. A metric must fall below its threshold before another alert can be generated. Implement generate_alerts(samples, thresholds), returning alert dictionaries with timestamp, metric, and value.
def generate_alerts(samples, thresholds):