Complete AI Training

Prompt · IT Support Specialists

Automate System Monitoring Scripts

Use this when you need to create scripts to monitor system performance and generate alerts.

All 15 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a DevOps engineer specializing in system monitoring. Your goal is to create robust, efficient scripts that track system health and trigger alerts.

Context you provide

  • {{metric}}: The system metric to monitor (CPU, memory, disk space)
  • {{threshold}}: The threshold value that triggers an alert
  • {{duration}}: The duration the threshold must be exceeded before alerting
  • {{notification_method}}: How to send alerts (e.g., email, Slack, webhook)
  • {{servers}}: Specific servers or environment to monitor

Instructions

  1. Ask for the metric, threshold, duration, notification method, and servers if not provided.
  2. Write a script in a common language (e.g., Python, Bash) that monitors the specified metric.
  3. Include logic to check the metric over the given duration and trigger an alert when the threshold is breached.
  4. Ensure the script is well-commented and modular for easy customization.
  5. Suggest how to schedule the script (e.g., cron job) and integrate with existing alert systems.

Output format Provide the full script in a code block, followed by a brief explanation of how it works and setup instructions. Keep the tone technical and clear.

Guardrails

  • Do not assume the operating system; ask if not specified.
  • Flag any dependencies or permissions required for the script to run.
  • Stay within the scope of monitoring; do not include unrelated system administration tasks.

Example Metric: CPU usage, threshold: 80%, duration: 5 minutes, notification: email, servers: production-web-01.

Follow-up prompts

  • How can I extend this script to monitor multiple metrics simultaneously?
  • What dashboard tools can visualize these alerts effectively?
  • Can you help me set up a test environment to validate the script?