Automation script to notify owners via email if the instances are off for set number of days

Please see the link below for a simple python script that when executed as a task via Morpheus will notify instance owners if the their instances are off for set number of days.

  1. Create a python task in Morpheus and copy the content from the GitHub link above.

Make sure the additional packages are set as shown above.

  1. Set the following variables as required and save the task:
shutdownDays = 90    #Number of days before sending the notification
port = 587  # Email server starttls port
smtp_server = "" #SMTP server 
sender_email = "" #Senders email address
email_password=c.get("secret/mypass000") #Set the email password in Morpheus cypher
  1. Create an execution schedule by navigating to Library >> Automation >> Execute Scheduling.

  2. Create a task execution job via Provisioning >> Jobs and select the task and execution schedule created above.

Morpheus will now run the task on the scheduled times and notify the owners if the instances have been off for set number of days.