├── .gitignore ├── NOTICE.txt ├── github └── CODEOWNERS ├── renovate.json ├── .github └── workflows │ └── enable-actions.yml ├── k8s └── autoops_agent_deployment.yaml ├── LICENSE.txt ├── README.md └── linux └── install_autoops.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .vscode 3 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | AutoOps Install Scripts 2 | Copyright 2012-2025 Elasticsearch B.V. 3 | -------------------------------------------------------------------------------- /github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. 3 | * @elastic/opex 4 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "local>elastic/renovate-config" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.github/workflows/enable-actions.yml: -------------------------------------------------------------------------------- 1 | name: Enable GitHub Actions 2 | on: [push, pull_request] 3 | jobs: 4 | enable: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - run: echo "Hello World!" -------------------------------------------------------------------------------- /k8s/autoops_agent_deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: autoops-elastic-agent 5 | labels: 6 | app: autoops-elastic-agent 7 | app.kubernetes.io/component: autoops 8 | app.kubernetes.io/name: autoops-elastic-agent 9 | app.kubernetes.io/version: 9.1.5 10 | spec: 11 | progressDeadlineSeconds: 600 12 | replicas: 1 13 | revisionHistoryLimit: 10 14 | selector: 15 | matchLabels: 16 | app: autoops-elastic-agent 17 | app.kubernetes.io/instance: autoops-elastic-agent 18 | app.kubernetes.io/name: autoops-elastic-agent 19 | strategy: 20 | rollingUpdate: 21 | maxSurge: 25% 22 | maxUnavailable: 25% 23 | type: RollingUpdate 24 | template: 25 | metadata: 26 | labels: 27 | app: autoops-elastic-agent 28 | app.kubernetes.io/component: autoops 29 | app.kubernetes.io/instance: autoops-elastic-agent 30 | app.kubernetes.io/name: autoops-elastic-agent 31 | spec: 32 | containers: 33 | - args: 34 | - '--config' 35 | - otel_samples/autoops_es.yml 36 | env: 37 | - name: AUTOOPS_TOKEN 38 | valueFrom: 39 | secretKeyRef: 40 | name: autoops-secret 41 | key: autoops-token 42 | - name: AUTOOPS_ES_URL 43 | valueFrom: 44 | secretKeyRef: 45 | name: autoops-secret 46 | key: autoops-es-url 47 | - name: AUTOOPS_TEMP_RESOURCE_ID 48 | valueFrom: 49 | secretKeyRef: 50 | name: autoops-secret 51 | key: temp-resource-id 52 | - name: AUTOOPS_OTEL_URL 53 | valueFrom: 54 | secretKeyRef: 55 | name: autoops-secret 56 | key: autoops-otel-url 57 | - name: AUTOOPS_ES_USERNAME 58 | valueFrom: 59 | secretKeyRef: 60 | name: autoops-secret 61 | key: es-username 62 | optional: true 63 | - name: AUTOOPS_ES_PASSWORD 64 | valueFrom: 65 | secretKeyRef: 66 | name: autoops-secret 67 | key: es-password 68 | optional: true 69 | - name: AUTOOPS_ES_API_KEY 70 | valueFrom: 71 | secretKeyRef: 72 | name: autoops-secret 73 | key: es-api-key 74 | optional: true 75 | - name: ELASTIC_CLOUD_CONNECTED_MODE_API_KEY 76 | valueFrom: 77 | secretKeyRef: 78 | name: autoops-secret 79 | key: cloud-connected-mode-api-key 80 | optional: true 81 | - name: ELASTIC_CLOUD_CONNECTED_MODE_API_URL 82 | valueFrom: 83 | secretKeyRef: 84 | name: autoops-secret 85 | key: cloud-connected-mode-api-url 86 | optional: true 87 | image: >- 88 | docker.elastic.co/elastic-agent/elastic-otel-collector-wolfi:9.1.5 89 | imagePullPolicy: Always 90 | name: autoops-elastic-agent 91 | resources: {} 92 | terminationMessagePath: /dev/termination-log 93 | terminationMessagePolicy: File 94 | dnsPolicy: ClusterFirst 95 | 96 | restartPolicy: Always 97 | schedulerName: default-scheduler 98 | securityContext: {} 99 | terminationGracePeriodSeconds: 30 100 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Elastic License 2.0 2 | 3 | URL: https://www.elastic.co/licensing/elastic-license 4 | 5 | ## Acceptance 6 | 7 | By using the software, you agree to all of the terms and conditions below. 8 | 9 | ## Copyright License 10 | 11 | The licensor grants you a non-exclusive, royalty-free, worldwide, 12 | non-sublicensable, non-transferable license to use, copy, distribute, make 13 | available, and prepare derivative works of the software, in each case subject to 14 | the limitations and conditions below. 15 | 16 | ## Limitations 17 | 18 | You may not provide the software to third parties as a hosted or managed 19 | service, where the service provides users with access to any substantial set of 20 | the features or functionality of the software. 21 | 22 | You may not move, change, disable, or circumvent the license key functionality 23 | in the software, and you may not remove or obscure any functionality in the 24 | software that is protected by the license key. 25 | 26 | You may not alter, remove, or obscure any licensing, copyright, or other notices 27 | of the licensor in the software. Any use of the licensor’s trademarks is subject 28 | to applicable law. 29 | 30 | ## Patents 31 | 32 | The licensor grants you a license, under any patent claims the licensor can 33 | license, or becomes able to license, to make, have made, use, sell, offer for 34 | sale, import and have imported the software, in each case subject to the 35 | limitations and conditions in this license. This license does not cover any 36 | patent claims that you cause to be infringed by modifications or additions to 37 | the software. If you or your company make any written claim that the software 38 | infringes or contributes to infringement of any patent, your patent license for 39 | the software granted under these terms ends immediately. If your company makes 40 | such a claim, your patent license ends immediately for work on behalf of your 41 | company. 42 | 43 | ## Notices 44 | 45 | You must ensure that anyone who gets a copy of any part of the software from you 46 | also gets a copy of these terms. 47 | 48 | If you modify the software, you must include in any modified copies of the 49 | software prominent notices stating that you have modified the software. 50 | 51 | ## No Other Rights 52 | 53 | These terms do not imply any licenses other than those expressly granted in 54 | these terms. 55 | 56 | ## Termination 57 | 58 | If you use the software in violation of these terms, such use is not licensed, 59 | and your licenses will automatically terminate. If the licensor provides you 60 | with a notice of your violation, and you cease all violation of this license no 61 | later than 30 days after you receive that notice, your licenses will be 62 | reinstated retroactively. However, if you violate these terms after such 63 | reinstatement, any additional violation of these terms will cause your licenses 64 | to terminate automatically and permanently. 65 | 66 | ## No Liability 67 | 68 | *As far as the law allows, the software comes as is, without any warranty or 69 | condition, and the licensor will not be liable to you for any damages arising 70 | out of these terms or the use or nature of the software, under any kind of 71 | legal claim.* 72 | 73 | ## Definitions 74 | 75 | The **licensor** is the entity offering these terms, and the **software** is the 76 | software the licensor makes available under these terms, including any portion 77 | of it. 78 | 79 | **you** refers to the individual or entity agreeing to these terms. 80 | 81 | **your company** is any legal entity, sole proprietorship, or other kind of 82 | organization that you work for, plus all organizations that have control over, 83 | are under the control of, or are under common control with that 84 | organization. **control** means ownership of substantially all the assets of an 85 | entity, or the power to direct its management and policies by vote, contract, or 86 | otherwise. Control can be direct or indirect. 87 | 88 | **your licenses** are all the licenses granted to you for the software under 89 | these terms. 90 | 91 | **use** means anything you do with the software requiring one of your licenses. 92 | 93 | **trademark** means trademarks, service marks, and similar rights. 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # autoops-install 2 | 3 | Install scripts to simplify the installation of AutoOps with your Self-Managed clusters. 4 | 5 | # Kubernetes Installation 6 | 7 | Instructions for the Kubernetes installation are provided by the AutoOps Installation Wizard. However, examples are shown below for posterity. 8 | 9 | Use the `k8s/autoops_agent_deployment.yaml` deployment configuration to install a new agent in your Kubernetes cluster. 10 | 11 | | Parameter | Optional | Description | 12 | |-----------|----------|----------| 13 | | `autoops-token` | No | The AutoOps Token. | 14 | | `autoops-otel-endpoint` | No | The URL where OTel data is delivered for AutoOps. | 15 | | `ccm-api-key` | No | The Elastic Cloud API Key that allows the cluster to be registered. | 16 | | `ccm-api-url` | Yes | The Elastic Cloud endpoint that allows the cluster to be registered. | 17 | | `temp-resource-id` | No | The ID used to allow the wizard to recognize when the resource has been added. | 18 | | `autoops-es-url` | No | The Elasticsearch endpoint to fetch data from Elasticsearch. | 19 | | `es-username` | Yes | The Elasticsearch username used to fetch data from Elasticsearch. Requires password. | 20 | | `es-password` | Yes | The Elasticsearch password used to fetch data from Elasticsearch. Requires username. | 21 | | `es-api-key` | Yes | The Elasticsearch API Key used to fetch data from Elasticsearch. Cannot be suppled with username or password. | 22 | 23 | ### Installation with Elasticsearch Basic Auth (Username / Password) 24 | 25 | ```sh 26 | kubectl create secret generic autoops-secret \ 27 | --from-literal=autoops-token="" \ 28 | --from-literal=temp-resource-id="" \ 29 | --from-literal=autoops-otel-url="" \ 30 | --from-literal=cloud-connected-mode-api-key="" \ 31 | --from-literal=cloud-connected-mode-api-url="" \ 32 | --from-literal=autoops-es-url="" \ 33 | --from-literal=es-username="" \ 34 | --from-literal=es-password="" && \ 35 | kubectl apply -f https://raw.githubusercontent.com/elastic/autoops-install/main/k8s/autoops_agent_deployment.yaml 36 | ``` 37 | 38 | ### Installation with Elasticsearch API Key 39 | 40 | ```sh 41 | kubectl create secret generic autoops-secret \ 42 | --from-literal=autoops-token="" \ 43 | --from-literal=temp-resource-id="" \ 44 | --from-literal=autoops-otel-url="" \ 45 | --from-literal=cloud-connected-mode-api-key="" \ 46 | --from-literal=cloud-connected-mode-api-url="" \ 47 | --from-literal=autoops-es-url="" \ 48 | --from-literal=es-api-key="" && \ 49 | kubectl apply -f https://raw.githubusercontent.com/elastic/autoops-install/main/k8s/autoops_agent_deployment.yaml 50 | ``` 51 | 52 | # Linux Installation 53 | 54 | Copy or otherwise use the script located in `linux/install_autoops.sh`. This script uses the Elastic Agent's installer and to install it as a service and sets the CLI parameters as configuration for it. 55 | 56 | Use the `install_autoops.sh` script in order to install a new agent on your Linux machine. 57 | 58 | | Parameter | Optional | Description | 59 | |-----------|----------|----------| 60 | | `token` | No | The AutoOps Token. | 61 | | `otel-endpoint` | No | The URL where OTel data is delivered for AutoOps. | 62 | | `ccm-api-key` | No | The Elastic Cloud API Key that allows the cluster to be registered. | 63 | | `ccm-api-url` | Yes | The Elastic Cloud endpoint that allows the cluster to be registered. | 64 | | `temp-resource-id` | No | The ID used to allow the wizard to recognize when the resource has been added. | 65 | | `es-endpoint` | No | The Elasticsearch endpoint to fetch data from Elasticsearch. | 66 | | `es-username` | Yes | The Elasticsearch username used to fetch data from Elasticsearch. Requires password. | 67 | | `es-password` | Yes | The Elasticsearch password used to fetch data from Elasticsearch. Requires username. | 68 | | `es-api-key` | Yes | The Elasticsearch API Key used to fetch data from Elasticsearch. Cannot be suppled with username or password. | 69 | | `version` | Yes | Allows the version of the Elastic Agent to be overridden. Has to be 9.1.4 or later. **Note**: does **not** need to match the Elastic Stack version and this should not be used unless requested. | 70 | 71 | ### Installation with Elasticsearch Basic Auth (Username / Password) 72 | 73 | ```sh 74 | ./install_autoops.sh \ 75 | --token "" \ 76 | --otel-endpoint "" \ 77 | --ccm-api-key "" \ 78 | --ccm-api-url "" \ 79 | --temp-resource-id "" \ 80 | --es-endpoint "" \ 81 | --es-username "" \ 82 | --es-password "" 83 | ``` 84 | 85 | ### Installation with Elasticsearch API Key 86 | 87 | ```sh 88 | ./install_autoops.sh \ 89 | --token "" \ 90 | --otel-endpoint "" \ 91 | --ccm-api-key "" \ 92 | --ccm-api-url "" \ 93 | --temp-resource-id "" \ 94 | --es-endpoint "" \ 95 | --es-api-key "" 96 | ``` 97 | -------------------------------------------------------------------------------- /linux/install_autoops.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one 4 | # or more contributor license agreements. Licensed under the Elastic License 5 | # 2.0; you may not use this file except in compliance with the Elastic License 6 | # 2.0. 7 | # 8 | 9 | # Usage example: 10 | # ./install_autoops.sh \ 11 | # --version 9.1.2 \ 12 | # --token abc123 \ 13 | # --ccm-api-key xyz789 \ 14 | # --otel-endpoint https://otel-url.co:4318 \ 15 | # --es-endpoint https://es-url.co:9200 \ 16 | # --es-username myuser \ 17 | # --es-password mypass \ 18 | # --temp-resource-id my-es-cluster 19 | 20 | # --------------------------- 21 | # Configurable defaults 22 | # --------------------------- 23 | DOWNLOAD_URL="https://artifacts.elastic.co/downloads/beats/elastic-agent" 24 | VERSION="9.1.5" 25 | DO_NOT_DELETE=false 26 | CACHE_DIR="${AUTOOPS_CACHE_DIR:-$HOME/.cache/elastic-agent-installer}" 27 | ELASTIC_CLOUD_CONNECTED_MODE_API_URL="" 28 | 29 | # Required (populated by flags) 30 | AUTOOPS_ES_URL="" 31 | AUTOOPS_OTEL_URL="" 32 | AUTOOPS_TEMP_RESOURCE_ID="" 33 | AUTOOPS_TOKEN="" 34 | ELASTIC_CLOUD_CONNECTED_MODE_API_KEY="" 35 | 36 | # Optional creds (user/pass OR api key) 37 | AUTOOPS_ES_USERNAME="" 38 | AUTOOPS_ES_PASSWORD="" 39 | AUTOOPS_ES_API_KEY="" 40 | 41 | # --------------------------- 42 | # Parse args 43 | # --------------------------- 44 | while [[ "$#" -gt 0 ]]; do 45 | case $1 in 46 | --es-endpoint) AUTOOPS_ES_URL="$2"; shift 2;; 47 | --otel-endpoint) AUTOOPS_OTEL_URL="$2"; shift 2;; 48 | --token) AUTOOPS_TOKEN="$2"; shift 2;; 49 | --ccm-api-key) ELASTIC_CLOUD_CONNECTED_MODE_API_KEY="$2"; shift 2;; 50 | --ccm-api-url) ELASTIC_CLOUD_CONNECTED_MODE_API_URL="$2"; shift 2;; 51 | --temp-resource-id) AUTOOPS_TEMP_RESOURCE_ID="$2"; shift 2;; 52 | --es-username) AUTOOPS_ES_USERNAME="$2"; shift 2;; 53 | --es-password) AUTOOPS_ES_PASSWORD="$2"; shift 2;; 54 | --es-api-key) AUTOOPS_ES_API_KEY="$2"; shift 2;; 55 | --version) VERSION="$2"; shift 2;; 56 | --download-url) DOWNLOAD_URL="$2"; shift 2;; 57 | --cache-dir) CACHE_DIR="$2"; shift 2;; 58 | --do-not-delete) DO_NOT_DELETE=true; shift;; 59 | *) echo "Unknown parameter: $1"; exit 1;; 60 | esac 61 | done 62 | 63 | # --------------------------- 64 | # Validate inputs 65 | # --------------------------- 66 | if [[ -z "$VERSION" ]]; then 67 | echo "Error: --version required"; exit 1 68 | elif [[ -z "$AUTOOPS_TEMP_RESOURCE_ID" ]]; then 69 | echo "Error: --temp-resource-id required"; exit 1 70 | elif [[ -z "$AUTOOPS_TOKEN" ]]; then 71 | echo "Error: --token required"; exit 1 72 | elif [[ -z "$AUTOOPS_ES_URL" ]]; then 73 | echo "Error: --es-endpoint required"; exit 1 74 | elif [[ -z "$AUTOOPS_OTEL_URL" ]]; then 75 | echo "Error: --otel-endpoint required"; exit 1 76 | elif [[ -z "$ELASTIC_CLOUD_CONNECTED_MODE_API_KEY" ]]; then 77 | echo "Error: --ccm-api-key required"; exit 1 78 | elif [[ -n "$AUTOOPS_ES_API_KEY" && ( -n "$AUTOOPS_ES_USERNAME" || -n "$AUTOOPS_ES_PASSWORD" ) ]]; then 79 | echo "Error: --es-api-key cannot be combined with --es-username/--es-password"; exit 1 80 | elif [[ ( -n "$AUTOOPS_ES_USERNAME" && -z "$AUTOOPS_ES_PASSWORD" ) || ( -z "$AUTOOPS_ES_USERNAME" && -n "$AUTOOPS_ES_PASSWORD" ) ]]; then 81 | echo "Error: --es-username and --es-password must be provided together"; exit 1 82 | fi 83 | 84 | # --------------------------- 85 | # Arch mapping to Elastic filenames 86 | # --------------------------- 87 | UNAME_ARCH="$(uname -m)" 88 | case "$UNAME_ARCH" in 89 | x86_64|amd64) AGENT_ARCH="x86_64" ;; 90 | aarch64|arm64) AGENT_ARCH="arm64" ;; 91 | *) 92 | echo "Unsupported architecture: $UNAME_ARCH" 93 | echo "Supported: x86_64, arm64" 94 | exit 1 95 | ;; 96 | esac 97 | 98 | TAR_FILE="elastic-agent-${VERSION}-linux-${AGENT_ARCH}.tar.gz" 99 | CACHE_PATH="${CACHE_DIR}/${TAR_FILE}" 100 | 101 | # --------------------------- 102 | # Temp dir & cleanup 103 | # --------------------------- 104 | TEMP_DIR="$(mktemp -d)" 105 | echo "Temporary directory: ${TEMP_DIR}" 106 | 107 | if [ "$DO_NOT_DELETE" = false ]; then 108 | trap 'echo "Cleaning up ${TEMP_DIR}"; rm -rf "${TEMP_DIR}"' EXIT 109 | fi 110 | 111 | mkdir -p "${CACHE_DIR}" 112 | 113 | # --------------------------- 114 | # Download (with cache) 115 | # --------------------------- 116 | download_with_cache() { 117 | echo "Looking for cached package: ${CACHE_PATH}" 118 | if [[ -s "${CACHE_PATH}" ]]; then 119 | # Validate cached tarball 120 | if tar -tzf "${CACHE_PATH}" >/dev/null 2>&1; then 121 | echo "✅ Using cached ${TAR_FILE}" 122 | return 0 123 | else 124 | echo "⚠️ Cached file seems corrupted; re-downloading…" 125 | rm -f "${CACHE_PATH}" 126 | fi 127 | fi 128 | 129 | echo "Downloading Elastic Agent: ${TAR_FILE}" 130 | curl -fL --retry 3 --retry-delay 2 -o "${CACHE_PATH}" "${DOWNLOAD_URL}/${TAR_FILE}" || { 131 | echo "Error: download failed: ${DOWNLOAD_URL}/${TAR_FILE}" 132 | rm -f "${CACHE_PATH}" 133 | exit 1 134 | } 135 | 136 | # Validate fresh download 137 | if ! tar -tzf "${CACHE_PATH}" >/dev/null 2>&1; then 138 | echo "Error: downloaded tarball is invalid (${CACHE_PATH})" 139 | rm -f "${CACHE_PATH}" 140 | exit 1 141 | fi 142 | } 143 | 144 | download_with_cache 145 | 146 | # Work from temp dir, copy cached tar there 147 | cd "${TEMP_DIR}" 148 | cp "${CACHE_PATH}" "./${TAR_FILE}" 149 | 150 | echo "Extracting ${TAR_FILE}…" 151 | tar xzvf "${TAR_FILE}" >/dev/null 152 | 153 | AGENT_DIR="elastic-agent-${VERSION}-linux-${AGENT_ARCH}" 154 | if [[ ! -d "${AGENT_DIR}" ]]; then 155 | echo "Error: expected directory ${AGENT_DIR} after extraction" 156 | exit 1 157 | fi 158 | cd "${AGENT_DIR}" 159 | 160 | # --------------------------- 161 | # Prepare config 162 | # --------------------------- 163 | if [[ ! -s "./otel_samples/autoops_es.yml" ]]; then 164 | echo "Error: Missing otel_samples/autoops_es.yml for version [${VERSION}]" 165 | exit 1 166 | fi 167 | 168 | cp ./otel_samples/autoops_es.yml elastic-agent.yml 169 | 170 | # --------------------------- 171 | # Install agent 172 | # --------------------------- 173 | echo "Installing Elastic Agent…" 174 | sudo ./elastic-agent install --non-interactive 175 | 176 | # --------------------------- 177 | # Systemd env injection 178 | # --------------------------- 179 | echo "Configuring systemd env vars…" 180 | sudo mkdir -p /etc/systemd/system/elastic-agent.service.d 181 | 182 | sudo tee /etc/systemd/system/elastic-agent.service.d/autoops-env.conf >/dev/null <