Lab 2: Check Disk Usage

Scenario

IT system administrator or DevOps team member often needs to monitor the disk capacity of nodes (minions). When the nodes are close to reaching their full capacity, that usually signals the need to purchase new hardware or requisition new virtual machines to meet server capacity needs. You’ll learn how to use Automation Config to run a job that checks the current disk usage for your nodes.

Task A. Create Job - Check Disk Usage

  1. Click Configurations > Jobs in the side menu
  2. Click Create Job button

If you don’t see the Create Job button, you do not have permission to create new jobs. Contact your VMware Aria Automation administrator for access or to create this job on your behalf so that you can complete the tutorial.

  1. Input the following details for the new job and save the job.
    • Name = Check disk usage
    • Description = Checks disk usage on targeted devices.
    • Command = salt
    • Targets = (Blank)
    • Function = disk.usage
    • Arguments = (Blank)
    • Job Inputs = (Blank) A new job that checks disk usage on targeted machines
  2. Click SAVE button
  3. Now that you’ve created a job

Task B. Run Job - Check Disk Usage

  1. In the side menu, click Targets to open the Targets workspace and view your targets
  2. Locate All Minions target
  3. Click the button besides All Minions and select Run job
  4. In the Run Job dialog box
    • Input the information as follows
      • Job = Check disk usage (the job you have created in the previous task)
      • Options = (Unchanged) Run Job dialog box
  5. Click RUN NOW button
  6. Click Activity > Completed in the side menu
  7. The job will appear on the list once it is done. If not, Refresh the page in your browser
  8. Click the JID value of the completed job to show job summary
  9. Click Disk Usage tab to show results in tabular format
  10. Click Download > JSON button to export the results as JSON file Returns from the disk usage job

Summary

As you review the job results, consider the following points:

  • Notice that this job is cross-platform. You’ll get the same result no matter which operating system the minion is running (Windows, Linux, MacOS, etc.). Automation Config is designed to work with nearly every operating system.
  • Automation Config also gives you the ability to run this job on a schedule and to publish it into an exportable report.
  • You could also use this job in a more sophisticated way using Salt’s beacon and reactor system. The beacon and reactor system allows you to set up events that will trigger a reaction event. For example, you could set up a schedule that checks disk usage on a regular basis. When the percentage used is above a certain threshold, you could have Salt send a notification email, text message, or Slack message indicating that new hardware needs to be procured.