Skip to content

Commit 9932fe6

Browse files
committed
Allow setting of Scheduler Attributes
1 parent e9bd652 commit 9932fe6

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

playbooks/delius_oem_metrics_setup/delius_oem_metrics_setup/tasks/modify_metric_thresholds.yml

+34-6
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,44 @@
6363
- (item.0.target_name == item.1.target_name) or (item.1.target_name == 'all')
6464
register: set_metric_thresholds
6565

66-
- name: Set Scheduler Attributes
66+
- name: Enable and Disable Collections
6767
shell: |
6868
. {{ 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 }}"
7070
{{ emcli }} modify_collection_schedule -targetNames={{ item.0.target_name }} -targetType={{ item.1.target_type }} \
7171
-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 \
7373
-preview=N -force
7474
loop: "{{ oem_targets | product(( all_oem_metrics | flatten_emcli_metrics('schedule') ) + ( host_oem_metrics | flatten_emcli_metrics('schedule') )) }}"
7575
when:
7676
- item.0.target_type == item.1.target_type
7777
- (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+
79104

80105
- name: Setup Database Credentials
81106
include_tasks: configure_database_credentials.yml
@@ -93,7 +118,10 @@
93118
database_target_name: "{{ item.0.target_name }}"
94119

95120
always:
96-
- name: Remove Threshold File from Stage Area
121+
- name: Remove Temporary Files from Stage Area
97122
file:
98-
path: "{{ stage }}/oem_threshold.txt"
123+
path: "{{ stage }}/{{ item }}"
99124
state: absent
125+
loop:
126+
- oem_threshold.txt
127+
- emcli_login.sh

0 commit comments

Comments
 (0)