diff --git a/apps/contrib/checkmk/README.de.md b/apps/contrib/checkmk/README.de.md new file mode 100644 index 0000000..1791264 --- /dev/null +++ b/apps/contrib/checkmk/README.de.md @@ -0,0 +1,69 @@ +# Hetzner Cloud Checkmk + + +
+ +[Checkmk](https://checkmk.com/) ist eine umfassende IT-Monitoring-Lösung, die eine einfache und schnelle Überwachung von Netzwerken, Servern, Anwendungen und Cloud-Umgebungen ermöglicht. + +[![Deploy to Hetzner Cloud](../../shared/images/deploy_to_hetzner.png)](https://console.hetzner.cloud/deploy/checkmk) + +Sie können Checkmk über die [Hetzner Cloud Console](https://console.hetzner.cloud) oder die [Hetzner Cloud API](https://docs.hetzner.cloud/#servers-create-a-server) installieren. + +## Getting Started + +Erstellen Sie sich Ihren Server wie gewohnt über die [Hetzner Cloud Console](https://console.hetzner.cloud). Alternativ zum Betriebssystem können Sie eine App wählen, die Sie gerne vorinstalliert hätten. + +Checkmk wird dann auf dem Server vorinstalliert, aber noch nicht aktiviert. + +Um Checkmk zu aktivieren, melden Sie sich bitte auf Ihrem Server an: + +- Per _SSH-Key_, falls Sie beim Erstellen Ihres Servers einen angegeben haben +- Per _root-Passwort_, das Sie beim Erstellen Ihres Servers per E-Mail von uns erhalten haben, wenn kein SSH-Key angegeben wurde + +Dadurch wird Checkmk aktiviert und die URL der Verwaltungsoberfläche angezeigt. + +## Hetzner Cloud API + +Anstelle der Hetzner Cloud Console kann zum Einrichten eines Checkmk Servers auch die Hetzner Cloud API genutzt werden. + +- Zum Beispiel per Curl-Befehl über die Kommandozeile + + ``` + curl \ + -X POST \ + -H "Authorization: Bearer $API_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"name":"my-checkmk-server", "server_type":"cpx11", "image":"checkmk"}' \ + 'https://api.hetzner.cloud/v1/servers' + ``` + +- Oder über [hcloud-cli](https://github.com/hetznercloud/cli) + + ``` + hcloud server create --name my-checkmk-server --type cpx11 --image checkmk + ``` + +## Image Inhalt + +### Betriebssystem + +- [x] Ubuntu 24.04 + +### Installierte Pakete + +Dieses Image enthält Checkmk und alle anderen aufgeführten Anwendungen als Pakete. + +| NAME | LIZENZ | +| ---------- | ------------------ | +| Checkmk | GPLv2 | + +## Links + +Weitere Informationen über die installierten Pakete erhalten Sie in den offiziellen Dokumentationen: + +- [Checkmk](https://docs.checkmk.com/latest/en/install_packages_debian.html) + +Weitere Informationen über Hetzner Cloud und Hetzner Cloud Apps erhalten Sie in unserer offiziellen Dokumentation: + +- [Hetzner Cloud Dokumentation](https://docs.hetzner.com/de/cloud/) +- [Hetzner Cloud API](https://docs.hetzner.cloud/) diff --git a/apps/contrib/checkmk/README.md b/apps/contrib/checkmk/README.md new file mode 100644 index 0000000..1ddc7eb --- /dev/null +++ b/apps/contrib/checkmk/README.md @@ -0,0 +1,69 @@ +# Hetzner Cloud Checkmk + + +
+ +[Checkmk](https://checkmk.com/) is a comprehensive IT monitoring solution that enables easy and fast monitoring of networks, servers, applications, and cloud environments. + +[![Deploy to Hetzner Cloud](../../shared/images/deploy_to_hetzner.png)](https://console.hetzner.cloud/deploy/checkmk) + +You can install Checkmk via the [Hetzner Cloud Console](https://console.hetzner.cloud) or the [Hetzner Cloud API](https://docs.hetzner.cloud/#servers-create-a-server). + +## Getting Started + +Create your server as usual using the [Hetzner Cloud Console](https://console.hetzner.cloud). As an alternative to the operating system, you can choose an app that you would like to have pre-installed. + +Checkmk will then be preinstalled on the server, but it will not yet be activated. + +To activate Checkmk, please log in to your server: + +- Use an _SSH key_ if you were provided one when you created your server. +- Use the _root-password_ which we sent to you via email when you created your server; use this if you did not get an SSH key. + +This will activate Checkmk and display the URL of the administration interface. + +## Hetzner Cloud API + +Instead of using the Hetzner Cloud Console, you can use the Hetzner Cloud API to set up a server with Checkmk. + +- For example, via a curl command from the command line: + + ``` + curl \ + -X POST \ + -H "Authorization: Bearer $API_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"name":"my-checkmk-server", "server_type":"cpx11", "image":"checkmk"}' \ + 'https://api.hetzner.cloud/v1/servers' + ``` + +- Or via [hcloud-cli](https://github.com/hetznercloud/cli) + + ``` + hcloud server create --name my-checkmk-server --type cpx11 --image checkmk + ``` + +## Image content + +### Operating system + +- [x] Ubuntu 24.04 + +### Installed packages + +This image contains Checkmk and all other listed applications as packages. + +| NAME | LICENSE | +| ---------- | ------------------ | +| Checkmk | GPLv2 | + +## Links + +For more information about the installed packages, see the official documentation: + +- [Checkmk](https://docs.checkmk.com/latest/en/install_packages_debian.html) + +For more information about Hetzner Cloud and Hetzner Cloud Apps, please see our official documentation: + +- [Hetzner Cloud Documentation](https://docs.hetzner.com/de/cloud/) +- [Hetzner Cloud API](https://docs.hetzner.cloud/) diff --git a/apps/contrib/checkmk/defaults.pkr.hcl b/apps/contrib/checkmk/defaults.pkr.hcl new file mode 100644 index 0000000..904ce88 --- /dev/null +++ b/apps/contrib/checkmk/defaults.pkr.hcl @@ -0,0 +1,63 @@ +packer { + required_plugins { + hcloud = { + version = ">= 1.5.0" + source = "github.com/hetznercloud/hcloud" + } + } +} + +variable "git-sha" { + type = string + default = "${env("CI_COMMIT_SHA")}" +} + +variable "snapshot_name" { + type = string + default = "packer-{{timestamp}}" +} + +variable "hcloud_api_token" { + type = string + default = "${env("HCLOUD_TOKEN")}" + sensitive = true +} + +variable "hcloud_upgrade_server_type" { + type = string + default = "${env("HCLOUD_SERVER_TYPE")}" + sensitive = true +} + +variable "hcloud_server_type" { + type = string + default = "${env("HCLOUD_SERVER_TYPE_BEFORE_UPSCALE")}" + sensitive = true +} + +variable "hcloud_server_location" { + type = string + default = "${env("HCLOUD_SERVER_LOCATION")}" + sensitive = true +} + +variable "ci_job_id" { + type = string + default = "${env("CI_JOB_ID")}" + sensitive = true +} + +source "hcloud" "autogenerated_1" { + image = var.hcloud_image + location = var.hcloud_server_location + server_name = "hcloud-app-builder-${var.app_name}-${var.ci_job_id}" + server_type = var.hcloud_server_type + upgrade_server_type = var.hcloud_upgrade_server_type + snapshot_labels = { + version = var.app_version + slug = "oneclick-${var.app_name}-${var.app_version}-${var.hcloud_image}" + } + snapshot_name = var.snapshot_name + ssh_username = "root" + token = var.hcloud_api_token +} diff --git a/apps/contrib/checkmk/files/opt/hcloud/checkmk_setup.sh b/apps/contrib/checkmk/files/opt/hcloud/checkmk_setup.sh new file mode 100755 index 0000000..52658f5 --- /dev/null +++ b/apps/contrib/checkmk/files/opt/hcloud/checkmk_setup.sh @@ -0,0 +1,110 @@ +#!/bin/bash +#set -x +# +# This will enable GitLab, configure it with user input +# and optionally set up LE. +# +cat <> /root/.bashrc < \ No newline at end of file diff --git a/apps/contrib/checkmk/images/logo_full.svg b/apps/contrib/checkmk/images/logo_full.svg new file mode 100644 index 0000000..54d3e6d --- /dev/null +++ b/apps/contrib/checkmk/images/logo_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/contrib/checkmk/metadata.json b/apps/contrib/checkmk/metadata.json new file mode 100644 index 0000000..a9d4370 --- /dev/null +++ b/apps/contrib/checkmk/metadata.json @@ -0,0 +1,16 @@ +{ + "description_de": "Checkmk ist eine umfassende IT-Monitoring-Lösung, die eine einfache und schnelle Überwachung von Netzwerken, Servern, Anwendungen und Cloud-Umgebungen ermöglicht.", + "description_en": "Checkmk is a comprehensive IT monitoring solution that enables easy and fast monitoring of networks, servers, applications, and cloud environments.", + "documentation_url": "https://docs.checkmk.com/latest/en/install_packages_debian.html", + "name": "Checkmk", + "os_id": 161547269, + "packages": [ + { + "license": "GPLv2", + "name": "Checkmk" + } + ], + "recommended_server_type": 22, + "version": "2.4.0p2", + "maintainer": "Dennis Schmalacker " +} diff --git a/apps/contrib/checkmk/scripts/install.sh b/apps/contrib/checkmk/scripts/install.sh new file mode 100644 index 0000000..b3cf209 --- /dev/null +++ b/apps/contrib/checkmk/scripts/install.sh @@ -0,0 +1,15 @@ +#!/bin/bash +#set -x + +# Get the Checkmk pubkey to verify the +wget https://download.checkmk.com/checkmk/Check_MK-pubkey.gpg -O /tmp/Check_MK-pubkey.gpg +# Import key +gpg --import /tmp/Check_MK-pubkey.gpg + +# Download and add the Checkmk GPG key +wget https://download.checkmk.com/checkmk/${application_version}/check-mk-raw-${application_version}_0.noble_amd64.deb -O /tmp/check-mk-raw-${application_version}_0.noble_amd64.deb +# Install Checkmk +apt install -y /tmp/check-mk-raw-${application_version}_0.noble_amd64.deb + +# Install Certbot +apt install -y certbot python3-certbot-apache diff --git a/apps/contrib/checkmk/template.pkr.hcl b/apps/contrib/checkmk/template.pkr.hcl new file mode 100644 index 0000000..0bb123f --- /dev/null +++ b/apps/contrib/checkmk/template.pkr.hcl @@ -0,0 +1,38 @@ +variable "app_name" { + type = string + default = "checkmk" +} + +variable "app_version" { + type = string + default = "2.4.0p2" +} + +variable "hcloud_image" { + type = string + default = "ubuntu-24.04" +} + +build { + sources = ["source.hcloud.autogenerated_1"] + + provisioner "shell" { + inline = ["cloud-init status --wait --long"] + valid_exit_codes = [0, 2] + } + + provisioner "file" { + destination = "/opt/" + source = "apps/hetzner/checkmk/files/opt/" + } + + provisioner "file" { + destination = "/var/" + source = "apps/hetzner/checkmk/files/var/" + } + + provisioner "shell" { + environment_vars = ["application_version=${var.app_version}", "DEBIAN_FRONTEND=noninteractive", "LC_ALL=C", "LANG=en_US.UTF-8", "LC_CTYPE=en_US.UTF-8",] + scripts = ["apps/shared/scripts/apt-upgrade.sh", "apps/hetzner/checkmk/scripts/install.sh", "apps/shared/scripts/cleanup.sh"] + } +} diff --git a/apps/contrib/checkmk/test.sh b/apps/contrib/checkmk/test.sh new file mode 100644 index 0000000..78f7666 --- /dev/null +++ b/apps/contrib/checkmk/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Test if Checkmk is installed +if ! dpkg -l | grep -q check-mk-raw; then + echo "Checkmk is not installed." + exit 1 +fi + +# Test if Checkmk service is running +if ! systemctl is-active --quiet omd; then + echo "Checkmk service is not running." + exit 1 +fi + +# Test if apache web interface is accessible +if ! curl -s --head http://localhost/ | grep "200 OK" > /dev/null; then + echo "apache web interface is not accessible." + exit 1 +fi + +echo "All tests passed. Checkmk is installed and running."