From 1eb6e363460ed3c97bdda2319b7b29ba385bb65d Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 23 Aug 2024 11:39:49 +0200 Subject: [PATCH 1/5] Update .goreleaser config --- .goreleaser.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index d96a484..03fc3c9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -4,9 +4,7 @@ before: hooks: - go mod download builds: - - id: netways-ido-cleanup - binary: netways-ido-cleanup - env: + - env: - CGO_ENABLED=0 goarch: - amd64 @@ -18,7 +16,18 @@ builds: -X main.commit={{.Commit}} -X main.date={{.CommitDate}} release: + draft: true github: + owner: NETWAYS + name: netways-ido-cleanup +archives: + - format: binary + name_template: >- + {{ .ProjectName }}_{{ .Tag }}_ + {{- if eq .Os "linux" }}Linux{{ end }} + {{- if eq .Os "windows" }}Windows{{ end }} + {{- if eq .Os "darwin" }}Darwin{{ end }} + {{- if eq .Arch "amd64" }}_x86_64{{ end }} checksum: name_template: 'checksums.txt' snapshot: From ad266c7307c8a51e5c20521cdfc5af6fda4f936a Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 23 Aug 2024 11:42:26 +0200 Subject: [PATCH 2/5] Bump golangci-lint to v1.54 in CI --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 0ef3d55..7039d25 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -15,4 +15,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.51 + version: v1.54 From a0f7f72ab40dd0dffb7a4ba1e02c23171bc5e852 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 23 Aug 2024 11:43:07 +0200 Subject: [PATCH 3/5] Add Makefile --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5ab19f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: test coverage lint vet + +build: + export CGO_ENABLED=0; go build +lint: + go fmt $(go list ./... | grep -v /vendor/) +vet: + go vet $(go list ./... | grep -v /vendor/) +test: + go test -v -cover ./... +coverage: + go test -v -cover -coverprofile=coverage.out ./... &&\ + go tool cover -html=coverage.out -o coverage.html From 446c7f2c4d449f8d6eb9eafa53584021c135cf04 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 23 Aug 2024 11:43:22 +0200 Subject: [PATCH 4/5] Remove docker-compose example --- docker-compose.yml | 45 --------------------------------------------- version.go | 2 -- 2 files changed, 47 deletions(-) delete mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index e28b7de..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: '2' - -services: - db: - image: mariadb:10.2 - volumes: - - db_data:/var/lib/mysql - environment: - MYSQL_ROOT_PASSWORD: onlyforadmin - MYSQL_DATABASE: icinga2 - MYSQL_USER: icinga2 - MYSQL_PASSWORD: rosebud - ports: - - 3306:3306 - - icinga2: - image: lazyfrosch/icinga2 - depends_on: - - db - environment: - ICINGA_NODENAME: icinga2.localdomain - ICINGA_CA_ENABLE: 'true' - ICINGA_CA_TICKET_SALT: yoloops - ICINGA_API_USER_root: icinga - ICINGA_IDO_ENABLE: 'true' - ICINGA_IDO_HOST: db - ICINGA_IDO_NAME: icinga2 - ICINGA_IDO_USERNAME: icinga2 - ICINGA_IDO_PASSWORD: rosebud - ICINGA_IDO_INSTALL: 'true' - networks: - default: - aliases: - - icinga2.localdomain - ports: - - 5665:5665 - volumes: - - icinga2_data:/var/lib/icinga2 - - icinga2_log:/var/log/icinga2 - -volumes: - db_data: - icinga2_data: - icinga2_log: diff --git a/version.go b/version.go index c336dfd..9f91d77 100644 --- a/version.go +++ b/version.go @@ -2,7 +2,6 @@ package main import "fmt" -// nolint: gochecknoglobals var ( // These get filled at build time with the proper vaules version = "development" @@ -10,7 +9,6 @@ var ( date = "latest" ) -//goland:noinspection GoBoolExpressions func buildVersion() string { result := version From cb7113710e691d941b032ae110ba495a3b12c3dc Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 23 Aug 2024 11:45:22 +0200 Subject: [PATCH 5/5] Update README --- README.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 21c8333..92fb81c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ In larger installations of Icinga 2, [IDO DB cleanup] can become a challenge. Those cleanup queries are scheduled in between any other INSERT or UPDATE query. -This can cause 2 problems: +This can cause two problems: - Regular updates are deferred when cleanup is running - Not all tables are indexed correctly, so cleanup can take longer @@ -72,19 +72,19 @@ Usage of ido-cleanup: ``` $ ido-cleanup --once -INFO[0000] starting ido-cleanup +INFO[0000] starting ido-cleanup INFO[0000] deleted rows oldest="2019-03-01 11:26:44 +0000 UTC" rows=10000 table=commenthistory took=72.647379ms INFO[0000] deleted rows oldest="2019-01-21 19:35:14 +0000 UTC" rows=6129 table=contactnotifications took=76.247963ms INFO[0000] deleted rows oldest="2019-02-06 09:42:08 +0000 UTC" rows=209 table=downtimehistory took=3.992535ms INFO[0000] deleted rows oldest="2019-04-23 07:29:36 +0000 UTC" rows=60 table=eventhandlers took=6.685573ms INFO[0000] deleted rows oldest="2019-01-21 19:35:14 +0000 UTC" rows=6212 table=notifications took=84.653149ms INFO[0000] deleted rows oldest="2019-01-20 10:16:30 +0000 UTC" rows=10000 table=statehistory took=135.619702ms -INFO[0000] stopping after one cleanup +INFO[0000] stopping after one cleanup ``` ## Missing indices -Not all tables are indexed in a way to support fast deletions. +Not all tables are indexed in a way to support fast deletions. Please add those indexes to ensure speedy queries. @@ -95,19 +95,9 @@ CREATE INDEX idx_contactnotifications_cleanup on icinga_contactnotifications (in See [Icinga/icinga2#7753](https://github.com/Icinga/icinga2/issues/7753). -## License +# License Copyright (C) 2021 [NETWAYS GmbH](mailto:info@netways.de) -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . +This library is distributed under the GPL-3.0 license found in the [LICENSE](./LICENSE) +file.