{"id":14984574,"url":"https://github.com/moira-alert/moira-trigger-role","last_synced_at":"2025-04-10T21:20:51.579Z","repository":{"id":54657745,"uuid":"109522380","full_name":"moira-alert/moira-trigger-role","owner":"moira-alert","description":"Ansible role to create, update and delete Moira triggers","archived":false,"fork":false,"pushed_at":"2025-01-15T11:10:54.000Z","size":80,"stargazers_count":10,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T18:49:37.572Z","etag":null,"topics":["alerting","ansible","ansible-modules","ansible-roles","graphite","moira","monitoring"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moira-alert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-04T19:04:03.000Z","updated_at":"2025-01-15T11:10:56.000Z","dependencies_parsed_at":"2025-01-15T12:29:21.135Z","dependency_job_id":"cb53fd09-3725-4777-a548-c3458a56d6a0","html_url":"https://github.com/moira-alert/moira-trigger-role","commit_stats":{"total_commits":41,"total_committers":10,"mean_commits":4.1,"dds":"0.36585365853658536","last_synced_commit":"5ee145f3751c03f01aba8b73cd9144687789c154"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moira-alert%2Fmoira-trigger-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moira-alert%2Fmoira-trigger-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moira-alert%2Fmoira-trigger-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moira-alert%2Fmoira-trigger-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moira-alert","download_url":"https://codeload.github.com/moira-alert/moira-trigger-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298892,"owners_count":21080426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alerting","ansible","ansible-modules","ansible-roles","graphite","moira","monitoring"],"created_at":"2024-09-24T14:09:17.320Z","updated_at":"2025-04-10T21:20:51.558Z","avatar_url":"https://github.com/moira-alert.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# moira-trigger-role\n\nIf you're new here, better check out our main [README](https://github.com/moira-alert/moira/blob/master/README.md).\n\nAnsible role to create, update and delete Moira triggers based on\n[python-moira-client](https://github.com/moira-alert/python-moira-client)\n\n## Role usage\n\n[Installation](#installation)\n-   [Ansible Galaxy](#ansible-galaxy)\n-   [Ansible Role with Makefile](#ansible-role)\n\n[Configuration](#configuration)\n-   [Authentication](#authentication)\n-   [Trigger state](#trigger-state)\n\n[Role tasks](#role-tasks)\n-   [Manage dependencies](#manage-dependencies)\n-   [Manage triggers](#manage-triggers)\n\n## \u003ca name=\"installation\"\u003e\u003c/a\u003e Installation\n\n### \u003ca name=\"ansible-galaxy\"\u003e\u003c/a\u003e Ansible Galaxy\n\n```\nansible-galaxy install moira-alert.moira-trigger-role\n```\n\n### \u003ca name=\"ansible-role\"\u003e\u003c/a\u003e Ansible Role with Makefile\n\nPlace the contents from [example](https://github.com/moira-alert/moira-trigger-role/blob/master/tests/Makefile) inside your Makefile to download role from Ansible Galaxy \u003cbr\u003e\nand create playbook to manage triggers with predefined parameters inside your vars files:\n\n```\n- name: manage moira triggers\n  hosts: serviceName\n  roles:\n    - role: moira-alert.moira-trigger-role\n      moira_api: http://localhost:8081/api\n      moira_triggers: '{{ ServiceNameTriggers }}'\n      delegate_to: 127.0.0.1\n      run_once: True\n      dry_run: False\n```\n\n\u003e **Note:** All tasks must be done from your ansible control machine\n\n## \u003ca name=\"configuration\"\u003e\u003c/a\u003e Configuration\n\nPredefine following parameters inside your vars files. Working examples can be found [here](https://github.com/moira-alert/moira-trigger-role/tree/master/tests/group_vars)\n\n### \u003ca name=\"authentication\"\u003e\u003c/a\u003e Authentication\n\n| Parameter         | Description                  | Type       | Required | Default | Example                 |\n|-------------------|------------------------------|------------|----------|---------|-------------------------|\n| moira_api         | Url of Moira API             | String     | True     | N/A     | \u003chttp://localhost/api/\u003e |\n| moira_auth_custom | Custom authorization headers | Dictionary | False    | None    | Authorization: apiKey   |\n| moira_auth_user   | Auth User (Basic Auth)       | String     | False    | None    | admin                   |\n| moira_auth_pass   | Auth Password (Basic Auth)   | String     | False    | None    | pass                    |\n| moira_auth_login  | Auth Login (Basic Auth)      | String     | False    | None    | admin                   |\n\n\u003e **Note:** Use moira_auth_custom if you're using additional authentication mechanisms instead of \u003cbr\u003e\n\u003e single basic auth, use moira_auth_user, moira_auth_pass and moira_auth_login otherwise. \u003cbr\u003e\n\u003e moira_auth_login must contain value for X-Webauth-User header.\n\n### \u003ca name=\"trigger-state\"\u003e\u003c/a\u003e Trigger state\n\n| Parameter        | Description                                                                                                                                      | Type       | Required | Choices                                                     | Default                                    | Example                                  |\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|------------|----------|-------------------------------------------------------------|--------------------------------------------|------------------------------------------|\n| state            | Desired state of a trigger                                                                                                                       | String     | True     | present \u003cbr\u003e absent                                         | N/A                                        | present                                  |\n| id               | Trigger id                                                                                                                                       | String     | True     | N/A                                                         | N/A                                        | trigger_1                                |\n| name             | Trigger name                                                                                                                                     | String     | True     | N/A                                                         | N/A                                        | Trigger 1                                |\n| tags             | List of trigger tags                                                                                                                             | List       | True     | N/A                                                         | N/A                                        | - Project \u003cbr\u003e - Service                 |\n| targets          | List of trigger targets \u003cbr\u003e [See available graphite functions](https://github.com/go-graphite/carbonapi/blob/master/COMPATIBILITY.md#functions) | List       | True     | N/A                                                         | N/A                                        | - prefix.*.postfix                       |\n| warn_value       | Value to set WARN status                                                                                                                         | Float      | False    | N/A                                                         | None                                       | 300                                      |\n| error_value      | Value to set ERROR status                                                                                                                        | Float      | False    | N/A                                                         | None                                       | 600                                      |\n| trigger_type     | Type of a trigger                                                                                                                                | String     | False    | rising \u003cbr\u003e falling \u003cbr\u003e expression                         | N/A                                        | rising                                   |\n| expression       | [C-like expression](https://github.com/Knetic/govaluate)                                                                                         | String     | False    | N/A                                                         | Empty string                               | t1 \u003e= 10 ? ERROR : (t1 \u003e= 1 ? WARN : OK) |\n| ttl              | When there are no metrics for trigger, Moira will switch metric to TTLState state after TTL seconds                                              | Int        | False    | N/A                                                         | 600                                        | 600                                      |\n| ttl_state        | Trigger state at the expiration of 'ttl'                                                                                                         | String     | False    | NODATA \u003cbr\u003e DEL \u003cbr\u003e ERROR \u003cbr\u003e WARN \u003cbr\u003e OK                | NODATA                                     | WARN                                     |\n| is_remote        | Use remote storage. **Deprecated, use `trigger_source` instead**                                                                                 | Bool       | False    | True \u003cbr\u003e False                                             | False                                      | False                                    |\n| trigger_source   | Specify trigger source, overrides is_remote                                                                                                      | String     | False    | graphite_local \u003cbr\u003e  graphite_remote \u003cbr\u003e prometheus_remote | None                                       | graphite_local                           |\n| cluster_id       | Specify cluster id                                                                                                                               | String     | False    | N/A                                                         | None                                       | default                                  |\n| desc             | Trigger description                                                                                                                              | String     | False    | N/A                                                         | Empty string                               | trigger test description                 |\n| mute_new_metrics | If true, first event NODATA → OK will be omitted                                                                                                 | Bool       | False    | True \u003cbr\u003e False                                             | False                                      | False                                    |\n| disabled_days    | Days for trigger to be in silent mode                                                                                                            | List       | False    | N/A                                                         | Empty list                                 | - Mon \u003cbr\u003e - Wed                         |\n| timezone_offset  | Timezone offset (minutes)                                                                                                                        | Int        | False    | N/A                                                         | 0                                          | -180                                     |\n| start_hour       | Start hour to send alerts                                                                                                                        | Int        | False    | N/A                                                         | 0                                          | 9                                        |\n| start_minute     | Start minute to send alerts                                                                                                                      | Int        | False    | N/A                                                         | 0                                          | 0                                        |\n| end_hour         | End hour to send alerts                                                                                                                          | Int        | False    | N/A                                                         | 23                                         | 17                                       |\n| end_minute       | End minute to send alerts                                                                                                                        | Int        | False    | N/A                                                         | 59                                         | 0                                        |\n| alone_metrics    | Set some target as single metric                                                                                                                 | Dictionary | False    | N/A                                                         | t1: false\u003cbr\u003e t2: true\u003cbr\u003e...\u003cbr\u003e tN: true | t1: false\u003cbr\u003e t2: false                  |\n\n## \u003ca name=\"role-tasks\"\u003e\u003c/a\u003e Role tasks\n\n### \u003ca name=\"manage-dependencies\"\u003e\u003c/a\u003e Manage dependencies\n\nTask to check [python-moira-client](https://github.com/moira-alert/python-moira-client) is  installed (via pip)\n\n### \u003ca name=\"manage-triggers\"\u003e\u003c/a\u003e Manage triggers\n\nUse state 'present' to create and edit existing triggers:\n\n```\n - name: create trigger\n   moira_trigger:\n      ...\n      state: present\n      ...  \n```\n\nTo delete existing triggers use state 'absent':\n\n```\n - name: remove trigger\n   moira_trigger:\n      ...\n      state: absent\n      ...  \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoira-alert%2Fmoira-trigger-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoira-alert%2Fmoira-trigger-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoira-alert%2Fmoira-trigger-role/lists"}