summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_zabbix/library/zbx_trigger.py18
-rw-r--r--roles/lib_zabbix/tasks/create_template.yml1
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py23
-rw-r--r--roles/openshift_manage_node/tasks/main.yml12
-rw-r--r--roles/openshift_node/tasks/main.yml1
-rw-r--r--roles/os_zabbix/vars/template_docker.yml6
-rw-r--r--roles/os_zabbix/vars/template_heartbeat.yml1
-rw-r--r--roles/os_zabbix/vars/template_openshift_master.yml1
-rw-r--r--roles/os_zabbix/vars/template_os_linux.yml11
9 files changed, 63 insertions, 11 deletions
diff --git a/roles/lib_zabbix/library/zbx_trigger.py b/roles/lib_zabbix/library/zbx_trigger.py
index c707a2f64..c384f6fa3 100644
--- a/roles/lib_zabbix/library/zbx_trigger.py
+++ b/roles/lib_zabbix/library/zbx_trigger.py
@@ -101,6 +101,7 @@ def main():
description=dict(default=None, type='str'),
dependencies=dict(default=[], type='list'),
priority=dict(default='avg', type='str'),
+ url=dict(default=None, type='str'),
state=dict(default='present', type='str'),
),
#supports_check_mode=True
@@ -123,28 +124,41 @@ def main():
'expandExpression': True,
'selectDependencies': 'triggerid',
})
+
+ # Get
if state == 'list':
module.exit_json(changed=False, results=content['result'], state="list")
+ # Delete
if state == 'absent':
if not exists(content):
module.exit_json(changed=False, state="absent")
content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
module.exit_json(changed=True, results=content['result'], state="absent")
+ # Create and Update
if state == 'present':
params = {'description': description,
'expression': module.params['expression'],
'dependencies': get_deps(zapi, module.params['dependencies']),
'priority': get_priority(module.params['priority']),
+ 'url': module.params['url'],
}
+ # Remove any None valued params
+ _ = [params.pop(key, None) for key in params.keys() if params[key] is None]
+
+ #******#
+ # CREATE
+ #******#
if not exists(content):
# if we didn't find it, create it
content = zapi.get_content(zbx_class_name, 'create', params)
module.exit_json(changed=True, results=content['result'], state='present')
- # already exists, we need to update it
- # let's compare properties
+
+ ########
+ # UPDATE
+ ########
differences = {}
zab_results = content['result'][0]
for key, value in params.items():
diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml
index 630d5dd70..bc9aff997 100644
--- a/roles/lib_zabbix/tasks/create_template.yml
+++ b/roles/lib_zabbix/tasks/create_template.yml
@@ -45,5 +45,6 @@
dependencies: "{{ item.dependencies | default([], true) }}"
expression: "{{ item.expression }}"
priority: "{{ item.priority }}"
+ url: "{{ item.url | default(None, True) }}"
with_items: template.ztriggers
when: template.ztriggers is defined
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index d4f38a7b4..679c3273a 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -16,6 +16,7 @@ EXAMPLES = '''
import ConfigParser
import copy
import os
+from distutils.util import strtobool
def hostname_valid(hostname):
@@ -301,6 +302,23 @@ def set_fluentd_facts_if_unset(facts):
facts['common']['use_fluentd'] = use_fluentd
return facts
+def set_node_schedulability(facts):
+ """ Set schedulable facts if not already present in facts dict
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with the generated schedulable
+ facts if they were not already present
+
+ """
+ if 'node' in facts:
+ if 'schedulable' not in facts['node']:
+ if 'master' in facts:
+ facts['node']['schedulable'] = False
+ else:
+ facts['node']['schedulable'] = True
+ return facts
+
def set_metrics_facts_if_unset(facts):
""" Set cluster metrics facts if not already present in facts dict
dict: the facts dict updated with the generated cluster metrics facts if
@@ -477,8 +495,10 @@ def set_sdn_facts_if_unset(facts):
were not already present
"""
if 'common' in facts:
+ use_sdn = facts['common']['use_openshift_sdn']
+ if not (use_sdn == '' or isinstance(use_sdn, bool)):
+ facts['common']['use_openshift_sdn'] = bool(strtobool(str(use_sdn)))
if 'sdn_network_plugin_name' not in facts['common']:
- use_sdn = facts['common']['use_openshift_sdn']
plugin = 'redhat/openshift-ovs-subnet' if use_sdn else ''
facts['common']['sdn_network_plugin_name'] = plugin
@@ -741,6 +761,7 @@ class OpenShiftFacts(object):
facts['current_config'] = get_current_config(facts)
facts = set_url_facts_if_unset(facts)
facts = set_fluentd_facts_if_unset(facts)
+ facts = set_node_schedulability(facts)
facts = set_metrics_facts_if_unset(facts)
facts = set_identity_providers_if_unset(facts)
facts = set_sdn_facts_if_unset(facts)
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index 74e702248..7c4f45ce6 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -7,15 +7,11 @@
delay: 5
with_items: openshift_nodes
-- name: Handle unscheduleable node
+- name: Set node schedulability
command: >
- {{ openshift.common.admin_binary }} manage-node {{ item }} --schedulable=false
- with_items: openshift_unscheduleable_nodes
-
-- name: Handle scheduleable node
- command: >
- {{ openshift.common.admin_binary }} manage-node {{ item }} --schedulable=true
- with_items: openshift_scheduleable_nodes
+ {{ openshift.common.admin_binary }} manage-node {{ item.openshift.common.hostname }} --schedulable={{ 'true' if item.openshift.node.schedulable | bool else 'false' }}
+ with_items:
+ - "{{ openshift_node_vars }}"
- name: Label nodes
command: >
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 7a862c99f..1986b631e 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -29,6 +29,7 @@
portal_net: "{{ openshift_master_portal_net | default(None) }}"
kubelet_args: "{{ openshift_node_kubelet_args | default(None) }}"
sdn_mtu: "{{ openshift_node_sdn_mtu | default(None) }}"
+ schedulable: "{{ openshift_schedulable | default(openshift_scheduleable) | default(None) }}"
# We have to add tuned-profiles in the same transaction otherwise we run into depsolving
# problems because the rpms don't pin the version properly.
diff --git a/roles/os_zabbix/vars/template_docker.yml b/roles/os_zabbix/vars/template_docker.yml
index 6a28f52b8..a1cd3519e 100644
--- a/roles/os_zabbix/vars/template_docker.yml
+++ b/roles/os_zabbix/vars/template_docker.yml
@@ -54,29 +54,35 @@ g_template_docker:
ztriggers:
- description: 'docker.ping failed on {HOST.NAME}'
expression: '{Template Docker:docker.ping.max(#3)}<1'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_ping.asciidoc'
priority: high
- description: 'Docker storage is using LOOPBACK on {HOST.NAME}'
expression: '{Template Docker:docker.storage.is_loopback.last()}<>0'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_loopback.asciidoc'
priority: high
- description: 'Critically low docker storage data space on {HOST.NAME}'
expression: '{Template Docker:docker.storage.data.space.percent_available.max(#3)}<5 or {Template Docker:docker.storage.data.space.available.max(#3)}<5' # < 5% or < 5GB
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_storage.asciidoc'
priority: high
- description: 'Critically low docker storage metadata space on {HOST.NAME}'
expression: '{Template Docker:docker.storage.metadata.space.percent_available.max(#3)}<5 or {Template Docker:docker.storage.metadata.space.available.max(#3)}<0.005' # < 5% or < 5MB
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_storage.asciidoc'
priority: high
# Put triggers that depend on other triggers here (deps must be created first)
- description: 'Low docker storage data space on {HOST.NAME}'
expression: '{Template Docker:docker.storage.data.space.percent_available.max(#3)}<10 or {Template Docker:docker.storage.data.space.available.max(#3)}<10' # < 10% or < 10GB
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_storage.asciidoc'
dependencies:
- 'Critically low docker storage data space on {HOST.NAME}'
priority: average
- description: 'Low docker storage metadata space on {HOST.NAME}'
expression: '{Template Docker:docker.storage.metadata.space.percent_available.max(#3)}<10 or {Template Docker:docker.storage.metadata.space.available.max(#3)}<0.01' # < 10% or < 10MB
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_docker_storage.asciidoc'
dependencies:
- 'Critically low docker storage metadata space on {HOST.NAME}'
priority: average
diff --git a/roles/os_zabbix/vars/template_heartbeat.yml b/roles/os_zabbix/vars/template_heartbeat.yml
index 3d0f3d51a..798377cd9 100644
--- a/roles/os_zabbix/vars/template_heartbeat.yml
+++ b/roles/os_zabbix/vars/template_heartbeat.yml
@@ -10,3 +10,4 @@ g_template_heartbeat:
- description: 'Heartbeat.ping has failed on {HOST.NAME}'
expression: '{Template Heartbeat:heartbeat.ping.nodata(20m)}=1'
priority: avg
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_node_heartbeat.asciidoc'
diff --git a/roles/os_zabbix/vars/template_openshift_master.yml b/roles/os_zabbix/vars/template_openshift_master.yml
index c4e4d1c94..d2c1365b0 100644
--- a/roles/os_zabbix/vars/template_openshift_master.yml
+++ b/roles/os_zabbix/vars/template_openshift_master.yml
@@ -9,4 +9,5 @@ g_template_openshift_master:
ztriggers:
- description: 'Application creation has failed on {HOST.NAME}'
expression: '{Template Openshift Master:create_app.last(#1)}=1 and {Template Openshift Master:create_app.last(#2)}=1'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_create_app.asciidoc'
priority: avg
diff --git a/roles/os_zabbix/vars/template_os_linux.yml b/roles/os_zabbix/vars/template_os_linux.yml
index 7bc8ddc5d..7c446cd85 100644
--- a/roles/os_zabbix/vars/template_os_linux.yml
+++ b/roles/os_zabbix/vars/template_os_linux.yml
@@ -102,6 +102,11 @@ g_template_os_linux:
- Memory
value_type: int
+ - key: mem.util.available
+ applications:
+ - Memory
+ value_type: int
+
- key: mem.util.used
applications:
- Memory
@@ -160,24 +165,30 @@ g_template_os_linux:
ztriggers:
- description: 'Filesystem: / has less than 10% free on {HOST.NAME}'
expression: '{Template OS Linux:filesys.full.xvda2.last()}>90'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc'
priority: warn
- description: 'Filesystem: / has less than 5% free on {HOST.NAME}'
expression: '{Template OS Linux:filesys.full.xvda2.last()}>95'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc'
priority: high
- description: 'Filesystem: /var has less than 10% free on {HOST.NAME}'
expression: '{Template OS Linux:filesys.full.xvda3.last()}>90'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc'
priority: warn
- description: 'Filesystem: /var has less than 5% free on {HOST.NAME}'
expression: '{Template OS Linux:filesys.full.xvda3.last()}>95'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc'
priority: high
- description: 'Too many TOTAL processes on {HOST.NAME}'
expression: '{Template OS Linux:proc.nprocs.last()}>5000'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_proc.asciidoc'
priority: warn
- description: 'Lack of available memory on {HOST.NAME}'
expression: '{Template OS Linux:mem.freemem.last()}<3000'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_memory.asciidoc'
priority: warn