Solved

Email notification on schedule via command line

  • 3 November 2021
  • 13 replies
  • 112 views

Badge +6

Hello,

 

I’m trying to add an alert to my script, when a scheduler runs to send the output via email to the client.

I want to configure this via command line.

I searched in the documentation but didn’t seem to find any information about this.

Does anyone know how to do this configuration?

 

Kind regards,

Jmiamaral

icon

Best answer by Mike Struening 11 February 2022, 17:14

View original

13 replies

Userlevel 7
Badge +15

Hi @jmiamaral 

Please can you clarify what you need to achieve and provide some extra details?

You can add an alert to trigger for various criteria, e.g. when a job fails, when any job with any status completes, when certain thresholds are met:

Creating an Alert

Creating an Alert from the Alert Wizard

You can certainly provide alert output via email, but there are certain ways and conditions to trigger an alert, so we need to understand more about the script and scheduler actions you need to alert on.

Thanks,

Stuart

Badge +6

@Stuart Painter 

I’m provided with an email, and i have to associate an alert for a respective scheduler with that email and send the output of job failed/sucessfull to that email.

I have a script to create schedules but i cant seem to find a way to add that notification to the schedule via command line.

 

Kind regards,

Jmiamaral

Userlevel 7
Badge +23

@jmiamaral , have you looked into the execute script option?

https://documentation.commvault.com/11.24/expert/45276_qoperation_execute.html

The important part:

You can use this command to run the XML files generated from the Save As Script option in the CommCell Console as well as user-created XML files.

This way, you can export creating an alert or schedule to xml and use those as the scripts.

Badge +6

I saved as a script directly from Commvault with the alert configured, but when i see the generated xml i dont see the element for the email notification.

This is my example of xml created with the alert:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<TMMsg_CreateTaskReq>

  <processinginstructioninfo/>

  <taskInfo>
    <task>
      <taskName>tete</taskName>
      <taskFlags>
        <isEdgeDrive>false</isEdgeDrive>
      </taskFlags>
      <policyType>DATA_PROTECTION</policyType>
      <taskType>SCHEDULE_POLICY</taskType>
      <initiatedFrom>COMMANDLINE</initiatedFrom>
      <description></description>
      <isEditing>false</isEditing>
      <alert>
        <alertName>Data Protection - Wednesday, 03, November, 2021 16:31:7</alertName>
      </alert>
      <taskSecurity/>
      <securityAssociations/>
    </task>
    <appGroup>
      <appGroups>
        <appGroupName>Archived Files</appGroupName>
      </appGroups>
      <appGroups>
        <appGroupName>Protected Files</appGroupName>
      </appGroups>
    </appGroup>
    <associations>
      <subclientName></subclientName>
      <backupsetName></backupsetName>
      <instanceName></instanceName>
      <appName></appName>
      <clientName>arianefs1</clientName>
    </associations>
    <subTasks>
      <subTask>
        <subTaskName>ee</subTaskName>
        <subTaskId>1</subTaskId>
        <subTaskType>BACKUP</subTaskType>
        <operationType>BACKUP</operationType>
      </subTask>
      <pattern>
        <freq_type>Weekly</freq_type>
        <daysToRun>
          <Friday>true</Friday>
        </daysToRun>
        <freq_interval>32</freq_interval>
        <freq_relative_interval>0</freq_relative_interval>
        <freq_recurrence_factor>1</freq_recurrence_factor>
        <freq_subday_interval>0</freq_subday_interval>
        <skipOccurence>0</skipOccurence>
        <skipDayNumber>0</skipDayNumber>
        <active_start_date>2021-11-03 00:00:00</active_start_date>
        <active_start_time>21:00:00</active_start_time>
        <active_end_time>00:00:00</active_end_time>
        <active_end_occurence>0</active_end_occurence>
        <timeZone>
          <TimeZoneName>(UTC+00:00) Dublin, Edinburgh, Lisbon, London</TimeZoneName>
        </timeZone>
        <calendar>
          <calendarName>Standard</calendarName>
        </calendar>
        <description>Every week on Friday at 21:00  starting November 3, 2021 </description>
      </pattern>
      <options>
        <backupOpts>
          <backupLevel>FULL</backupLevel>
          <mediaOpt/>
          <dataOpt>
            <createNewIndex>true</createNewIndex>
            <followMountPoints>true</followMountPoints>
            <useCatalogServer>true</useCatalogServer>
            <enforceTransactionLogUsage>false</enforceTransactionLogUsage>
            <skipConsistencyCheck>false</skipConsistencyCheck>
            <granularrecovery>false</granularrecovery>
            <skipCatalogPhaseForSnapBackup>true</skipCatalogPhaseForSnapBackup>
            <autoCopy>false</autoCopy>
            <collectVMGranularRecoveryMetadataForBkpCopy>false</collectVMGranularRecoveryMetadataForBkpCopy>
          </dataOpt>
          <cdrOptions>
            <full>true</full>
            <incremental>false</incremental>
            <dataVerificationOnly>false</dataVerificationOnly>
          </cdrOptions>
          <dbBackupOptions>
            <maxDbBackupType>UNKNOWN</maxDbBackupType>
          </dbBackupOptions>
          <vsaBackupOptions>
            <backupFailedVMsOnly>false</backupFailedVMsOnly>
          </vsaBackupOptions>
          <runIncrementalBackup>false</runIncrementalBackup>
          <incLevel>BEFORE_SYNTH</incLevel>
          <doNotTruncateLog>false</doNotTruncateLog>
          <sybaseSkipFullafterLogBkp>false</sybaseSkipFullafterLogBkp>
          <collectMetaInfo>false</collectMetaInfo>
          <truncateLogsOnSource>false</truncateLogsOnSource>
          <notSynthesizeFullFromPrevBackup>false</notSynthesizeFullFromPrevBackup>
          <adHocBackup>false</adHocBackup>
          <distAppsBackupOptions>
            <runDataBkp>true</runDataBkp>
            <runLogBkp>false</runLogBkp>
          </distAppsBackupOptions>
        </backupOpts>
        <restoreOptions>
          <commonOptions>
            <syncRestore>false</syncRestore>
          </commonOptions>
        </restoreOptions>
        <adminOpts>
          <contentIndexingOption>
            <subClientBasedAnalytics>false</subClientBasedAnalytics>
          </contentIndexingOption>
        </adminOpts>
        <commonOpts>
          <perfJobOpts/>
          <automaticSchedulePattern>
            <useStorageSpaceFromMA>false</useStorageSpaceFromMA>
          </automaticSchedulePattern>
        </commonOpts>
      </options>
      <subTaskOperation>OVERWRITE</subTaskOperation>
    </subTasks>
  </taskInfo>

</TMMsg_CreateTaskReq>
 

Kind regards,

Jmiamaral

Userlevel 7
Badge +23

It looks like it didn’t add the alert context, though the alert is listed by name.

Let me check with some internal folks to see if we need to get the alert creation XML and splice it inside the schedule creation XML, or something different.

Badge +6

Hello, you have any updates regarding this issue?

 

Kind regards,

Jmiamaral

Userlevel 7
Badge +23

@jmiamaral , let me follow up with a few more people.  I’ll get you something!

Userlevel 7
Badge +23

@jmiamaral , I’m not getting too far with this one.  I would suggest opening a case with support to have them dive in.

Once you do, share the support case number with me to track.

Thanks!

Badge +6

@Mike Struening Ok will do, thank you for your time.

Userlevel 7
Badge +23

Of course, sorry I couldn’t help more.

Let me know the case number was created so I can track it!

Badge +6

@Mike Struening CV ID: 211209-344

Userlevel 7
Badge +23

Looks like there might be a need for a CMR.  I’ll keep following!

Userlevel 7
Badge +23

Sharing the archived solution:

--One-Time Schedule Alert.zip was shared with the customer which will help create a one-time task with an alert associated with it.

-- We modified the previous approach so that this is possible through the command line.

 

Reply