GithubHelp home page GithubHelp logo

frsauvage / moira-trigger-role Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moira-alert/moira-trigger-role

0.0 1.0 0.0 53 KB

Ansible role to create, update and delete Moira triggers

License: MIT License

Python 97.21% Makefile 2.79%

moira-trigger-role's Introduction

Build Status

moira-trigger-role

If you're new here, better check out our main README.

Ansible role to create, update and delete Moira triggers based on python-moira-client

Role usage

Installation

Configuration

Role tasks

Installation

Ansible Galaxy

ansible-galaxy install moira-alert.moira-trigger-role

Ansible Role with Makefile

Place the contents from example inside your Makefile to download role from Ansible Galaxy
and create playbook to manage triggers with predefined parameters inside your vars files:

- name: manage moira triggers
  hosts: serviceName
  roles:
    - role: moira-alert.moira-trigger-role
      moira_api: http://localhost:8081/api
      moira_triggers: '{{ ServiceNameTriggers }}'
      delegate_to: 127.0.0.1
      run_once: True
      dry_run: False

Note: All tasks must be done from your ansible control machine

Configuration

Predefine following parameters inside your vars files. Working examples can be found here

Authentication

Parameter Description Type Required Default Example
moira_api Url of Moira API String True N/A http://localhost/api/
moira_auth_custom Custom authorization headers Dictionary False None Authorization: apiKey
moira_auth_user Auth User (Basic Auth) String False None admin
moira_auth_pass Auth Password (Basic Auth) String False None pass
moira_auth_login Auth Login (Basic Auth) String False None admin

Note: Use moira_auth_custom if you're using additional authentication mechanisms instead of
single basic auth, use moira_auth_user, moira_auth_pass and moira_auth_login otherwise.
moira_auth_login must contain value for X-Webauth-User header.

Trigger state

Parameter Description Type Required Choices Default Example
state Desired state of a trigger String True present
absent
N/A present
id Trigger id String True N/A N/A trigger_1
name Trigger name String True N/A N/A Trigger 1
tags List of trigger tags List True N/A N/A - Project
- Service
targets List of trigger targets
See available graphite functions
List True N/A N/A - prefix.*.postfix
warn_value Value to set WARN status Float False N/A None 300
error_value Value to set ERROR status Float False N/A None 600
trigger_type Type of a trigger String False rising
falling
expression
N/A rising
expression C-like expression String False N/A Empty string t1 >= 10 ? ERROR : (t1 >= 1 ? WARN : OK)
ttl Time to Live (in seconds) Int False N/A 600 600
ttl_state Trigger state at the expiration of 'ttl' String False NODATA
DEL
ERROR
WARN
OK
NODATA WARN
is_remote Use remote storage Bool False True
False
False False
desc Trigger description String False N/A Empty string trigger test description
mute_new_metrics Mute new metrics Bool False True
False
False False
disabled_days Days for trigger to be in silent mode List False N/A Empty list - Mon
- Wed
timezone_offset Timezone offset (minutes) Int False N/A 0 -180
start_hour Start hour to send alerts Int False N/A 0 9
start_minute Start minute to send alerts Int False N/A 0 0
end_hour End hour to send alerts Int False N/A 23 17
end_minute End minute to send alerts Int False N/A 59 0

Role tasks

Manage dependencies

Task to check python-moira-client is installed (via pip)

Manage triggers

Use state 'present' to create and edit existing triggers:

 - name: create trigger
   moira_trigger:
      ...
      state: present
      ...  

To delete existing triggers use state 'absent':

 - name: remove trigger
   moira_trigger:
      ...
      state: absent
      ...  

moira-trigger-role's People

Contributors

kamaev avatar beevee avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.