{"id":14970627,"url":"https://github.com/abicky/rollbar-notification-rules-generator","last_synced_at":"2025-08-14T00:20:44.092Z","repository":{"id":64794504,"uuid":"577533184","full_name":"abicky/rollbar-notification-rules-generator","owner":"abicky","description":"A CLI tool that generates Rollbar notification rules that are mutually exclusive from a simple YAML file","archived":false,"fork":false,"pushed_at":"2022-12-26T19:14:13.000Z","size":93,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-09T22:58:53.042Z","etag":null,"topics":["rollbar","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/abicky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-13T00:18:00.000Z","updated_at":"2024-10-16T12:55:51.000Z","dependencies_parsed_at":"2023-01-31T01:00:54.786Z","dependency_job_id":null,"html_url":"https://github.com/abicky/rollbar-notification-rules-generator","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Frollbar-notification-rules-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Frollbar-notification-rules-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Frollbar-notification-rules-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Frollbar-notification-rules-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abicky","download_url":"https://codeload.github.com/abicky/rollbar-notification-rules-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232346184,"owners_count":18509047,"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":["rollbar","terraform"],"created_at":"2024-09-24T13:43:52.757Z","updated_at":"2025-01-03T14:24:05.230Z","avatar_url":"https://github.com/abicky.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollbar-notification-rules-generator\n\n`rollbar-notification-rules-generator` is a CLI tool that generates Rollbar notification rules\nthat are mutually exclusive from a simple YAML file.\nIf you outputs the rules in the Terraform language, you can create the rules with Terraform.\n\nFor example, assume that you want to notify errors whose title contains the substring \"foo\"\nto the Slack channel \"alert-foo\" every time they occur and other errors to the default channel.\nYou can write the Rollbar notification rules in the Terraform language as follows:\n\n```terraform\nresource \"rollbar_notification\" \"slack_occurrence_0\" {\n  channel = \"slack\"\n\n  rule {\n    trigger = \"occurrence\"\n    filters {\n      type      = \"level\"\n      operation = \"gte\"\n      value     = \"error\"\n    }\n    filters {\n      type      = \"title\"\n      operation = \"within\"\n      value     = \"foo\"\n    }\n  }\n  config {\n    channel = \"alert-foo\"\n  }\n}\n\nresource \"rollbar_notification\" \"slack_occurrence_1\" {\n  channel = \"slack\"\n\n  rule {\n    trigger = \"occurrence\"\n    filters {\n      type      = \"level\"\n      operation = \"gte\"\n      value     = \"error\"\n    }\n    filters {\n      type      = \"title\"\n      operation = \"nwithin\"\n      value     = \"foo\"\n    }\n  }\n}\n```\n\nAs you can see, you have to add the filter whose operation is \"nwithin\" to the second rule.\nIf there are more rules, you have to write complicated rules to make them mutually exclusive\nand struggle to maintain them.\nWith this tool, you can write the rules in YAML format as follows:\n\n```yaml\nchannel: \"slack\"\ntriggers:\n  occurrence:\n    - conditions:\n        - type: \"level\"\n          operation: \"gte\"\n          value: \"error\"\n        - type: \"title\"\n          operation: \"within\"\n          value: \"foo\"\n      configs:\n        - channel: \"alert-foo\"\n    - conditions:\n        - type: \"level\"\n          operation: \"gte\"\n          value: \"error\"\n```\n\nYou don't have to add another condition to the second rule because the tool generates rules\nto make Rollbar behave as if it tries to find the first rule from the top down that matches\nall the conditions.\n\n## Installation\n\n    $ gem install rollbar-notification-rules-generator\n\n## Usage\n\n```\nUsage: rollbar-notification-rules-generator [options] \u003cinput\u003e\n        --format FORMAT              terraform|text (default: terraform)\n```\n\nThe input file is in YAML format like the following:\n\n```yaml\nchannel: \"slack\" # slack or pagerduty\n# This optional value is used as the namespace of Terraform resources.\nterraform_provider: foo_\n# This optional value is used as provider meta-argument of Terraform.\nterraform_provider: rollbar.alias_value\n# You can define variables, and they are expanded with the syntax \"${{ var.variable_name }}\".\nvariables:\n  slack_channel_for_foo: \"alert-foo\"\ntriggers:\n  # You can specify the following triggers:\n  #   * new_item\n  #   * deploy\n  #   * reactivated_item\n  #   * reopened_item\n  #   * occurrence_rate\n  #   * exp_repeat_item\n  #   * resolved_item\n  #   * occurrence\n  occurrence:\n    # Each element corresponds to a Rollbar notification rule.\n    # For more details, the following documents help:\n    #  * https://docs.rollbar.com/reference/post_api-1-notifications-slack-rules\n    #  * https://docs.rollbar.com/reference/post_api-1-notifications-pagerduty\n    #  * https://registry.terraform.io/providers/rollbar/rollbar/latest/docs/resources/notification\n    # Note that the tool hasn't supported some types yet.\n    - conditions:\n        - type: \"level\"\n          operation: \"gte\"\n          value: \"error\"\n        - type: \"title\"\n          operation: \"within\"\n          value: \"foo\"\n      # Each element corresponds to \"config.\"\n      # If you specify multiple elements, as many rules as the elements are created,\n      # and Rollbar notifies items according to each configuration.\n      configs:\n        - channel: ${{ var.slack_channel_for_foo }}\n    - conditions:\n        - type: \"level\"\n          operation: \"gte\"\n          value: \"error\"\n```\n\nThe text format makes it easier to read the generated rules as follows:\n\n```\n# Slack\n## Every Occurrence\n### Rule 0\nconditions:\n  level \u003e= error\n  title contains substring \"foo\"\n\nconfig:\n    channel = \"alert-foo\"\n\n### Rule 1\nconditions:\n  level \u003e= error\n  title does not contain substring \"foo\"\n```\n\n## Examples\n\nSee the YAML files in [spec/files/yaml](spec/files/yaml). Their output files are in [spec/files/tf](spec/files/tf) and [spec/files/txt](spec/files/txt).\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `exe/rollbar-notification-rules-generator`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/abicky/rollbar-notification-rules-generator.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabicky%2Frollbar-notification-rules-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabicky%2Frollbar-notification-rules-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabicky%2Frollbar-notification-rules-generator/lists"}