Ytria logo TUTORIALS

This website require JavaScript for full functionality. Please enable JavaScript in your Web browser.


 

Before you begin:


If you want to learn more about how Ytria's automation scripts function, see our automation basics help page.

Run on a single server

Step 1 Copy/paste the script below into any text editor and save it as an XML file.
Step 2 Open agentEZ and load the server you want to check.
Step 3 Select the option 'Load Automation File…' from the Server menu, or use CTRL + X.
Step 4 Finally, find and select the XML file you just saved, and then click 'Open.'

Check multiple servers

Step 1 Copy/paste the script below into any text editor and save it as an XML file.
Step 2 Open replicationEZ and load the servers you want to check.
Step 3 From replicationEZ's Server menu, select the option 'Execute Automation File on...', select agentEZ from the list, select the servers you want to analyze, and then click 'OK'.
Step 4 Finally, find and select the XML file you just saved, and then click 'Open.'


Here is the script:

<ytriaAutomation Application="agentEZ" ApplicationVersion="16.5">
<!--This will set the script's behavior when encountering an error.
In this case, it will continue.-->
<onerror continue="true" />

<!--At this point, we don't want to automatically load the detailed agent information.
This will set it as "false". -->
<Option Type="AutoLoadDetailedAgentInfo" value="False"/>

<!--This will allow the automatic Check Presence in NAB feature to be carried out on
the agent signer for each agent loaded.-->
<Option Type="PresenceInNAB" value="true"/>

<!--This will set the option to use the Design Collection Note which is a much
faster loading option.-->
<UseDesignCollection value="true"/>

<!--This defines our search as looking only for scheduled agents.-->
<AgentTriggerType value="Scheduled" />
<!--This will select all databases on the loaded server.-->
<TreeSelectionLive Value="False"/>
<select target="tree" server="true"/>
<TreeSelectionLive Value="True"/>
<!--The next part of the script will handle the grid layout so the results are presented
in a clear order. A Suspend Grid Redraw function is added so the processing will
be held off until all columns are set.-->
<SuspendRedraw value="true"/>

<!--All columns are removed from the main grid in order to prepare for the columns that
will be added.-->
<RemoveAllcolumns/>

<!--Second, the columns that we want are added back into the first position
and in reverse order.-->
<Add ColumnID="STATUS_LOAD" Position="1"/><!-- Is Agent Fully Loaded? -->
<Add ColumnID="D33" Position="1"/><!-- Is background agent disabled on database -->
<Add ColumnID="B6" Position="1"/><!-- Comment -->
<Add ColumnID="D3" Position="1"/><!-- Database Type -->
<Add ColumnID="R24" Position="1"/><!-- Run on week-ends -->
<Add ColumnID="R23" Position="1"/><!-- Stop running agent on this date -->
<Add ColumnID="R22" Position="1"/><!-- Start running agent on this date -->
<Add ColumnID="R21" Position="1"/><!-- Running Interval -->
<Add ColumnID="M13" Position="1"/><!-- Signer -->
<Add ColumnID="B5" Position="1"/><!-- Last Alias -->
<Add ColumnID="B4" Position="1"/><!-- Name -->
<Add ColumnID="D2" Position="1"/><!-- Database Filename -->
<Add ColumnID="D1" Position="1"/><!-- Database Path -->
<Add ColumnID="L17" Position="1"/><!-- Last Run Duration -->
<Add ColumnID="L15" Position="1"/><!-- Last Run Start Date -->
<Add ColumnID="STATUS" Position="1"/><!-- Status -->

<!--Then, all groupings are removed.-->
<UngroupAll/>

<!--And we will set a new grouping configuration.-->
<GroupBy ColumnID="D46"/><!-- Server -->
<GroupBy ColumnID="R9"/><!-- Run On -->
<GroupBy ColumnID="R12"/><!-- Agent Schedule -->

<!--Also, a new sorting configuration is set.-->
<Sort columnID="L17" Ascending="false"/><!-- Last Run Duration -->
<Sort columnID="D1" Ascending="true"/><!-- Database Path -->
<Sort columnID="D3" Ascending="true"/><!-- Database Type -->
<Sort columnID="D2" Ascending="true"/><!-- Database Filename -->
<!--All existing filters are cleared, and then the grid processing is reactivated
by turning off the Suspend Grid Redraw state.-->
<ClearFilters/>
<SuspendRedraw value="false"/>

<!--Note that the agent details don't need to be loaded in this situaiton, as this info is
provided without a full information load.-->
<Filter columnID="R8" Value="checked"/><!-- Enable -->

<!--The following If condition declares that if something is found (and thus making
the grid count greater than 0), the nested child actions will be carried out.-->
<if target="Grid" test="VisibleRowsCount" Mode="GreaterThan" Value="0">

<!--All enabled agents will be selected (rows loaded in the grid).-->
<Select lines="all"/>

<!--Then, all the detailed agent information is loaded for all selected lines.-->
<LoadMoreInfo/>
<!--A filter is added to find all agents that are enabled and did run correctly.-->
<Filter columnID="L17" Empty="true"/><!-- Last Run Duration not set... -->

<!--These findings can now be exported. Note that this report will be generated
in the same location that this file is being run from.-->
<Export>
<SetParam field="FilePath" value="report_agentEZ.xlsx"/>
<SetParam field="SelectedRowsOnly" value="false"/>
<SetParam field="ExportType" value="Excel"/>
<SetParam field="Mode" value="AppendRows"/>
<SetParam field="ExcelSheetName" value="Enabled Scheduled Agents - LAST RUN"/>
<SetParam field="OpenFileOnceGenerated" value="False"/>
</Export>

<!--All filters will be cleared from the Last Run Duration column.-->
<ClearFilters columnID="L17"/><!-- Last Run Duration... -->

<!--A filter is then added to find all agents that are enabled, but did not run
correctly. A small trick is used here: hiding anything that contains a
":" character (and thus indicating a duration).-->
<Filter columnID="L17" Mode="NotContains" Text=":"/><!-- Last Run Duration... -->

<!--The following If condition declares that if this script is not being used in a
loop, the Excel file will be opened as soon as it is generated. This can't be done
if a loop is being run since the Excel file still may need to be worked on with the
results of another server (depending on what you need to do).
Keep in mind that we can't set an If condition with a SetParam value,
hence the use of this variable.
The variable is initialised first, and it will be changed if not in a loop.-->
<SetVar vOpenExcelFile="False"/>
<if target="var" test="{%ListSize%}" mode="Equals" Value="">
<SetVar vOpenExcelFile="true"/>
</if>

<!--Finally, any findings regarding agents that did not run can be exported.
Note that this report will be generated in the same location that this file
is being run from.-->
<Export>
<SetParam field="FilePath" value="{%CurFilePath%}report_agentEZ.xlsx"/>
<SetParam field="SelectedRowsOnly" value="false"/>
<SetParam field="ExportType" value="Excel"/>
<SetParam field="Mode" value="AppendRows"/>
<SetParam field="ExcelSheetName" value="DID NOT RUN"/>
<SetParam field="OpenFileOnceGenerated" value="{%vOpenExcelFile%}"/>
</Export>
</if>

</ytriaAutomation>