| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright (c) 2021, Cisco Systems |
| 5 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
module: organizations_alerts_profiles |
| 9 |
short_description: Resource module for organizations _alerts _profiles |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource organizations _alerts |
| 12 |
_profiles. |
| 13 |
- Create an organization-wide alert configuration. |
| 14 |
- Removes an organization-wide alert config. |
| 15 |
- Update an organization-wide alert config. |
| 16 |
version_added: '1.0.0' |
| 17 |
extends_documentation_fragment: |
| 18 |
- cisco.meraki.module |
| 19 |
author: Francisco Munoz (@fmunoz) |
| 20 |
options: |
| 21 |
alertCondition: |
| 22 |
description: The conditions that determine if the alert triggers. |
| 23 |
suboptions: |
| 24 |
bit_rate_bps: |
| 25 |
description: The threshold the metric must cross to be valid for alerting. |
| 26 |
Used only for WAN Utilization alerts. |
| 27 |
type: int |
| 28 |
duration: |
| 29 |
description: The total duration in seconds that the threshold should be crossed |
| 30 |
before alerting. |
| 31 |
type: int |
| 32 |
interface: |
| 33 |
description: The uplink observed for the alert. Interface must be one of the |
| 34 |
following wan1, wan2, wan3, cellular. |
| 35 |
type: str |
| 36 |
jitter_ms: |
| 37 |
description: The threshold the metric must cross to be valid for alerting. |
| 38 |
Used only for VoIP Jitter alerts. |
| 39 |
type: int |
| 40 |
latency_ms: |
| 41 |
description: The threshold the metric must cross to be valid for alerting. |
| 42 |
Used only for WAN Latency alerts. |
| 43 |
type: int |
| 44 |
loss_ratio: |
| 45 |
description: The threshold the metric must cross to be valid for alerting. |
| 46 |
Used only for Packet Loss alerts. |
| 47 |
type: float |
| 48 |
mos: |
| 49 |
description: The threshold the metric must drop below to be valid for alerting. |
| 50 |
Used only for VoIP MOS alerts. |
| 51 |
type: float |
| 52 |
window: |
| 53 |
description: The look back period in seconds for sensing the alert. |
| 54 |
type: int |
| 55 |
type: dict |
| 56 |
alertConfigId: |
| 57 |
description: AlertConfigId path parameter. Alert config ID. |
| 58 |
type: str |
| 59 |
description: |
| 60 |
description: User supplied description of the alert. |
| 61 |
type: str |
| 62 |
enabled: |
| 63 |
description: Is the alert config enabled. |
| 64 |
type: bool |
| 65 |
networkTags: |
| 66 |
description: Networks with these tags will be monitored for the alert. |
| 67 |
elements: str |
| 68 |
type: list |
| 69 |
organizationId: |
| 70 |
description: OrganizationId path parameter. Organization ID. |
| 71 |
type: str |
| 72 |
recipients: |
| 73 |
description: List of recipients that will recieve the alert. |
| 74 |
suboptions: |
| 75 |
emails: |
| 76 |
description: A list of emails that will receive information about the alert. |
| 77 |
elements: str |
| 78 |
type: list |
| 79 |
httpServerIds: |
| 80 |
description: A list base64 encoded urls of webhook endpoints that will receive |
| 81 |
information about the alert. |
| 82 |
elements: str |
| 83 |
type: list |
| 84 |
type: dict |
| 85 |
type: |
| 86 |
description: The alert type. |
| 87 |
type: str |
| 88 |
requirements: |
| 89 |
- meraki >= 2.4.9 |
| 90 |
- python >= 3.5 |
| 91 |
seealso: |
| 92 |
- name: Cisco Meraki documentation for organizations createOrganizationAlertsProfile |
| 93 |
description: Complete reference of the createOrganizationAlertsProfile API. |
| 94 |
link: https://developer.cisco.com/meraki/api-v1/#!create-organization-alerts-profile |
| 95 |
- name: Cisco Meraki documentation for organizations deleteOrganizationAlertsProfile |
| 96 |
description: Complete reference of the deleteOrganizationAlertsProfile API. |
| 97 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-organization-alerts-profile |
| 98 |
- name: Cisco Meraki documentation for organizations updateOrganizationAlertsProfile |
| 99 |
description: Complete reference of the updateOrganizationAlertsProfile API. |
| 100 |
link: https://developer.cisco.com/meraki/api-v1/#!update-organization-alerts-profile |
| 101 |
notes: |
| 102 |
- SDK Method used are |
| 103 |
organizations.Organizations.create_organization_alerts_profile, |
| 104 |
organizations.Organizations.delete_organization_alerts_profile, |
| 105 |
organizations.Organizations.update_organization_alerts_profile, |
| 106 |
- Paths used are |
| 107 |
post /organizations/{organizationId}/alerts/profiles, |
| 108 |
delete /organizations/{organizationId}/alerts/profiles/{alertConfigId}, |
| 109 |
put /organizations/{organizationId}/alerts/profiles/{alertConfigId}, |
| 110 |
""" |
| 111 |
|
| 112 |
EXAMPLES = r""" |
| 113 |
- name: Create |
| 114 |
cisco.meraki.organizations_alerts_profiles: |
| 115 |
meraki_api_key: "{{ meraki_api_key }}" |
| 116 |
meraki_base_url: "{{ meraki_base_url }}" |
| 117 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 118 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 119 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 120 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 121 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 122 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 123 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 124 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 125 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 126 |
meraki_output_log: "{{ meraki_output_log }}" |
| 127 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 128 |
meraki_log_path: "{{ meraki_log_path }}" |
| 129 |
meraki_print_console: "{{ meraki_print_console }}" |
| 130 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 131 |
meraki_simulate: "{{ meraki_simulate }}" |
| 132 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 133 |
meraki_caller: "{{ meraki_caller }}" |
| 134 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 135 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 136 |
state: present |
| 137 |
alertCondition: |
| 138 |
bit_rate_bps: 10000 |
| 139 |
duration: 60 |
| 140 |
interface: wan1 |
| 141 |
jitter_ms: 100 |
| 142 |
latency_ms: 100 |
| 143 |
loss_ratio: 0.1 |
| 144 |
mos: 3.5 |
| 145 |
window: 600 |
| 146 |
description: WAN 1 high utilization |
| 147 |
networkTags: |
| 148 |
- tag1 |
| 149 |
- tag2 |
| 150 |
organizationId: string |
| 151 |
recipients: |
| 152 |
emails: |
| 153 |
- [email protected] |
| 154 |
httpServerIds: |
| 155 |
- aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vcGF0aA== |
| 156 |
type: wanUtilization |
| 157 |
- name: Update by id |
| 158 |
cisco.meraki.organizations_alerts_profiles: |
| 159 |
meraki_api_key: "{{ meraki_api_key }}" |
| 160 |
meraki_base_url: "{{ meraki_base_url }}" |
| 161 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 162 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 163 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 164 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 165 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 166 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 167 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 168 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 169 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 170 |
meraki_output_log: "{{ meraki_output_log }}" |
| 171 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 172 |
meraki_log_path: "{{ meraki_log_path }}" |
| 173 |
meraki_print_console: "{{ meraki_print_console }}" |
| 174 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 175 |
meraki_simulate: "{{ meraki_simulate }}" |
| 176 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 177 |
meraki_caller: "{{ meraki_caller }}" |
| 178 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 179 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 180 |
state: present |
| 181 |
alertCondition: |
| 182 |
bit_rate_bps: 10000 |
| 183 |
duration: 60 |
| 184 |
interface: wan1 |
| 185 |
jitter_ms: 100 |
| 186 |
latency_ms: 100 |
| 187 |
loss_ratio: 0.1 |
| 188 |
mos: 3.5 |
| 189 |
window: 600 |
| 190 |
alertConfigId: string |
| 191 |
description: WAN 1 high utilization |
| 192 |
enabled: true |
| 193 |
networkTags: |
| 194 |
- tag1 |
| 195 |
- tag2 |
| 196 |
organizationId: string |
| 197 |
recipients: |
| 198 |
emails: |
| 199 |
- [email protected] |
| 200 |
httpServerIds: |
| 201 |
- aHR0cHM6Ly93d3cuZXhhbXBsZS5jb20vcGF0aA== |
| 202 |
type: wanUtilization |
| 203 |
- name: Delete by id |
| 204 |
cisco.meraki.organizations_alerts_profiles: |
| 205 |
meraki_api_key: "{{ meraki_api_key }}" |
| 206 |
meraki_base_url: "{{ meraki_base_url }}" |
| 207 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 208 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 209 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 210 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 211 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 212 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 213 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 214 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 215 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 216 |
meraki_output_log: "{{ meraki_output_log }}" |
| 217 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 218 |
meraki_log_path: "{{ meraki_log_path }}" |
| 219 |
meraki_print_console: "{{ meraki_print_console }}" |
| 220 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 221 |
meraki_simulate: "{{ meraki_simulate }}" |
| 222 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 223 |
meraki_caller: "{{ meraki_caller }}" |
| 224 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 225 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 226 |
state: absent |
| 227 |
alertConfigId: string |
| 228 |
organizationId: string |
| 229 |
""" |
| 230 |
RETURN = r""" |
| 231 |
meraki_response: |
| 232 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 233 |
returned: always |
| 234 |
type: dict |
| 235 |
sample: > |
| 236 |
{ |
| 237 |
"id": "string", |
| 238 |
"type": "string", |
| 239 |
"enabled": true, |
| 240 |
"alertCondition": { |
| 241 |
"duration": 0, |
| 242 |
"window": 0, |
| 243 |
"bit_rate_bps": 0, |
| 244 |
"interface": "string" |
| 245 |
}, |
| 246 |
"recipients": { |
| 247 |
"emails": [ |
| 248 |
"string" |
| 249 |
], |
| 250 |
"httpServerIds": [ |
| 251 |
"string" |
| 252 |
] |
| 253 |
}, |
| 254 |
"networkTags": [ |
| 255 |
"string" |
| 256 |
], |
| 257 |
"description": "string" |
| 258 |
} |
| 259 |
""" |