{"id":13833448,"url":"https://github.com/FairwindsOps/astro","last_synced_at":"2025-07-09T23:30:48.109Z","repository":{"id":38359136,"uuid":"178909114","full_name":"FairwindsOps/astro","owner":"FairwindsOps","description":"[alpha] Emit Datadog monitors based on Kubernetes state.","archived":false,"fork":false,"pushed_at":"2024-06-23T01:54:48.000Z","size":30697,"stargazers_count":86,"open_issues_count":6,"forks_count":7,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-06-28T17:22:28.632Z","etag":null,"topics":["datadog","fairwinds-incubator","kubernetes","monitoring"],"latest_commit_sha":null,"homepage":"https://fairwinds.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FairwindsOps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-01T17:03:17.000Z","updated_at":"2024-05-31T08:24:55.000Z","dependencies_parsed_at":"2024-03-09T03:33:35.212Z","dependency_job_id":"6b25479b-4668-49fe-9e6b-9422be250a91","html_url":"https://github.com/FairwindsOps/astro","commit_stats":{"total_commits":232,"total_committers":16,"mean_commits":14.5,"dds":0.5948275862068966,"last_synced_commit":"d7ff928845f8dd236012886e89b128602788aa30"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FairwindsOps%2Fastro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FairwindsOps%2Fastro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FairwindsOps%2Fastro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FairwindsOps%2Fastro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FairwindsOps","download_url":"https://codeload.github.com/FairwindsOps/astro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213913605,"owners_count":15656454,"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":["datadog","fairwinds-incubator","kubernetes","monitoring"],"created_at":"2024-08-04T12:00:39.479Z","updated_at":"2024-08-04T12:01:02.596Z","avatar_url":"https://github.com/FairwindsOps.png","language":"Go","funding_links":[],"categories":["Monitors"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/img/logo.svg\" height=\"120\" alt=\"Astro\" /\u003e\n  \u003cbr\u003e\u003cbr\u003e\n\n  [![CircleCI](https://circleci.com/gh/FairwindsOps/astro.svg?style=svg\u0026circle-token=77f1eb3b95b59a0372b19fdefbbd28ebfaa9d0c0)](https://circleci.com/gh/FairwindsOps/astro)\n  [![codecov](https://codecov.io/gh/fairwindsops/astro/branch/master/graph/badge.svg?token=6zutKJd2Gy)](https://codecov.io/gh/fairwindsops/astro)\n  [![Apache 2.0 license](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)\n  [![Go Report Card](https://goreportcard.com/badge/github.com/FairwindsOps/astro)](https://goreportcard.com/report/github.com/FairwindsOps/astro)\n\u003c/div\u003e\n\n\nAstro is designed to simplify Datadog monitor administration.  This is an operator that emits Datadog monitors based on Kubernetes state.  The operator responds to changes of resources in your kubernetes cluster and will manage Datadog monitors based on the configured state.\n\n## Installing\nThe [Astro helm chart](https://github.com/FairwindsOps/charts/tree/master/stable/astro) is the preferred way to install Astro into your cluster.\n\n## Configuration\nA combination of environment variables and a yaml file is used to configure the application.  An example configuration file is available [here](conf.yml).\n\n### Environment Variables\n| Variable    | Descritpion                        | Required  | Default     |\n|:------------|:----------------------------------:|:----------|:------------|\n| `DD_API_KEY` | The api key for your Datadog account. | `Y` ||\n| `DD_APP_KEY` | The app key for your Datadog account. | `Y` ||\n| `OWNER`      | A unique name to designate as the owner of the generated monitors.  A tag with the owner's value will be applied to managed monitors. If deploying astro on multiple clusters, it is required to provide different `owner` values to segregate monitor management. | `N`| `astro` |\n| `DEFINITIONS_PATH` | The path to monitor definition configurations.  This can be a local path or a URL.  Multiple paths should be separated by a `;` | `N` | `conf.yml` |\n| `DRY_RUN` | when set to true monitors will not be managed in Datadog. | `N` | `false` |\n\n### Configuration File\nA configuration file is used to define your monitors.  These are organized as rulesets, which consist of the type of resource the ruleset applies to, annotations that must be present on the resource to be considered valid objects, and a set of monitors to manage for that resource.  Go templating syntax may be used in your monitors and values will be inserted from each Kubernetes object that matches the ruleset.  There is also a section called `cluster_variables` that you can use to define your own variables.  These variables can be inserted into the monitor templates.\n\n```yaml\n---\ncluster_variables:\n  var1: test\n  var2: test2\nrulesets:\n- type: deployment\n  match_annotations:\n  - name: astro/owner\n    value: astro\n  monitors:\n    dep-replica-alert:\n      name: \"Deployment Replica Alert - {{ .ObjectMeta.Name }}\"\n      type: metric alert\n      query: \"max(last_10m):max:kubernetes_state.deployment.replicas_available{kubernetescluster:foobar,deployment:{{ .ObjectMeta.Name }}} \u003c= 0\"\n      message: |-\n        {{ \"{{#is_alert}}\" }}\n        Available replicas is currently 0 for {{ .ObjectMeta.Name }}\n        {{ \"{{/is_alert}}\" }}\n        {{ \"{{^is_alert}}\" }}\n        Available replicas is no longer 0 for {{ .ObjectMeta.Name }}\n        {{ \"{{/is_alert}}\" }}\n      tags: []\n      options:\n        no_data_timeframe: 60\n        notify_audit: false\n        notify_no_data: false\n        renotify_interval: 5\n        new_host_delay: 5\n        evaluation_delay: 300\n        timeout_h: 1\n        escalation_message: \"\"\n        thresholds:\n          critical: 2\n          warning: 1\n          unknown: -1\n          ok: 0\n          critical_recovery: 0\n          warning_recovery: 0\n        include_tags: true\n        require_full_window: true\n        locked: false\n```\n\n* `cluster_variables`: (dict).  A collection of variables that can be used in monitors.  They can be used in monitors by prepending with `ClusterVariables`, eg `{{ ClusterVariables.var1 }}`.\n* `rulesets`: (List).  A collection of rulesets.  A ruleset consists of a Kubernetes resource type, annotations the resource must have to be considered valid, and a collection of monitors to manage for the resource.\n  * `type`: (String). The type of resource to match if matching with annotations. Can also be `static` or `binding`. Currently supports `deployment`, `namespace`, `binding`, and `static` as values.\n  * `match_annotations`: (List).  A collection of name/value pairs pairs of annotations that must be present on the resource to manage it.\n  * `bound_objects`: (List).  A collection of object types that are bound to this object.  For instance, if you have a ruleset for a namespace, you can bind other objects like deployments, services, etc. Then, when the bound objects in the namespace get updated, those rulesets apply to it.\n  * `monitors`: (Map).  A collection of monitors to manage for any resource that matches the rules defined.\n    * Monitor Identifier (map key: unique and arbitrary, it should only include alpha characters and -)\n      * `name`: Name of the Datadog monitor.\n      * `type`: The type of the monitor, chosen from:\n        - `metric alert`\n        - `service check`\n        - `event alert`\n        - `query alert`\n        - `composite`\n        - `log alert`\n      * `query`: The monitor query to notify on.\n      * `message`: A message included with in monitor notifications.\n      * `tags`: A list of tags to add to your monitor.\n      * `options`: A dict of options, consisting of the following:\n        * `no_data_timeframe`: Number of minutes before a monitor will notify if data stops reporting.\n        * `notify_audit`: boolean that indicates whether tagged users are notified if the monitor changes.\n        * `notify_no_data`: boolean that indicates if the monitor notifies if data stops reporting.\n        * `renotify_interval`: Number of minutes after the last notification a monitor will re-notify.\n        * `new_host_delay`: Number of seconds to wait for a new host before evaluating the monitor status.\n        * `evaluation_delay`: Number of seconds to delay evaluation.\n        * `timeout_h`: Number of hours the before the monitor will automatically resolve if it's not reporting data.\n        * `escalation_message`: Message to include with re-notifications.\n        * `thresholds`: Map of thresholds for the alert.  Valid options are:\n          - `ok`\n          - `critical`\n          - `warning`\n          - `unknown`\n          - `critical_recovery`\n          - `warning_recovery`\n        * `include_tags`: When true, notifications from this monitor automatically insert triggering tags into the title.\n        * `require_full_window`: boolean indicating if a monitor needs a full window of data to be evaluated.\n        * `locked`: boolean indicating if changes are only allowed from the creator or admins.\n#### Static monitors\nA static monitor is one that does not depend on the presence of a resource in the kubernetes cluster. An example of a \nstatic monitor would be `Host CPU Usage`. There are a variety of example static monitors in the [static_conf.yml example](./static_conf.yml)\n\n#### A Note on Templating\nSince Datadog uses a very similar templating language to go templating, to pass a template variable to Datadog it must be \"escaped\" by inserting it as a template literal:\n\n```\n{{ \"{{/is_alert}}\" }}\n```\n\nThe above note is not applicable for static monitors and if extra brackets are present, creation of the static monitors will fail.\n\n## Overriding Configuration\n\nIt is possible to override monitor elements using Kubernetes resource annotations.\n\nYou can annotate an object like so to override the name of the monitor:\n```yaml\nannotations:\n  astro.fairwinds.com/override.dep-replica-alert.name: \"Deployment Replicas Alert\"\n```\n\nIn the example above we will be modifying the `dep-replica-alert` monitor (which is the Monitor Identifier from the config) to have a new `name`\nAs of now, the only fields that can be overridden are:\n* name\n* message\n* query\n* type\n* threshold-critical\n* threshold-warning\n\nTemplating in the override is currently not available.\n\n## Contributing\nPRs welcome! Check out the [Contributing Guidelines](CONTRIBUTING.md),\n[Code of Conduct](CODE_OF_CONDUCT.md), and [Roadmap](ROADMAP.md) for more information.\n\n## Further Information\nA history of changes to this project can be viewed in the [Changelog](CHANGELOG.md)\n\nIf you'd like to learn more about Astro, or if you'd like to speak with\na Kubernetes expert, you can contact `info@fairwinds.com` or [visit our website](https://fairwinds.com)\n\n## License\nApache License 2.0\n\n\u003c!-- Begin boilerplate --\u003e\n## Join the Fairwinds Open Source Community\n\nThe goal of the Fairwinds Community is to exchange ideas, influence the open source roadmap,\nand network with fellow Kubernetes users.\n[Chat with us on Slack](https://join.slack.com/t/fairwindscommunity/shared_invite/zt-e3c6vj4l-3lIH6dvKqzWII5fSSFDi1g)\n[join the user group](https://www.fairwinds.com/open-source-software-user-group) to get involved!\n\n\u003ca href=\"https://www.fairwinds.com/t-shirt-offer?utm_source=astro\u0026utm_medium=astro\u0026utm_campaign=astro-tshirt\"\u003e\n  \u003cimg src=\"https://www.fairwinds.com/hubfs/Doc_Banners/Fairwinds_OSS_User_Group_740x125_v6.png\" alt=\"Love Fairwinds Open Source? Share your business email and job title and we'll send you a free Fairwinds t-shirt!\" /\u003e\n\u003c/a\u003e\n\n## Other Projects from Fairwinds\n\nEnjoying Astro? Check out some of our other projects:\n* [Polaris](https://github.com/FairwindsOps/Polaris) - Audit, enforce, and build policies for Kubernetes resources, including over 20 built-in checks for best practices\n* [Goldilocks](https://github.com/FairwindsOps/Goldilocks) - Right-size your Kubernetes Deployments by compare your memory and CPU settings against actual usage\n* [Pluto](https://github.com/FairwindsOps/Pluto) - Detect Kubernetes resources that have been deprecated or removed in future versions\n* [Nova](https://github.com/FairwindsOps/Nova) - Check to see if any of your Helm charts have updates available\n* [rbac-manager](https://github.com/FairwindsOps/rbac-manager) - Simplify the management of RBAC in your Kubernetes clusters\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFairwindsOps%2Fastro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFairwindsOps%2Fastro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFairwindsOps%2Fastro/lists"}