63
63
- (item.0.target_name == item.1.target_name) or (item.1.target_name == 'all')
64
64
register : set_metric_thresholds
65
65
66
- - name : Set Scheduler Attributes
66
+ - name : Enable and Disable Collections
67
67
shell : |
68
68
. {{ stage }}/emcli_login.sh
69
- echo "Setting scheduler attributes for {{ item.1.target_type }} {{ item.0.target_name }} {{ item.1.collection_name }}"
69
+ echo "Setting scheduler state for {{ item.1.target_type }} {{ item.0.target_name }} {{ item.1.collection_name }}"
70
70
{{ emcli }} modify_collection_schedule -targetNames={{ item.0.target_name }} -targetType={{ item.1.target_type }} \
71
71
-collectionName={{ item.1.collection_name }} \
72
- {{ ( '-collectionStatus=' + item.1.collection_attribute_value) if (item.1.collection_attribute == 'collectionStatus') else '' }} \
72
+ '-collectionStatus=' + item.1.collection_attribute_value \
73
73
-preview=N -force
74
74
loop : " {{ oem_targets | product(( all_oem_metrics | flatten_emcli_metrics('schedule') ) + ( host_oem_metrics | flatten_emcli_metrics('schedule') )) }}"
75
75
when :
76
76
- item.0.target_type == item.1.target_type
77
77
- (item.0.target_name == item.1.target_name) or (item.1.target_name == 'all')
78
- register : set_metric_thresholds
78
+ - item.1.collection_attribute == 'collectionStatus'
79
+ register : enable_disable_collections
80
+
81
+ # We change the collection schedule by using the "interval" attribute. This is not an Oracle attribute but
82
+ # instead it combines 2 Oracle attributes we have defined here for that purpose, separated by a space.
83
+ # It takes the form 'freqValue freqType' where freqValue and freqType are Oracle attributes described at:
84
+ # https://docs.oracle.com/en/enterprise-manager/cloud-control/enterprise-manager-cloud-control/13.5/emcli/modify_collection_schedule.html#GUID-A166D2BC-8ECE-4B11-921D-0D756F827E86
85
+ # For example '15 Minute' requires a collection to be taken every 15 minutes.
86
+ # freqType={Minute}{Hour}{Day}{Week}{Weekly}{Month}
87
+ # freqValue={any integer value for Minute/Hour/Day/Week}{One or more from
88
+ # Mon...Sun for Weekly}{One or more from 1;2..31 or Last for Month}
89
+ - name : Reschedule Collections
90
+ shell : |
91
+ . {{ stage }}/emcli_login.sh
92
+ echo "Setting scheduler frequency for {{ item.1.target_type }} {{ item.0.target_name }} {{ item.1.collection_name }}"
93
+ {{ emcli }} modify_collection_schedule -targetNames={{ item.0.target_name }} -targetType={{ item.1.target_type }} \
94
+ -collectionName={{ item.1.collection_name }} \
95
+ -freqType=' + item.1.collection_attribute_value.split(' ')[1] \
96
+ -freqValue=' + item.1.collection_attribute_value.split(' ')[0] \
97
+ -preview=N -force
98
+ loop : " {{ oem_targets | product(( all_oem_metrics | flatten_emcli_metrics('schedule') ) + ( host_oem_metrics | flatten_emcli_metrics('schedule') )) }}"
99
+ when :
100
+ - item.0.target_type == item.1.target_type
101
+ - (item.0.target_name == item.1.target_name) or (item.1.target_name == 'all')
102
+ register : enable_disable_collections
103
+
79
104
80
105
- name : Setup Database Credentials
81
106
include_tasks : configure_database_credentials.yml
93
118
database_target_name : " {{ item.0.target_name }}"
94
119
95
120
always :
96
- - name : Remove Threshold File from Stage Area
121
+ - name : Remove Temporary Files from Stage Area
97
122
file :
98
- path : " {{ stage }}/oem_threshold.txt "
123
+ path : " {{ stage }}/{{ item }} "
99
124
state : absent
125
+ loop :
126
+ - oem_threshold.txt
127
+ - emcli_login.sh
0 commit comments