diff options
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/ansible_tower/tasks/main.yaml | 3 | ||||
| -rw-r--r-- | roles/etcd/tasks/main.yml | 1 | ||||
| -rw-r--r-- | roles/etcd_ca/tasks/main.yml | 1 | ||||
| -rw-r--r-- | roles/fluentd_master/tasks/main.yml | 1 | ||||
| -rw-r--r-- | roles/lib_zabbix/library/zbx_trigger.py | 18 | ||||
| -rw-r--r-- | roles/lib_zabbix/library/zbx_triggerprototype.py | 177 | ||||
| -rw-r--r-- | roles/lib_zabbix/tasks/create_template.yml | 24 | ||||
| -rw-r--r-- | roles/openshift_examples/defaults/main.yml | 2 | ||||
| -rw-r--r-- | roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json | 4 | ||||
| -rw-r--r-- | roles/openshift_examples/tasks/main.yml | 12 | ||||
| -rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 21 | ||||
| -rw-r--r-- | roles/openshift_master/tasks/main.yml | 2 | ||||
| -rw-r--r-- | roles/openshift_master/templates/scheduler.json.j2 | 2 | ||||
| -rw-r--r-- | roles/openshift_node/tasks/main.yml | 1 | ||||
| -rw-r--r-- | roles/openshift_serviceaccounts/tasks/main.yml | 2 | ||||
| -rw-r--r-- | roles/os_zabbix/tasks/main.yml | 9 | ||||
| -rw-r--r-- | roles/os_zabbix/vars/template_ops_tools.yml | 23 | ||||
| -rw-r--r-- | roles/os_zabbix/vars/template_os_linux.yml | 52 | 
18 files changed, 326 insertions, 29 deletions
| diff --git a/roles/ansible_tower/tasks/main.yaml b/roles/ansible_tower/tasks/main.yaml index c110a3b70..b7757214d 100644 --- a/roles/ansible_tower/tasks/main.yaml +++ b/roles/ansible_tower/tasks/main.yaml @@ -9,6 +9,7 @@    - ansible    - telnet    - ack +  - pylint  - name: download Tower setup    get_url: url=http://releases.ansible.com/ansible-tower/setup/ansible-tower-setup-2.1.1.tar.gz dest=/opt/ force=no @@ -38,5 +39,3 @@      regexp: "^({{ item.option }})( *)="      line: '\1\2= {{ item.value }}'    with_items: config_changes | default([], true) -     - diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index 27bfb7de9..656901409 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -38,6 +38,7 @@    template:      src: etcd.conf.j2      dest: /etc/etcd/etcd.conf +    backup: true    notify:      - restart etcd diff --git a/roles/etcd_ca/tasks/main.yml b/roles/etcd_ca/tasks/main.yml index 8a266f732..625756867 100644 --- a/roles/etcd_ca/tasks/main.yml +++ b/roles/etcd_ca/tasks/main.yml @@ -18,6 +18,7 @@  - template:      dest: "{{ etcd_ca_dir }}/fragments/openssl_append.cnf"      src: openssl_append.j2 +    backup: true  - assemble:      src: "{{ etcd_ca_dir }}/fragments" diff --git a/roles/fluentd_master/tasks/main.yml b/roles/fluentd_master/tasks/main.yml index 69f8eceab..55cd94460 100644 --- a/roles/fluentd_master/tasks/main.yml +++ b/roles/fluentd_master/tasks/main.yml @@ -52,4 +52,3 @@      name: 'td-agent'      state: started      enabled: yes - diff --git a/roles/lib_zabbix/library/zbx_trigger.py b/roles/lib_zabbix/library/zbx_trigger.py index a05de7e68..21d0fcfd2 100644 --- a/roles/lib_zabbix/library/zbx_trigger.py +++ b/roles/lib_zabbix/library/zbx_trigger.py @@ -74,6 +74,18 @@ def get_deps(zapi, deps):      return results + +def get_trigger_status(inc_status): +    ''' Determine the trigger's status +        0 is enabled +        1 is disabled +    ''' +    r_status = 0 +    if inc_status == 'disabled': +        r_status = 1 + +    return r_status +  def main():      '''      Create a trigger in zabbix @@ -103,6 +115,7 @@ def main():              dependencies=dict(default=[], type='list'),              priority=dict(default='avg', type='str'),              url=dict(default=None, type='str'), +            status=dict(default=None, type='str'),              state=dict(default='present', type='str'),          ),          #supports_check_mode=True @@ -145,6 +158,7 @@ def main():                    'dependencies': get_deps(zapi, module.params['dependencies']),                    'priority': get_priority(module.params['priority']),                    'url': module.params['url'], +                  'status': get_trigger_status(module.params['status']),                   }          # Remove any None valued params @@ -156,6 +170,10 @@ def main():          if not exists(content):              # if we didn't find it, create it              content = zapi.get_content(zbx_class_name, 'create', params) + +            if content.has_key('error'): +                module.exit_json(failed=True, changed=True, results=content['error'], state="present") +              module.exit_json(changed=True, results=content['result'], state='present')          ######## diff --git a/roles/lib_zabbix/library/zbx_triggerprototype.py b/roles/lib_zabbix/library/zbx_triggerprototype.py new file mode 100644 index 000000000..c1224b268 --- /dev/null +++ b/roles/lib_zabbix/library/zbx_triggerprototype.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python +''' +ansible module for zabbix triggerprototypes +''' +# vim: expandtab:tabstop=4:shiftwidth=4 +# +#   Zabbix triggerprototypes ansible module +# +# +#   Copyright 2015 Red Hat Inc. +# +#   Licensed under the Apache License, Version 2.0 (the "License"); +#   you may not use this file except in compliance with the License. +#   You may obtain a copy of the License at +# +#       http://www.apache.org/licenses/LICENSE-2.0 +# +#   Unless required by applicable law or agreed to in writing, software +#   distributed under the License is distributed on an "AS IS" BASIS, +#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#   See the License for the specific language governing permissions and +#   limitations under the License. +# + +# This is in place because each module looks similar to each other. +# These need duplicate code as their behavior is very similar +# but different for each zabbix class. +# pylint: disable=duplicate-code + +# pylint: disable=import-error +from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection + +def exists(content, key='result'): +    ''' Check if key exists in content or the size of content[key] > 0 +    ''' +    if not content.has_key(key): +        return False + +    if not content[key]: +        return False + +    return True + +def get_priority(priority): +    ''' determine priority +    ''' +    prior = 0 +    if 'info' in priority: +        prior = 1 +    elif 'warn' in priority: +        prior = 2 +    elif 'avg' == priority or 'ave' in priority: +        prior = 3 +    elif 'high' in priority: +        prior = 4 +    elif 'dis' in priority: +        prior = 5 + +    return prior + +def get_trigger_status(inc_status): +    ''' Determine the trigger's status +        0 is enabled +        1 is disabled +    ''' +    r_status = 0 +    if inc_status == 'disabled': +        r_status = 1 + +    return r_status + + +def main(): +    ''' +    Create a triggerprototype in zabbix +    ''' + +    module = AnsibleModule( +        argument_spec=dict( +            zbx_server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'), +            zbx_user=dict(default=os.environ.get('ZABBIX_USER', None), type='str'), +            zbx_password=dict(default=os.environ.get('ZABBIX_PASSWORD', None), type='str'), +            zbx_debug=dict(default=False, type='bool'), +            name=dict(default=None, type='str'), +            expression=dict(default=None, type='str'), +            description=dict(default=None, type='str'), +            priority=dict(default='avg', type='str'), +            url=dict(default=None, type='str'), +            status=dict(default=None, type='str'), +            state=dict(default='present', type='str'), +        ), +        #supports_check_mode=True +    ) + +    zapi = ZabbixAPI(ZabbixConnection(module.params['zbx_server'], +                                      module.params['zbx_user'], +                                      module.params['zbx_password'], +                                      module.params['zbx_debug'])) + +    #Set the instance and the template for the rest of the calls +    zbx_class_name = 'triggerprototype' +    idname = "triggerid" +    state = module.params['state'] +    tname = module.params['name'] + +    content = zapi.get_content(zbx_class_name, +                               'get', +                               {'filter': {'description': tname}, +                                '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': tname, +                  'comments':  module.params['description'], +                  'expression':  module.params['expression'], +                  'priority': get_priority(module.params['priority']), +                  'url': module.params['url'], +                  'status': get_trigger_status(module.params['status']), +                 } + +        # 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) + +            if content.has_key('error'): +                module.exit_json(failed=True, changed=True, results=content['error'], state="present") + +            module.exit_json(changed=True, results=content['result'], state='present') + +        ######## +        # UPDATE +        ######## +        differences = {} +        zab_results = content['result'][0] +        for key, value in params.items(): + +            if zab_results[key] != value and zab_results[key] != str(value): +                differences[key] = value + +        if not differences: +            module.exit_json(changed=False, results=zab_results, state="present") + +        # We have differences and need to update +        differences[idname] = zab_results[idname] +        content = zapi.get_content(zbx_class_name, 'update', differences) +        module.exit_json(changed=True, results=content['result'], state="present") + + +    module.exit_json(failed=True, +                     changed=False, +                     results='Unknown state passed. %s' % state, +                     state="unknown") + +# pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import, locally-disabled +# import module snippets.  This are required +from ansible.module_utils.basic import * + +main() diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml index b4821bdc7..41381e76c 100644 --- a/roles/lib_zabbix/tasks/create_template.yml +++ b/roles/lib_zabbix/tasks/create_template.yml @@ -9,7 +9,8 @@  - set_fact: -    lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" +    lzbx_item_applications: "{{ template.zitems | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}" +    lzbx_itemprototype_applications: "{{ template.zitemprototypes | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}"  - name: Create Application    zbx_application: @@ -18,9 +19,11 @@      zbx_password: "{{ password }}"      name: "{{ item }}"      template_name: "{{ template.name }}" -  with_items: lzbx_applications +  with_items: +  - "{{ lzbx_item_applications }}" +  - "{{ lzbx_itemprototype_applications }}"    register: created_application -  when: template.zitems is defined +  when: template.zitems is defined or template.zitemprototypes is defined  - name: Create Items    zbx_item: @@ -66,7 +69,7 @@    with_items: template.zdiscoveryrules    when: template.zdiscoveryrules is defined -- name: Create Item Prototype +- name: Create Item Prototypes    zbx_itemprototype:      zbx_server: "{{ server }}"      zbx_user: "{{ user }}" @@ -80,3 +83,16 @@      description: "{{ item.description | default('', True) }}"    with_items: template.zitemprototypes    when: template.zitemprototypes is defined + +- name: Create Trigger Prototypes +  zbx_triggerprototype: +    zbx_server: "{{ server }}" +    zbx_user: "{{ user }}" +    zbx_password: "{{ password }}" +    name: "{{ item.name }}" +    expression: "{{ item.expression }}" +    url: "{{ item.url | default('', True) }}" +    priority: "{{ item.priority | default('average', True) }}" +    description: "{{ item.description | default('', True) }}" +  with_items: template.ztriggerprototypes +  when: template.ztriggerprototypes is defined diff --git a/roles/openshift_examples/defaults/main.yml b/roles/openshift_examples/defaults/main.yml index 3246790aa..7d4f100e3 100644 --- a/roles/openshift_examples/defaults/main.yml +++ b/roles/openshift_examples/defaults/main.yml @@ -14,3 +14,5 @@ db_templates_base: "{{ examples_base }}/db-templates"  xpaas_image_streams: "{{ examples_base }}/xpaas-streams/jboss-image-streams.json"  xpaas_templates_base: "{{ examples_base }}/xpaas-templates"  quickstarts_base: "{{ examples_base }}/quickstart-templates" + +openshift_examples_import_command: "create" diff --git a/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json b/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json index 0497e6824..5df36ccc2 100644 --- a/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json +++ b/roles/openshift_examples/files/examples/xpaas-templates/eap6-https-sti.json @@ -6,10 +6,10 @@              "iconClass" : "icon-jboss",              "description": "Application template for EAP 6 applications built using STI."          }, -        "name": "eap6-basic-sti" +        "name": "eap6-https-sti"      },      "labels": { -        "template": "eap6-basic-sti" +        "template": "eap6-https-sti"      },      "parameters": [          { diff --git a/roles/openshift_examples/tasks/main.yml b/roles/openshift_examples/tasks/main.yml index bfc6dfb0a..3a829a4c6 100644 --- a/roles/openshift_examples/tasks/main.yml +++ b/roles/openshift_examples/tasks/main.yml @@ -7,7 +7,7 @@  # RHEL and Centos image streams are mutually exclusive  - name: Import RHEL streams    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ rhel_image_streams }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ rhel_image_streams }}    when: openshift_examples_load_rhel    register: oex_import_rhel_streams    failed_when: "'already exists' not in oex_import_rhel_streams.stderr and oex_import_rhel_streams.rc != 0" @@ -15,7 +15,7 @@  - name: Import Centos Image streams    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ centos_image_streams }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ centos_image_streams }}    when: openshift_examples_load_centos | bool    register: oex_import_centos_streams    failed_when: "'already exists' not in oex_import_centos_streams.stderr and oex_import_centos_streams.rc != 0" @@ -23,7 +23,7 @@  - name: Import db templates    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ db_templates_base }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ db_templates_base }}    when: openshift_examples_load_db_templates | bool    register: oex_import_db_templates    failed_when: "'already exists' not in oex_import_db_templates.stderr and oex_import_db_templates.rc != 0" @@ -31,7 +31,7 @@  - name: Import quickstart-templates    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ quickstarts_base }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ quickstarts_base }}    when: openshift_examples_load_quickstarts    register: oex_import_quickstarts    failed_when: "'already exists' not in oex_import_quickstarts.stderr and oex_import_quickstarts.rc != 0" @@ -40,7 +40,7 @@  - name: Import xPaas image streams    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ xpaas_image_streams }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_image_streams }}    when: openshift_examples_load_xpaas | bool    register: oex_import_xpaas_streams    failed_when: "'already exists' not in oex_import_xpaas_streams.stderr and oex_import_xpaas_streams.rc != 0" @@ -48,7 +48,7 @@  - name: Import xPaas templates    command: > -    {{ openshift.common.client_binary }} create -n openshift -f {{ xpaas_templates_base }} +    {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_templates_base }}    when: openshift_examples_load_xpaas | bool    register: oex_import_xpaas_templates    failed_when: "'already exists' not in oex_import_xpaas_templates.stderr and oex_import_xpaas_templates.rc != 0" diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 991b8da66..987f7f7da 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -296,9 +296,8 @@ def set_fluentd_facts_if_unset(facts):      """      if 'common' in facts: -        deployment_type = facts['common']['deployment_type']          if 'use_fluentd' not in facts['common']: -            use_fluentd = True if deployment_type == 'online' else False +            use_fluentd = False              facts['common']['use_fluentd'] = use_fluentd      return facts @@ -475,6 +474,7 @@ def set_deployment_facts_if_unset(facts):              if deployment_type in ['enterprise', 'online']:                  data_dir = '/var/lib/openshift'              facts['common']['data_dir'] = data_dir +        facts['common']['version'] = get_openshift_version()      for role in ('master', 'node'):          if role in facts: @@ -599,6 +599,21 @@ def get_current_config(facts):      return current_config +def get_openshift_version(): +    """ Get current version of openshift on the host + +        Returns: +            version: the current openshift version +    """ +    version = '' + +    if os.path.isfile('/usr/bin/openshift'): +        _, output, _ = module.run_command(['/usr/bin/openshift', 'version']) +        versions = dict(e.split(' v') for e in output.splitlines()) +        version = versions.get('openshift', '') + +        #TODO: acknowledge the possility of a containerized install +    return version  def apply_provider_facts(facts, provider_facts):      """ Apply provider facts to supplied facts dict @@ -644,7 +659,7 @@ def merge_facts(orig, new):      facts = dict()      for key, value in orig.iteritems():          if key in new: -            if isinstance(value, dict): +            if isinstance(value, dict) and isinstance(new[key], dict):                  facts[key] = merge_facts(value, new[key])              else:                  facts[key] = copy.copy(new[key]) diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index b57711b58..fa12005ab 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -100,6 +100,7 @@    template:      dest: "{{ openshift_master_scheduler_conf }}"      src: scheduler.json.j2 +    backup: true    notify:    - restart master @@ -129,6 +130,7 @@    template:      dest: "{{ openshift_master_config_file }}"      src: master.yaml.v1.j2 +    backup: true    notify:    - restart master diff --git a/roles/openshift_master/templates/scheduler.json.j2 b/roles/openshift_master/templates/scheduler.json.j2 index 835f2383e..cb5f43bb2 100644 --- a/roles/openshift_master/templates/scheduler.json.j2 +++ b/roles/openshift_master/templates/scheduler.json.j2 @@ -1,4 +1,6 @@  { +  "kind": "Policy", +  "apiVersion": "v1",    "predicates": [      {"name": "MatchNodeSelector"},      {"name": "PodFitsResources"}, diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 1986b631e..e8cc499c0 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -47,6 +47,7 @@    template:      dest: "{{ openshift_node_config_file }}"      src: node.yaml.v1.j2 +    backup: true    notify:    - restart node diff --git a/roles/openshift_serviceaccounts/tasks/main.yml b/roles/openshift_serviceaccounts/tasks/main.yml index 9665d0a72..d93a25a21 100644 --- a/roles/openshift_serviceaccounts/tasks/main.yml +++ b/roles/openshift_serviceaccounts/tasks/main.yml @@ -23,4 +23,4 @@    with_items: accounts  - name: Apply new scc rules for service accounts -  command: "{{ openshift.common.client_binary }} replace -f /tmp/scc.yaml" +  command: "{{ openshift.common.client_binary }} update -f /tmp/scc.yaml" diff --git a/roles/os_zabbix/tasks/main.yml b/roles/os_zabbix/tasks/main.yml index 8347e9a61..28e900255 100644 --- a/roles/os_zabbix/tasks/main.yml +++ b/roles/os_zabbix/tasks/main.yml @@ -12,6 +12,7 @@  - include_vars: template_docker.yml  - include_vars: template_openshift_master.yml  - include_vars: template_openshift_node.yml +- include_vars: template_ops_tools.yml  - name: Include Template Heartbeat    include: ../../lib_zabbix/tasks/create_template.yml @@ -52,3 +53,11 @@      server: "{{ ozb_server }}"      user: "{{ ozb_user }}"      password: "{{ ozb_password }}" + +- name: Include Template Ops Tools +  include: ../../lib_zabbix/tasks/create_template.yml +  vars: +    template: "{{ g_template_ops_tools }}" +    server: "{{ ozb_server }}" +    user: "{{ ozb_user }}" +    password: "{{ ozb_password }}" diff --git a/roles/os_zabbix/vars/template_ops_tools.yml b/roles/os_zabbix/vars/template_ops_tools.yml new file mode 100644 index 000000000..d1b8a2514 --- /dev/null +++ b/roles/os_zabbix/vars/template_ops_tools.yml @@ -0,0 +1,23 @@ +--- +g_template_ops_tools: +  name: Template Operations Tools +  zdiscoveryrules: +  - name: disc.ops.runner +    key: disc.ops.runner +    lifetime: 1 +    description: "Dynamically register operations runner items" + +  zitemprototypes: +  - discoveryrule_key: disc.ops.runner +    name: "Exit code of ops-runner[{#OSO_COMMAND}]" +    key: "disc.ops.runner.command.exitcode[{#OSO_COMMAND}]" +    value_type: int +    description: "The exit code of the command run from ops-runner" +    applications: +    - Ops Runner + +  ztriggerprototypes: +  - name: 'ops-runner[{#OSO_COMMAND}]: non-zero exit code on {HOST.NAME}' +    expression: '{Template Operations Tools:disc.ops.runner.command.exitcode[{#OSO_COMMAND}].last()}<>0' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_ops_runner_command.asciidoc' +    priority: average diff --git a/roles/os_zabbix/vars/template_os_linux.yml b/roles/os_zabbix/vars/template_os_linux.yml index 84a7740b0..70c3809bd 100644 --- a/roles/os_zabbix/vars/template_os_linux.yml +++ b/roles/os_zabbix/vars/template_os_linux.yml @@ -10,17 +10,20 @@ g_template_os_linux:    - key: kernel.all.cpu.wait.total      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.cpu.irq.hard      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.cpu.idle      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.uname.distro      applications: @@ -35,7 +38,8 @@ g_template_os_linux:    - key: kernel.all.cpu.irq.soft      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.load.15_minute      applications: @@ -45,7 +49,8 @@ g_template_os_linux:    - key: kernel.all.cpu.sys      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.load.5_minute      applications: @@ -55,7 +60,8 @@ g_template_os_linux:    - key: kernel.all.cpu.nice      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.load.1_minute      applications: @@ -75,7 +81,8 @@ g_template_os_linux:    - key: kernel.all.cpu.user      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.uname.machine      applications: @@ -90,7 +97,8 @@ g_template_os_linux:    - key: kernel.all.cpu.steal      applications:      - Kernel -    value_type: int +    value_type: float +    units: '%'    - key: kernel.all.pswitch      applications: @@ -196,12 +204,10 @@ g_template_os_linux:    - name: disc.filesys      key: disc.filesys      lifetime: 1 -    template_name: Template OS Linux      description: "Dynamically register the filesystems"    zitemprototypes:    - discoveryrule_key: disc.filesys -    template_name: Template OS Linux      name: "disc.filesys.full.{#OSO_FILESYS}"      key: "disc.filesys.full[{#OSO_FILESYS}]"      value_type: float @@ -209,6 +215,17 @@ g_template_os_linux:      applications:      - Disk +  ztriggerprototypes: +  - name: 'Filesystem: {#OSO_FILESYS} has less than 10% free on {HOST.NAME}' +    expression: '{Template OS Linux:disc.filesys.full[{#OSO_FILESYS}].last()}>90' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' +    priority: warn + +  - name: 'Filesystem: {#OSO_FILESYS} has less than 5% free on {HOST.NAME}' +    expression: '{Template OS Linux:disc.filesys.full[{#OSO_FILESYS}].last()}>95' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_filesys_full.asciidoc' +    priority: high +    ztriggers:    - name: 'Filesystem: / has less than 10% free on {HOST.NAME}'      expression: '{Template OS Linux:filesys.full.xvda2.last()}>90' @@ -240,3 +257,18 @@ g_template_os_linux:      url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_memory.asciidoc'      priority: warn      description: 'Alert on less than 30MegaBytes.  This is 30 Million Bytes.  30000 KB x 1024' + +    #  CPU Utilization # +  - name: 'CPU idle less than 5% on {HOST.NAME}' +    expression: '{Template OS Linux:kernel.all.cpu.idle.last()}<5 and {Template OS Linux:kernel.all.cpu.idle.last(#2)}<5' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_cpu_idle.asciidoc' +    priority: high +    description: 'CPU is less than 5% idle' + +  - name: 'CPU idle less than 10% on {HOST.NAME}' +    expression: '{Template OS Linux:kernel.all.cpu.idle.last()}<10 and {Template OS Linux:kernel.all.cpu.idle.last(#2)}<10' +    url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_cpu_idle.asciidoc' +    priority: warn +    description: 'CPU is less than 10% idle' +    dependencies: +    - 'CPU idle less than 5% on {HOST.NAME}' | 
